mirror of
https://github.com/oven-sh/bun
synced 2026-02-17 14:22:01 +00:00
Compare commits
72 Commits
jarred/sli
...
ali/test-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5395767685 | ||
|
|
352cecde32 | ||
|
|
2cca4efbe7 | ||
|
|
eb5cb58e56 | ||
|
|
6c6d46333f | ||
|
|
0c40eaf8ab | ||
|
|
3983010835 | ||
|
|
6bbdbcef33 | ||
|
|
8f397fb5b7 | ||
|
|
34fd2437fd | ||
|
|
bf7d9f272d | ||
|
|
45198e1e45 | ||
|
|
df8ad0cf0b | ||
|
|
a7b46ebbfe | ||
|
|
6090833da6 | ||
|
|
efc9cae938 | ||
|
|
06fa1ed598 | ||
|
|
cd8d037c79 | ||
|
|
5e8fbf57cb | ||
|
|
83a825edff | ||
|
|
85766e90bf | ||
|
|
839ad3732f | ||
|
|
d774baa28a | ||
|
|
6e063fa57b | ||
|
|
a5358fbbd9 | ||
|
|
4a6f179db5 | ||
|
|
270c09bd90 | ||
|
|
d40662760a | ||
|
|
6a922be010 | ||
|
|
dcf1b1fbf5 | ||
|
|
4e234ded2a | ||
|
|
3f360b0682 | ||
|
|
efdeac0a85 | ||
|
|
d900309354 | ||
|
|
da7dfa1b76 | ||
|
|
a182c313e2 | ||
|
|
a2ae0d06b3 | ||
|
|
26579c3ba5 | ||
|
|
dd53294a25 | ||
|
|
0b8773ed76 | ||
|
|
0a0205be6e | ||
|
|
de88da687f | ||
|
|
64ed68c9e0 | ||
|
|
d09cbdfae9 | ||
|
|
15a5e3a924 | ||
|
|
ec865e385a | ||
|
|
4a210138a9 | ||
|
|
a4bc1c8a35 | ||
|
|
de487713ed | ||
|
|
14b439a115 | ||
|
|
b5f31a6ee2 | ||
|
|
a8cc395a20 | ||
|
|
71c770f3ae | ||
|
|
ff1ff78e77 | ||
|
|
500199fe8b | ||
|
|
52de27322a | ||
|
|
acf36d958a | ||
|
|
00a3cbd977 | ||
|
|
d291b56f8b | ||
|
|
920b3dc8de | ||
|
|
b478171202 | ||
|
|
1c464c5d14 | ||
|
|
5a58c02ed8 | ||
|
|
8deac8b3b9 | ||
|
|
862ae48ebd | ||
|
|
33de1b81bf | ||
|
|
0a624bc0a8 | ||
|
|
c130d1bd69 | ||
|
|
cc33a8562a | ||
|
|
428b9a92de | ||
|
|
ded202d57b | ||
|
|
9dc1ce4f47 |
@@ -323,9 +323,26 @@ function getCppAgent(platform, options) {
|
||||
function getZigAgent(platform, options) {
|
||||
const { arch } = platform;
|
||||
|
||||
return {
|
||||
queue: "build-zig",
|
||||
};
|
||||
// Uncomment to restore to using macOS on-prem for Zig.
|
||||
// return {
|
||||
// queue: "build-zig",
|
||||
// };
|
||||
|
||||
return getEc2Agent(
|
||||
{
|
||||
os: "linux",
|
||||
arch: "x64",
|
||||
abi: "musl",
|
||||
distro: "alpine",
|
||||
release: "3.21",
|
||||
},
|
||||
options,
|
||||
{
|
||||
instanceType: "c7i.2xlarge",
|
||||
cpuCount: 4,
|
||||
threadsPerCore: 1,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,15 +651,15 @@ function getReleaseStep(buildPlatforms, options) {
|
||||
* @param {Platform[]} buildPlatforms
|
||||
* @returns {Step}
|
||||
*/
|
||||
function getBenchmarkStep(buildPlatforms) {
|
||||
function getBenchmarkStep() {
|
||||
return {
|
||||
key: "benchmark",
|
||||
label: "📊",
|
||||
agents: {
|
||||
queue: "build-image",
|
||||
},
|
||||
depends_on: buildPlatforms.map(platform => `${getTargetKey(platform)}-build-bun`),
|
||||
command: "node .buildkite/scripts/upload-benchmark.ts",
|
||||
depends_on: `linux-x64-build-bun`,
|
||||
command: "node .buildkite/scripts/upload-benchmark.mjs",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1126,9 +1143,8 @@ async function getPipeline(options = {}) {
|
||||
|
||||
if (isMainBranch()) {
|
||||
steps.push(getReleaseStep(buildPlatforms, options));
|
||||
// TODO: fix the broken benchmark step
|
||||
// steps.push(getBenchmarkStep(buildPlatforms));
|
||||
}
|
||||
steps.push(getBenchmarkStep());
|
||||
|
||||
/** @type {Map<string, GroupStep>} */
|
||||
const stepsByGroup = new Map();
|
||||
|
||||
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -52,3 +52,6 @@ test/js/node/test/fixtures linguist-vendored
|
||||
test/js/node/test/common linguist-vendored
|
||||
|
||||
test/js/bun/css/files linguist-vendored
|
||||
|
||||
.vscode/*.json linguist-language=JSON-with-Comments
|
||||
src/cli/init/tsconfig.default.json linguist-language=JSON-with-Comments
|
||||
18
.github/CODEOWNERS
vendored
Normal file
18
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
# Project
|
||||
.github/CODEOWNERS @Jarred-Sumner
|
||||
|
||||
# Build system
|
||||
CMakeLists.txt @Electroid
|
||||
cmake/ @Electroid
|
||||
scripts/ @Electroid
|
||||
|
||||
# CI
|
||||
.buildkite/ @Electroid
|
||||
.github/workflows/ @Electroid
|
||||
|
||||
# Debugger protocol
|
||||
packages/bun-inspector-protocol/ @Electroid
|
||||
packages/bun-debug-adapter-protocol/ @Electroid
|
||||
|
||||
# Tests
|
||||
test/expectations.txt @Jarred-Sumner
|
||||
41
.github/workflows/clang-format.yml
vendored
41
.github/workflows/clang-format.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: clang-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.2.0"
|
||||
LLVM_VERSION: "19.1.7"
|
||||
LLVM_VERSION_MAJOR: "19"
|
||||
|
||||
jobs:
|
||||
clang-format:
|
||||
name: clang-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
|
||||
- name: Clang Format
|
||||
env:
|
||||
LLVM_VERSION: ${{ env.LLVM_VERSION }}
|
||||
run: |
|
||||
bun run clang-format
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run clang-format`"
|
||||
41
.github/workflows/clang-tidy.yml
vendored
41
.github/workflows/clang-tidy.yml
vendored
@@ -1,41 +0,0 @@
|
||||
name: clang-tidy
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.2.0"
|
||||
LLVM_VERSION: "19.1.7"
|
||||
LLVM_VERSION_MAJOR: "19"
|
||||
|
||||
jobs:
|
||||
clang-tidy:
|
||||
name: clang-tidy
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
|
||||
- name: Clang Tidy
|
||||
env:
|
||||
LLVM_VERSION: ${{ env.LLVM_VERSION }}
|
||||
run: |
|
||||
bun run clang-tidy:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run clang-tidy`"
|
||||
65
.github/workflows/format.yml
vendored
Normal file
65
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.2.11"
|
||||
LLVM_VERSION: "19.1.7"
|
||||
LLVM_VERSION_MAJOR: "19"
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global core.autocrlf true
|
||||
git config --global core.ignorecase true
|
||||
git config --global core.precomposeUnicode true
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Setup Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Install LLVM
|
||||
run: |
|
||||
curl -fsSL https://apt.llvm.org/llvm.sh | sudo bash -s -- ${{ env.LLVM_VERSION_MAJOR }} all
|
||||
- name: Setup Zig
|
||||
uses: mlugg/setup-zig@v1
|
||||
with:
|
||||
version: 0.14.0
|
||||
- name: Zig Format
|
||||
run: |
|
||||
zig fmt src/**.zig
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run zig-format`"
|
||||
- name: Prettier Format
|
||||
run: |
|
||||
bun run prettier
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run prettier`"
|
||||
- name: Clang Format
|
||||
run: |
|
||||
bun run clang-format
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run clang-format`"
|
||||
27
.github/workflows/labeled.yml
vendored
27
.github/workflows/labeled.yml
vendored
@@ -69,7 +69,6 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
LABELS=$(bun scripts/read-issue.ts)
|
||||
echo "labels=$LABELS" >> $GITHUB_OUTPUT
|
||||
bun scripts/is-outdated.ts
|
||||
|
||||
if [[ -f "is-outdated.txt" ]]; then
|
||||
@@ -77,12 +76,19 @@ jobs:
|
||||
fi
|
||||
|
||||
if [[ -f "outdated.txt" ]]; then
|
||||
echo "oudated=$(cat outdated.txt)" >> $GITHUB_OUTPUT
|
||||
echo "outdated=$(cat outdated.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
if [[ -f "is-very-outdated.txt" ]]; then
|
||||
echo "is-very-outdated=true" >> $GITHUB_OUTPUT
|
||||
LABELS="$LABELS,old-version"
|
||||
else
|
||||
echo "is-very-outdated=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
echo "latest=$(cat LATEST)" >> $GITHUB_OUTPUT
|
||||
|
||||
rm -rf is-outdated.txt outdated.txt latest.txt
|
||||
echo "labels=$LABELS" >> $GITHUB_OUTPUT
|
||||
rm -rf is-outdated.txt outdated.txt latest.txt is-very-outdated.txt
|
||||
- name: Generate comment text with Sentry Link
|
||||
if: github.event.label.name == 'crash'
|
||||
# ignore if fail
|
||||
@@ -102,7 +108,14 @@ jobs:
|
||||
if [[ -f "sentry-id.txt" ]]; then
|
||||
echo "sentry-id=$(cat sentry-id.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Remove old labels
|
||||
uses: actions-cool/issues-helper@v3
|
||||
if: github.event.label.name == 'crash' && steps.add-labels.outputs.is-very-outdated == 'false'
|
||||
with:
|
||||
actions: "remove-labels"
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
labels: old-version
|
||||
- name: Add labels
|
||||
uses: actions-cool/issues-helper@v3
|
||||
if: github.event.label.name == 'crash'
|
||||
@@ -119,7 +132,7 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
@${{ github.event.issue.user.login }}, the latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.oudated }}.
|
||||
@${{ github.event.issue.user.login }}, the latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.outdated }}.
|
||||
|
||||
Are you able to reproduce this crash on the latest version of Bun?
|
||||
|
||||
@@ -134,7 +147,7 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
@${{ github.event.issue.user.login }}, thank you for reporting this crash. The latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.oudated }}.
|
||||
@${{ github.event.issue.user.login }}, thank you for reporting this crash. The latest version of Bun is v${{ steps.add-labels.outputs.latest }}, but this crash was reported on Bun v${{ steps.add-labels.outputs.outdated }}.
|
||||
|
||||
Are you able to reproduce this crash on the latest version of Bun?
|
||||
|
||||
|
||||
37
.github/workflows/prettier-format.yml
vendored
37
.github/workflows/prettier-format.yml
vendored
@@ -1,37 +0,0 @@
|
||||
name: prettier-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.2.0"
|
||||
|
||||
jobs:
|
||||
prettier-format:
|
||||
name: prettier-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Setup Dependencies
|
||||
run: |
|
||||
bun install
|
||||
- name: Prettier Format
|
||||
run: |
|
||||
bun run prettier:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run prettier:extra`"
|
||||
34
.github/workflows/zig-format.yml
vendored
34
.github/workflows/zig-format.yml
vendored
@@ -1,34 +0,0 @@
|
||||
name: zig-format
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
env:
|
||||
BUN_VERSION: "1.2.0"
|
||||
|
||||
jobs:
|
||||
zig-format:
|
||||
name: zig-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: ${{ env.BUN_VERSION }}
|
||||
- name: Zig Format
|
||||
run: |
|
||||
bun run zig-format:diff
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "`bun run zig-format`"
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -43,6 +43,9 @@
|
||||
"editor.tabSize": 4,
|
||||
"editor.useTabStops": false,
|
||||
"editor.defaultFormatter": "ziglang.vscode-zig",
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.organizeImports": "never",
|
||||
},
|
||||
},
|
||||
|
||||
// lldb
|
||||
|
||||
262
README.md
262
README.md
@@ -96,10 +96,14 @@ bun upgrade --canary
|
||||
- [`bun init`](https://bun.sh/docs/cli/init)
|
||||
- [`bun create`](https://bun.sh/docs/cli/bun-create)
|
||||
|
||||
- CLI
|
||||
|
||||
- [`bun upgrade`](https://bun.sh/docs/cli/bun-upgrade)
|
||||
|
||||
- Runtime
|
||||
|
||||
- [`bun run`](https://bun.sh/docs/cli/run)
|
||||
- [File types](https://bun.sh/docs/runtime/loaders)
|
||||
- [File types (Loaders)](https://bun.sh/docs/runtime/loaders)
|
||||
- [TypeScript](https://bun.sh/docs/runtime/typescript)
|
||||
- [JSX](https://bun.sh/docs/runtime/jsx)
|
||||
- [Environment variables](https://bun.sh/docs/runtime/env)
|
||||
@@ -108,12 +112,12 @@ bun upgrade --canary
|
||||
- [Node.js compatibility](https://bun.sh/docs/runtime/nodejs-apis)
|
||||
- [Single-file executable](https://bun.sh/docs/bundler/executables)
|
||||
- [Plugins](https://bun.sh/docs/runtime/plugins)
|
||||
- [Watch mode](https://bun.sh/docs/runtime/hot)
|
||||
- [Watch mode / Hot Reloading](https://bun.sh/docs/runtime/hot)
|
||||
- [Module resolution](https://bun.sh/docs/runtime/modules)
|
||||
- [Auto-install](https://bun.sh/docs/runtime/autoimport)
|
||||
- [bunfig.toml](https://bun.sh/docs/runtime/bunfig)
|
||||
- [Debugger](https://bun.sh/docs/runtime/debugger)
|
||||
- [Framework API](https://bun.sh/docs/runtime/framework)
|
||||
- [$ Shell](https://bun.sh/docs/runtime/shell)
|
||||
|
||||
- Package manager
|
||||
|
||||
@@ -122,7 +126,12 @@ bun upgrade --canary
|
||||
- [`bun remove`](https://bun.sh/docs/cli/remove)
|
||||
- [`bun update`](https://bun.sh/docs/cli/update)
|
||||
- [`bun link`](https://bun.sh/docs/cli/link)
|
||||
- [`bun unlink`](https://bun.sh/docs/cli/unlink)
|
||||
- [`bun pm`](https://bun.sh/docs/cli/pm)
|
||||
- [`bun outdated`](https://bun.sh/docs/cli/outdated)
|
||||
- [`bun publish`](https://bun.sh/docs/cli/publish)
|
||||
- [`bun patch`](https://bun.sh/docs/install/patch)
|
||||
- [`bun patch-commit`](https://bun.sh/docs/cli/patch-commit)
|
||||
- [Global cache](https://bun.sh/docs/install/cache)
|
||||
- [Workspaces](https://bun.sh/docs/install/workspaces)
|
||||
- [Lifecycle scripts](https://bun.sh/docs/install/lifecycle)
|
||||
@@ -130,6 +139,7 @@ bun upgrade --canary
|
||||
- [Lockfile](https://bun.sh/docs/install/lockfile)
|
||||
- [Scopes and registries](https://bun.sh/docs/install/registries)
|
||||
- [Overrides and resolutions](https://bun.sh/docs/install/overrides)
|
||||
- [`.npmrc`](https://bun.sh/docs/install/npmrc)
|
||||
|
||||
- Bundler
|
||||
|
||||
@@ -138,6 +148,11 @@ bun upgrade --canary
|
||||
- [Plugins](https://bun.sh/docs/bundler/plugins)
|
||||
- [Macros](https://bun.sh/docs/bundler/macros)
|
||||
- [vs esbuild](https://bun.sh/docs/bundler/vs-esbuild)
|
||||
- [Single-file executable](https://bun.sh/docs/bundler/executables)
|
||||
- [CSS](https://bun.sh/docs/bundler/css)
|
||||
- [HTML](https://bun.sh/docs/bundler/html)
|
||||
- [Hot Module Replacement (HMR)](https://bun.sh/docs/bundler/hmr)
|
||||
- [Full-stack with HTML imports](https://bun.sh/docs/bundler/fullstack)
|
||||
|
||||
- Test runner
|
||||
|
||||
@@ -150,6 +165,10 @@ bun upgrade --canary
|
||||
- [Dates and times](https://bun.sh/docs/test/time)
|
||||
- [DOM testing](https://bun.sh/docs/test/dom)
|
||||
- [Code coverage](https://bun.sh/docs/test/coverage)
|
||||
- [Configuration](https://bun.sh/docs/test/configuration)
|
||||
- [Discovery](https://bun.sh/docs/test/discovery)
|
||||
- [Reporters](https://bun.sh/docs/test/reporters)
|
||||
- [Runtime Behavior](https://bun.sh/docs/test/runtime-behavior)
|
||||
|
||||
- Package runner
|
||||
|
||||
@@ -157,219 +176,235 @@ bun upgrade --canary
|
||||
|
||||
- API
|
||||
|
||||
- [HTTP server](https://bun.sh/docs/api/http)
|
||||
- [HTTP server (`Bun.serve`)](https://bun.sh/docs/api/http)
|
||||
- [WebSockets](https://bun.sh/docs/api/websockets)
|
||||
- [Workers](https://bun.sh/docs/api/workers)
|
||||
- [Binary data](https://bun.sh/docs/api/binary-data)
|
||||
- [Streams](https://bun.sh/docs/api/streams)
|
||||
- [File I/O](https://bun.sh/docs/api/file-io)
|
||||
- [File I/O (`Bun.file`)](https://bun.sh/docs/api/file-io)
|
||||
- [import.meta](https://bun.sh/docs/api/import-meta)
|
||||
- [SQLite](https://bun.sh/docs/api/sqlite)
|
||||
- [SQLite (`bun:sqlite`)](https://bun.sh/docs/api/sqlite)
|
||||
- [PostgreSQL (`Bun.sql`)](https://bun.sh/docs/api/sql)
|
||||
- [Redis (`Bun.redis`)](https://bun.sh/docs/api/redis)
|
||||
- [S3 Client (`Bun.s3`)](https://bun.sh/docs/api/s3)
|
||||
- [FileSystemRouter](https://bun.sh/docs/api/file-system-router)
|
||||
- [TCP sockets](https://bun.sh/docs/api/tcp)
|
||||
- [UDP sockets](https://bun.sh/docs/api/udp)
|
||||
- [Globals](https://bun.sh/docs/api/globals)
|
||||
- [$ Shell](https://bun.sh/docs/runtime/shell)
|
||||
- [Child processes](https://bun.sh/docs/api/spawn)
|
||||
- [Transpiler](https://bun.sh/docs/api/transpiler)
|
||||
- [Child processes (spawn)](https://bun.sh/docs/api/spawn)
|
||||
- [Transpiler (`Bun.Transpiler`)](https://bun.sh/docs/api/transpiler)
|
||||
- [Hashing](https://bun.sh/docs/api/hashing)
|
||||
- [Colors (`Bun.color`)](https://bun.sh/docs/api/color)
|
||||
- [Console](https://bun.sh/docs/api/console)
|
||||
- [FFI](https://bun.sh/docs/api/ffi)
|
||||
- [FFI (`bun:ffi`)](https://bun.sh/docs/api/ffi)
|
||||
- [C Compiler (`bun:ffi` cc)](https://bun.sh/docs/api/cc)
|
||||
- [HTMLRewriter](https://bun.sh/docs/api/html-rewriter)
|
||||
- [Testing](https://bun.sh/docs/api/test)
|
||||
- [Testing (`bun:test`)](https://bun.sh/docs/api/test)
|
||||
- [Cookies (`Bun.Cookie`)](https://bun.sh/docs/api/cookie)
|
||||
- [Utils](https://bun.sh/docs/api/utils)
|
||||
- [Node-API](https://bun.sh/docs/api/node-api)
|
||||
- [Glob](https://bun.sh/docs/api/glob)
|
||||
- [Semver](https://bun.sh/docs/api/semver)
|
||||
|
||||
- Project
|
||||
- [Roadmap](https://bun.sh/docs/project/roadmap)
|
||||
- [Benchmarking](https://bun.sh/docs/project/benchmarking)
|
||||
- [Contributing](https://bun.sh/docs/project/contributing)
|
||||
- [Building Windows](https://bun.sh/docs/project/building-windows)
|
||||
- [License](https://bun.sh/docs/project/licensing)
|
||||
- [Glob (`Bun.Glob`)](https://bun.sh/docs/api/glob)
|
||||
- [Semver (`Bun.semver`)](https://bun.sh/docs/api/semver)
|
||||
- [DNS](https://bun.sh/docs/api/dns)
|
||||
- [fetch API extensions](https://bun.sh/docs/api/fetch)
|
||||
|
||||
## 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)
|
||||
- [Convert a Blob to a Uint8Array](https://bun.sh/guides/binary/blob-to-typedarray)
|
||||
- [Convert a Blob to an ArrayBuffer](https://bun.sh/guides/binary/blob-to-arraybuffer)
|
||||
- [Convert a Buffer to a blob](https://bun.sh/guides/binary/buffer-to-blob)
|
||||
- [Convert a Buffer to a ReadableStream](https://bun.sh/guides/binary/buffer-to-readablestream)
|
||||
- [Convert a Blob to a DataView](https://bun.sh/guides/binary/blob-to-dataview)
|
||||
- [Convert a Buffer to a string](https://bun.sh/guides/binary/buffer-to-string)
|
||||
- [Convert a Buffer to a Uint8Array](https://bun.sh/guides/binary/buffer-to-typedarray)
|
||||
- [Convert a Buffer to an ArrayBuffer](https://bun.sh/guides/binary/buffer-to-arraybuffer)
|
||||
- [Convert a Blob to a ReadableStream](https://bun.sh/guides/binary/blob-to-stream)
|
||||
- [Convert a Blob to a Uint8Array](https://bun.sh/guides/binary/blob-to-typedarray)
|
||||
- [Convert a DataView to a string](https://bun.sh/guides/binary/dataview-to-string)
|
||||
- [Convert a Uint8Array to a Blob](https://bun.sh/guides/binary/typedarray-to-blob)
|
||||
- [Convert a Uint8Array to a Buffer](https://bun.sh/guides/binary/typedarray-to-buffer)
|
||||
- [Convert a Uint8Array to a DataView](https://bun.sh/guides/binary/typedarray-to-dataview)
|
||||
- [Convert a Uint8Array to a ReadableStream](https://bun.sh/guides/binary/typedarray-to-readablestream)
|
||||
- [Convert a Uint8Array to a string](https://bun.sh/guides/binary/typedarray-to-string)
|
||||
- [Convert a Uint8Array to an ArrayBuffer](https://bun.sh/guides/binary/typedarray-to-arraybuffer)
|
||||
- [Convert a Blob to an ArrayBuffer](https://bun.sh/guides/binary/blob-to-arraybuffer)
|
||||
- [Convert an ArrayBuffer to a Blob](https://bun.sh/guides/binary/arraybuffer-to-blob)
|
||||
- [Convert a Buffer to a Uint8Array](https://bun.sh/guides/binary/buffer-to-typedarray)
|
||||
- [Convert a Uint8Array to a Buffer](https://bun.sh/guides/binary/typedarray-to-buffer)
|
||||
- [Convert a Uint8Array to a string](https://bun.sh/guides/binary/typedarray-to-string)
|
||||
- [Convert a Buffer to an ArrayBuffer](https://bun.sh/guides/binary/buffer-to-arraybuffer)
|
||||
- [Convert an ArrayBuffer to a Buffer](https://bun.sh/guides/binary/arraybuffer-to-buffer)
|
||||
- [Convert an ArrayBuffer to a string](https://bun.sh/guides/binary/arraybuffer-to-string)
|
||||
- [Convert a Uint8Array to a DataView](https://bun.sh/guides/binary/typedarray-to-dataview)
|
||||
- [Convert a Buffer to a ReadableStream](https://bun.sh/guides/binary/buffer-to-readablestream)
|
||||
- [Convert a Uint8Array to an ArrayBuffer](https://bun.sh/guides/binary/typedarray-to-arraybuffer)
|
||||
- [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)
|
||||
- [Convert a Uint8Array to a ReadableStream](https://bun.sh/guides/binary/typedarray-to-readablestream)
|
||||
|
||||
- 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)
|
||||
- [Use React and JSX](https://bun.sh/guides/ecosystem/react)
|
||||
- [Use EdgeDB with Bun](https://bun.sh/guides/ecosystem/edgedb)
|
||||
- [Use Prisma with Bun](https://bun.sh/guides/ecosystem/prisma)
|
||||
- [Add Sentry to a Bun app](https://bun.sh/guides/ecosystem/sentry)
|
||||
- [Create a Discord bot](https://bun.sh/guides/ecosystem/discordjs)
|
||||
- [Run Bun as a daemon with PM2](https://bun.sh/guides/ecosystem/pm2)
|
||||
- [Use Drizzle ORM with Bun](https://bun.sh/guides/ecosystem/drizzle)
|
||||
- [Build an app with Nuxt and Bun](https://bun.sh/guides/ecosystem/nuxt)
|
||||
- [Build an app with Qwik and Bun](https://bun.sh/guides/ecosystem/qwik)
|
||||
- [Build an app with Astro and Bun](https://bun.sh/guides/ecosystem/astro)
|
||||
- [Build an app with Remix and Bun](https://bun.sh/guides/ecosystem/remix)
|
||||
- [Build an app with SolidStart and Bun](https://bun.sh/guides/ecosystem/solidstart)
|
||||
- [Build an app with SvelteKit and Bun](https://bun.sh/guides/ecosystem/sveltekit)
|
||||
- [Build an HTTP server using Elysia and Bun](https://bun.sh/guides/ecosystem/elysia)
|
||||
- [Build an HTTP server using Express and Bun](https://bun.sh/guides/ecosystem/express)
|
||||
- [Build a frontend using Vite and Bun](https://bun.sh/guides/ecosystem/vite)
|
||||
- [Build an app with Next.js and Bun](https://bun.sh/guides/ecosystem/nextjs)
|
||||
- [Run Bun as a daemon with systemd](https://bun.sh/guides/ecosystem/systemd)
|
||||
- [Deploy a Bun application on Render](https://bun.sh/guides/ecosystem/render)
|
||||
- [Build an HTTP server using Hono and Bun](https://bun.sh/guides/ecosystem/hono)
|
||||
- [Build an app with SvelteKit and Bun](https://bun.sh/guides/ecosystem/sveltekit)
|
||||
- [Build an app with SolidStart and Bun](https://bun.sh/guides/ecosystem/solidstart)
|
||||
- [Build an HTTP server using Elysia and Bun](https://bun.sh/guides/ecosystem/elysia)
|
||||
- [Build an HTTP server using StricJS and Bun](https://bun.sh/guides/ecosystem/stric)
|
||||
- [Containerize a Bun application with Docker](https://bun.sh/guides/ecosystem/docker)
|
||||
- [Create a Discord bot](https://bun.sh/guides/ecosystem/discordjs)
|
||||
- [Deploy a Bun application on Render](https://bun.sh/guides/ecosystem/render)
|
||||
- [Read and write data to MongoDB using Mongoose and Bun](https://bun.sh/guides/ecosystem/mongoose)
|
||||
- [Run Bun as a daemon with PM2](https://bun.sh/guides/ecosystem/pm2)
|
||||
- [Run Bun as a daemon with systemd](https://bun.sh/guides/ecosystem/systemd)
|
||||
- [Build an HTTP server using Express and Bun](https://bun.sh/guides/ecosystem/express)
|
||||
- [Use Neon Postgres through Drizzle ORM](https://bun.sh/guides/ecosystem/neon-drizzle)
|
||||
- [Server-side render (SSR) a React component](https://bun.sh/guides/ecosystem/ssr-react)
|
||||
- [Use Drizzle ORM with Bun](https://bun.sh/guides/ecosystem/drizzle)
|
||||
- [Use EdgeDB with Bun](https://bun.sh/guides/ecosystem/edgedb)
|
||||
- [Read and write data to MongoDB using Mongoose and Bun](https://bun.sh/guides/ecosystem/mongoose)
|
||||
- [Use Neon's Serverless Postgres with Bun](https://bun.sh/guides/ecosystem/neon-serverless-postgres)
|
||||
- [Use Prisma with Bun](https://bun.sh/guides/ecosystem/prisma)
|
||||
- [Use React and JSX](https://bun.sh/guides/ecosystem/react)
|
||||
- [Add Sentry to a Bun app](https://bun.sh/guides/ecosystem/sentry)
|
||||
|
||||
- HTMLRewriter
|
||||
|
||||
- [Extract links from a webpage using HTMLRewriter](https://bun.sh/guides/html-rewriter/extract-links)
|
||||
- [Extract social share images and Open Graph tags](https://bun.sh/guides/html-rewriter/extract-social-meta)
|
||||
|
||||
- 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)
|
||||
- [Hot reload an HTTP server](https://bun.sh/guides/http/hot)
|
||||
- [Proxy HTTP requests using fetch()](https://bun.sh/guides/http/proxy)
|
||||
- [Common HTTP server usage](https://bun.sh/guides/http/server)
|
||||
- [Write a simple HTTP server](https://bun.sh/guides/http/simple)
|
||||
- [Configure TLS on an HTTP server](https://bun.sh/guides/http/tls)
|
||||
- [Send an HTTP request using fetch](https://bun.sh/guides/http/fetch)
|
||||
- [Proxy HTTP requests using fetch()](https://bun.sh/guides/http/proxy)
|
||||
- [Start a cluster of HTTP servers](https://bun.sh/guides/http/cluster)
|
||||
- [Stream a file as an HTTP Response](https://bun.sh/guides/http/stream-file)
|
||||
- [fetch with unix domain sockets in Bun](https://bun.sh/guides/http/fetch-unix)
|
||||
- [Upload files via HTTP using FormData](https://bun.sh/guides/http/file-uploads)
|
||||
- [Streaming HTTP Server with Async Iterators](https://bun.sh/guides/http/stream-iterator)
|
||||
- [Streaming HTTP Server with Node.js Streams](https://bun.sh/guides/http/stream-node-streams-in-bun)
|
||||
- [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
|
||||
|
||||
- [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)
|
||||
- [Add a peer dependency](https://bun.sh/guides/install/add-peer)
|
||||
- [Add a tarball dependency](https://bun.sh/guides/install/add-tarball)
|
||||
- [Add a trusted dependency](https://bun.sh/guides/install/trusted)
|
||||
- [Add a development dependency](https://bun.sh/guides/install/add-dev)
|
||||
- [Add a tarball dependency](https://bun.sh/guides/install/add-tarball)
|
||||
- [Add an optional dependency](https://bun.sh/guides/install/add-optional)
|
||||
- [Configure a private registry for an organization scope with bun install](https://bun.sh/guides/install/registry-scope)
|
||||
- [Configure git to diff Bun's lockb lockfile](https://bun.sh/guides/install/git-diff-bun-lockfile)
|
||||
- [Generate a yarn-compatible lockfile](https://bun.sh/guides/install/yarnlock)
|
||||
- [Configuring a monorepo using workspaces](https://bun.sh/guides/install/workspaces)
|
||||
- [Generate a human-readable lockfile](https://bun.sh/guides/install/yarnlock)
|
||||
- [Install a package under a different name](https://bun.sh/guides/install/npm-alias)
|
||||
- [Install dependencies with Bun in GitHub Actions](https://bun.sh/guides/install/cicd)
|
||||
- [Using bun install with Artifactory](https://bun.sh/guides/install/jfrog-artifactory)
|
||||
- [Configure git to diff Bun's lockb lockfile](https://bun.sh/guides/install/git-diff-bun-lockfile)
|
||||
- [Override the default npm registry for bun install](https://bun.sh/guides/install/custom-registry)
|
||||
- [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)
|
||||
- [Migrate from npm install to bun install](https://bun.sh/guides/install/from-npm-install-to-bun-install)
|
||||
- [Configure a private registry for an organization scope with bun install](https://bun.sh/guides/install/registry-scope)
|
||||
|
||||
- Process
|
||||
|
||||
- [Get the process uptime in nanoseconds](https://bun.sh/guides/process/nanoseconds)
|
||||
- [Read from stdin](https://bun.sh/guides/process/stdin)
|
||||
- [Listen for CTRL+C](https://bun.sh/guides/process/ctrl-c)
|
||||
- [Spawn a child process](https://bun.sh/guides/process/spawn)
|
||||
- [Listen to OS signals](https://bun.sh/guides/process/os-signals)
|
||||
- [Parse command-line arguments](https://bun.sh/guides/process/argv)
|
||||
- [Read from stdin](https://bun.sh/guides/process/stdin)
|
||||
- [Read stderr from a child process](https://bun.sh/guides/process/spawn-stderr)
|
||||
- [Read stdout from a child process](https://bun.sh/guides/process/spawn-stdout)
|
||||
- [Spawn a child process](https://bun.sh/guides/process/spawn)
|
||||
- [Get the process uptime in nanoseconds](https://bun.sh/guides/process/nanoseconds)
|
||||
- [Spawn a child process and communicate using IPC](https://bun.sh/guides/process/ipc)
|
||||
|
||||
- Read file
|
||||
|
||||
- [Read a JSON file](https://bun.sh/guides/read-file/json)
|
||||
- [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)
|
||||
- [Read a file as a string](https://bun.sh/guides/read-file/string)
|
||||
- [Read a file to a Buffer](https://bun.sh/guides/read-file/buffer)
|
||||
- [Get the MIME type of a file](https://bun.sh/guides/read-file/mime)
|
||||
- [Watch a directory for changes](https://bun.sh/guides/read-file/watch)
|
||||
- [Read a file as a ReadableStream](https://bun.sh/guides/read-file/stream)
|
||||
- [Read a file to a Uint8Array](https://bun.sh/guides/read-file/uint8array)
|
||||
- [Read a file to an ArrayBuffer](https://bun.sh/guides/read-file/arraybuffer)
|
||||
- [Read a JSON file](https://bun.sh/guides/read-file/json)
|
||||
- [Watch a directory for changes](https://bun.sh/guides/read-file/watch)
|
||||
|
||||
- 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)
|
||||
- [Delete files](https://bun.sh/guides/runtime/delete-file)
|
||||
- [Run a Shell Command](https://bun.sh/guides/runtime/shell)
|
||||
- [Import a JSON file](https://bun.sh/guides/runtime/import-json)
|
||||
- [Import a TOML file](https://bun.sh/guides/runtime/import-toml)
|
||||
- [Import HTML file as text](https://bun.sh/guides/runtime/import-html)
|
||||
- [Install and run Bun in GitHub Actions](https://bun.sh/guides/runtime/cicd)
|
||||
- [Install TypeScript declarations for Bun](https://bun.sh/guides/runtime/typescript)
|
||||
- [Re-map import paths](https://bun.sh/guides/runtime/tsconfig-paths)
|
||||
- [Read environment variables](https://bun.sh/guides/runtime/read-env)
|
||||
- [Run a Shell Command](https://bun.sh/guides/runtime/shell)
|
||||
- [Set a time zone in Bun](https://bun.sh/guides/runtime/timezone)
|
||||
- [Set environment variables](https://bun.sh/guides/runtime/set-env)
|
||||
- [Re-map import paths](https://bun.sh/guides/runtime/tsconfig-paths)
|
||||
- [Delete directories](https://bun.sh/guides/runtime/delete-directory)
|
||||
- [Read environment variables](https://bun.sh/guides/runtime/read-env)
|
||||
- [Import a HTML file as text](https://bun.sh/guides/runtime/import-html)
|
||||
- [Install and run Bun in GitHub Actions](https://bun.sh/guides/runtime/cicd)
|
||||
- [Debugging Bun with the web debugger](https://bun.sh/guides/runtime/web-debugger)
|
||||
- [Install TypeScript declarations for Bun](https://bun.sh/guides/runtime/typescript)
|
||||
- [Debugging Bun with the VS Code extension](https://bun.sh/guides/runtime/vscode-debugger)
|
||||
- [Inspect memory usage using V8 heap snapshots](https://bun.sh/guides/runtime/heap-snapshot)
|
||||
- [Define and replace static globals & constants](https://bun.sh/guides/runtime/define-constant)
|
||||
- [Codesign a single-file JavaScript executable on macOS](https://bun.sh/guides/runtime/codesign-macos-executable)
|
||||
|
||||
- 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)
|
||||
- [Convert a Node.js Readable to JSON](https://bun.sh/guides/streams/node-readable-to-json)
|
||||
- [Convert a ReadableStream to JSON](https://bun.sh/guides/streams/to-json)
|
||||
- [Convert a ReadableStream to a Blob](https://bun.sh/guides/streams/to-blob)
|
||||
- [Convert a ReadableStream to a Buffer](https://bun.sh/guides/streams/to-buffer)
|
||||
- [Convert a ReadableStream to a string](https://bun.sh/guides/streams/to-string)
|
||||
- [Convert a ReadableStream to a Uint8Array](https://bun.sh/guides/streams/to-typedarray)
|
||||
- [Convert a ReadableStream to an array of chunks](https://bun.sh/guides/streams/to-array)
|
||||
- [Convert a Node.js Readable to JSON](https://bun.sh/guides/streams/node-readable-to-json)
|
||||
- [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)
|
||||
- [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 Uint8Array](https://bun.sh/guides/streams/node-readable-to-uint8array)
|
||||
- [Convert a Node.js Readable to an ArrayBuffer](https://bun.sh/guides/streams/node-readable-to-arraybuffer)
|
||||
|
||||
- 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)
|
||||
- [Migrate from Jest to Bun's test runner](https://bun.sh/guides/test/migrate-from-jest)
|
||||
- [Mock functions in `bun test`](https://bun.sh/guides/test/mock-functions)
|
||||
- [Re-run tests multiple times with the Bun test runner](https://bun.sh/guides/test/rerun-each)
|
||||
- [Run tests in watch mode with Bun](https://bun.sh/guides/test/watch-mode)
|
||||
- [Run your tests with the Bun test runner](https://bun.sh/guides/test/run-tests)
|
||||
- [Set a code coverage threshold with the Bun test runner](https://bun.sh/guides/test/coverage-threshold)
|
||||
- [Set a per-test timeout with the Bun test runner](https://bun.sh/guides/test/timeout)
|
||||
- [Set the system time in Bun's test runner](https://bun.sh/guides/test/mock-clock)
|
||||
- [Skip tests with the Bun test runner](https://bun.sh/guides/test/skip-tests)
|
||||
- [Spy on methods in `bun test`](https://bun.sh/guides/test/spy-on)
|
||||
- [Update snapshots in `bun test`](https://bun.sh/guides/test/update-snapshots)
|
||||
- [Bail early with the Bun test runner](https://bun.sh/guides/test/bail)
|
||||
- [Mock functions in `bun test`](https://bun.sh/guides/test/mock-functions)
|
||||
- [Run tests in watch mode with Bun](https://bun.sh/guides/test/watch-mode)
|
||||
- [Use snapshot testing in `bun test`](https://bun.sh/guides/test/snapshot)
|
||||
- [Skip tests with the Bun test runner](https://bun.sh/guides/test/skip-tests)
|
||||
- [Using Testing Library with Bun](https://bun.sh/guides/test/testing-library)
|
||||
- [Update snapshots in `bun test`](https://bun.sh/guides/test/update-snapshots)
|
||||
- [Run your tests with the Bun test runner](https://bun.sh/guides/test/run-tests)
|
||||
- [Set the system time in Bun's test runner](https://bun.sh/guides/test/mock-clock)
|
||||
- [Set a per-test timeout with the Bun test runner](https://bun.sh/guides/test/timeout)
|
||||
- [Migrate from Jest to Bun's test runner](https://bun.sh/guides/test/migrate-from-jest)
|
||||
- [Write browser DOM tests with Bun and happy-dom](https://bun.sh/guides/test/happy-dom)
|
||||
- [Mark a test as a "todo" with the Bun test runner](https://bun.sh/guides/test/todo-tests)
|
||||
- [Re-run tests multiple times with the Bun test runner](https://bun.sh/guides/test/rerun-each)
|
||||
- [Generate code coverage reports with the Bun test runner](https://bun.sh/guides/test/coverage)
|
||||
- [import, require, and test Svelte components with bun test](https://bun.sh/guides/test/svelte-test)
|
||||
- [Set a code coverage threshold with the Bun test runner](https://bun.sh/guides/test/coverage-threshold)
|
||||
|
||||
- Util
|
||||
|
||||
- [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint)
|
||||
- [Generate a UUID](https://bun.sh/guides/util/javascript-uuid)
|
||||
- [Hash a password](https://bun.sh/guides/util/hash-a-password)
|
||||
- [Escape an HTML string](https://bun.sh/guides/util/escape-html)
|
||||
- [Get the current Bun version](https://bun.sh/guides/util/version)
|
||||
- [Encode and decode base64 strings](https://bun.sh/guides/util/base64)
|
||||
- [Compress and decompress data with gzip](https://bun.sh/guides/util/gzip)
|
||||
- [Sleep for a fixed number of milliseconds](https://bun.sh/guides/util/sleep)
|
||||
- [Detect when code is executed with Bun](https://bun.sh/guides/util/detect-bun)
|
||||
- [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)
|
||||
- [Compress and decompress data with gzip](https://bun.sh/guides/util/gzip)
|
||||
- [Get the absolute path to the current entrypoint](https://bun.sh/guides/util/main)
|
||||
- [Get the directory of the current file](https://bun.sh/guides/util/import-meta-dir)
|
||||
- [Check if the current file is the entrypoint](https://bun.sh/guides/util/entrypoint)
|
||||
- [Get the file name of the current file](https://bun.sh/guides/util/import-meta-file)
|
||||
- [Convert a file URL to an absolute path](https://bun.sh/guides/util/file-url-to-path)
|
||||
- [Convert an absolute path to a file URL](https://bun.sh/guides/util/path-to-file-url)
|
||||
- [Detect when code is executed with Bun](https://bun.sh/guides/util/detect-bun)
|
||||
- [Encode and decode base64 strings](https://bun.sh/guides/util/base64)
|
||||
- [Escape an HTML string](https://bun.sh/guides/util/escape-html)
|
||||
- [Get the absolute path of the current file](https://bun.sh/guides/util/import-meta-path)
|
||||
- [Get the absolute path to the current entrypoint](https://bun.sh/guides/util/main)
|
||||
- [Get the current Bun version](https://bun.sh/guides/util/version)
|
||||
- [Get the directory of the current file](https://bun.sh/guides/util/import-meta-dir)
|
||||
- [Get the file name of the current file](https://bun.sh/guides/util/import-meta-file)
|
||||
- [Get the path to an executable bin file](https://bun.sh/guides/util/which-path-to-executable-bin)
|
||||
- [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
|
||||
|
||||
@@ -379,16 +414,17 @@ bun upgrade --canary
|
||||
- [Set per-socket contextual data on a WebSocket](https://bun.sh/guides/websocket/context)
|
||||
|
||||
- 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)
|
||||
- [Write a Blob to a file](https://bun.sh/guides/write-file/blob)
|
||||
- [Write a file incrementally](https://bun.sh/guides/write-file/filesink)
|
||||
- [Write a file to stdout](https://bun.sh/guides/write-file/cat)
|
||||
- [Write a ReadableStream to a file](https://bun.sh/guides/write-file/stream)
|
||||
- [Write a Response to a file](https://bun.sh/guides/write-file/response)
|
||||
- [Write a string to a file](https://bun.sh/guides/write-file/basic)
|
||||
- [Write to stdout](https://bun.sh/guides/write-file/stdout)
|
||||
- [Write a file to stdout](https://bun.sh/guides/write-file/cat)
|
||||
- [Write a Blob to a file](https://bun.sh/guides/write-file/blob)
|
||||
- [Write a string to a file](https://bun.sh/guides/write-file/basic)
|
||||
- [Append content to a file](https://bun.sh/guides/write-file/append)
|
||||
- [Write a file incrementally](https://bun.sh/guides/write-file/filesink)
|
||||
- [Write a Response to a file](https://bun.sh/guides/write-file/response)
|
||||
- [Copy a file to another location](https://bun.sh/guides/write-file/file-cp)
|
||||
- [Write a ReadableStream to a file](https://bun.sh/guides/write-file/stream)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Enable latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
bun
|
||||
next
|
||||
src/*.mov
|
||||
src/*.blob
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
SLEEP_INTERVAL ?= 32
|
||||
SCREEN_WIDTH ?= $(shell system_profiler -json SPDisplaysDataType 2>/dev/null | jq -r '.. | objects | select(.spdisplays_main) | ._spdisplays_pixels | split(" ")[0]')
|
||||
SCREEN_HEIGHT ?= $(shell system_profiler -json SPDisplaysDataType 2>/dev/null | jq -r '.. | objects | select(.spdisplays_main) | ._spdisplays_pixels | split(" ")[2]')
|
||||
PROJECT ?= bun
|
||||
PACKAGE_NAME ?= bun-cli
|
||||
RUN_COUNT ?= 128
|
||||
ENDPOINT ?= /
|
||||
|
||||
ifeq ($(PROJECT),bun)
|
||||
PACKAGE_NAME := bun-cli
|
||||
endif
|
||||
|
||||
ifeq ($(PROJECT),next)
|
||||
PACKAGE_NAME := next
|
||||
endif
|
||||
|
||||
generate:
|
||||
@killall -9 bun next node || echo ""
|
||||
PROJECT=$(PROJECT) SCREEN_WIDTH=$(SCREEN_WIDTH) SCREEN_HEIGHT=$(SCREEN_HEIGHT) ENDPOINT=$(ENDPOINT) node browser.js
|
||||
|
||||
generate-css-in-js:
|
||||
@killall -9 bun next node || echo ""
|
||||
PROJECT=$(PROJECT) SCREEN_WIDTH=$(SCREEN_WIDTH) SCREEN_HEIGHT=$(SCREEN_HEIGHT) ENDPOINT=/css-in-js node browser.js
|
||||
loop:
|
||||
cp src/colors.css.0 src/colors.css
|
||||
sleep 3
|
||||
osascript -e 'tell application "System Events" to tell process "Chromium"' \
|
||||
-e 'set frontmost to true' \
|
||||
-e 'if windows is not {} then perform action "AXRaise" of item 1 of windows' \
|
||||
-e 'end tell'
|
||||
sleep 0.5
|
||||
cd src; zig run -Doptimize=ReleaseFast ../color-looper.zig -- ./colors.css:0 $(SLEEP_INTERVAL)
|
||||
cp src/colors.css.blob $(PROJECT)/colors.css.blob
|
||||
|
||||
loop-emotion:
|
||||
cp src/css-in-js-styles.0 src/css-in-js-styles.tsx
|
||||
sleep 3
|
||||
osascript -e 'tell application "System Events" to tell process "Chromium"' \
|
||||
-e 'set frontmost to true' \
|
||||
-e 'if windows is not {} then perform action "AXRaise" of item 1 of windows' \
|
||||
-e 'end tell'
|
||||
sleep 0.5
|
||||
cd src; zig run -Doptimize=ReleaseFast ../color-looper.emotion.zig -- ./css-in-js-styles.tsx:0 $(SLEEP_INTERVAL)
|
||||
cp src/css-in-js-styles.tsx.blob $(PROJECT)/css-in-js-styles.blob
|
||||
|
||||
process_video:
|
||||
rm -rf $(FRAMES_DIR); mkdir -p $(FRAMES_DIR); ffmpeg -i src/colors.css.mov -vf fps=120,format=gray $(FRAMES_DIR)/%d.tif
|
||||
|
||||
FRAMES_DIR ?= $(shell mkdir -p ./$(PROJECT)/frames; realpath ./$(PROJECT)/frames)
|
||||
|
||||
TIF_FILES := $(wildcard $(FRAMES_DIR)/*.tif)
|
||||
TXT_FILES := $(wildcard $(FRAMES_DIR)/*.txt)
|
||||
|
||||
OBJ_FILES := $(patsubst $(SRC_DIR)/%.tif,$(OBJ_DIR)/%.txt,$(TIF_FILES))
|
||||
TRIM_FILES := $(patsubst $(SRC_DIR)/%.txt,$(OBJ_DIR)/%.trim,$(TXT_FILES))
|
||||
|
||||
frames: $(OBJ_FILES)
|
||||
|
||||
|
||||
$(FRAMES_DIR)/%.txt: $(FRAMES_DIR)/%.tif
|
||||
tesseract -l eng $< $@
|
||||
|
||||
trim: $(TRIM_FILES) cleanup print
|
||||
|
||||
|
||||
|
||||
$(FRAMES_DIR)/%.trim: $(FRAMES_DIR)/%.txt
|
||||
(grep "Ran:" $< || echo "\n") >> $(PROJECT)/frames.all
|
||||
|
||||
cleanup:
|
||||
sed 's/^Ran: *//' $(PROJECT)/frames.all | tr -d ' ' | sort | uniq > $(PROJECT)/frames.all.clean
|
||||
|
||||
print:
|
||||
PACKAGE_NAME=$(PACKAGE_NAME) SLEEP_INTERVAL=$(SLEEP_INTERVAL) PROJECT=$(PROJECT) OUTFILE=timings/$(PACKAGE_NAME) node read-frames.js
|
||||
|
||||
print-emotion:
|
||||
PACKAGE_NAME=$(PACKAGE_NAME) SLEEP_INTERVAL=$(SLEEP_INTERVAL) PROJECT=$(PROJECT) OUTFILE=timings/emotion_$(PACKAGE_NAME) node read-frames.js
|
||||
@@ -1,62 +0,0 @@
|
||||
# CSS Stress Test
|
||||
|
||||
This benchmarks bundler performance for CSS hot reloading.
|
||||
|
||||
## Results
|
||||
|
||||
bun is 14x faster than Next.js at hot reloading CSS.
|
||||
|
||||
```
|
||||
bun v0.0.34
|
||||
Saving every 16ms
|
||||
|
||||
Frame time:
|
||||
50th percentile: 22.2ms
|
||||
75th percentile: 23.9ms
|
||||
90th percentile: 25.3ms
|
||||
95th percentile: 43.6ms
|
||||
99th percentile: 49.1ms
|
||||
Rendered frames: 922 / 1024 (90%)
|
||||
```
|
||||
|
||||
```
|
||||
Next.js v11.1.2
|
||||
Saving every 16ms
|
||||
|
||||
Frame time:
|
||||
50th percentile: 312ms
|
||||
75th percentile: 337.6ms
|
||||
90th percentile: 387.7ms
|
||||
95th percentile: 446.9ms
|
||||
99th percentile: 591.7ms
|
||||
Rendered frames: 64 / 1024 (6%)
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
It times pixels instead of builds. `color-looper.zig` writes color updates and the timestamp to a css file, while simultaneously screen recording a non-headless Chromium instance. After it finishes, it OCRs the video frames and verifies the scanned timestamps against the actual data. This data measures (1) how long each update took from saving to disk up to the pixels visible on the screen and (2) what % of frames were rendered.
|
||||
|
||||
The intent is to be as accurate as possible. Measuring times reported client-side is simpler, but lower accuracy since those times may not correspond to pixels on the screen and do not start from when the data was written to disk (at best, they measure when the filesystem watcher detected the update, but often not that either). `color-looper.zig` must run separately from `browser.js` or the results will be inaccurate.
|
||||
|
||||
It works like this:
|
||||
|
||||
1. `browser.js` loads either bun or Next.js and a Chromium instance opened to the correct webpage
|
||||
2. `color-looper.zig` updates [`./src/colors.css`](./src/colors.css) in a loop up to `1024` times (1024 is arbitrary), sleeping every `16`ms or `32`ms (a CLI arg you can pass it). The `var(--timestamp)` CSS variable contains the UTC timestamp with precision of milliseconds and one extra decimal point
|
||||
3. `color-looper.zig` automatically records the screen via `screencapture` (builtin on macOS) and saves it, along with a `BigUint64Array` containing all the expected timestamps. When it's done, it writes to a designated file on disk which `browser.js` picks up as the signal to close the browser.
|
||||
4. `ffmpeg` converts each frame into a black and white `.tif` file, which `tesseract` then OCRs
|
||||
5. Various cleanup scripts extract the timestamp from each of those OCR'd frames into a single file
|
||||
6. Using the OCR'd data, `./read-frames.js` calculates the 50th, 75th, 90th, 95th, and 99th percentile frame time, along with how many frames were skipped. Frame time is the metric here that matters here because that's how much time elapsed between each update. It includes the artificial sleep interval, so it will not be faster than the sleep interval.
|
||||
|
||||
The script `run.sh` runs all the commands necessary to do this work unattended. It takes awhile though. The slow part is OCR'ing all the frames.
|
||||
|
||||
To run this, you need:
|
||||
|
||||
- `zig`
|
||||
- `bun-cli`
|
||||
- `node`
|
||||
- `tesseract`
|
||||
- `screencapture` (macOS builtin)
|
||||
- `ffmpeg`
|
||||
- `puppeteer` (from the package.json)
|
||||
|
||||
You will need to run `bun bun --use next` first, with `next@11.1.2`. It will only run on macOS due to the dependencies on `screencapture`, how it detects screen resolution (so that Chromium is maximized), and how it auto-focuses Chromium (apple script)
|
||||
@@ -1,114 +0,0 @@
|
||||
const puppeteer = require("puppeteer");
|
||||
const http = require("http");
|
||||
const path = require("path");
|
||||
const url = require("url");
|
||||
const fs = require("fs");
|
||||
const child_process = require("child_process");
|
||||
const serverURL = process.env.TEST_SERVER_URL || "http://localhost:8080";
|
||||
|
||||
if (process.env.PROJECT === "bun") {
|
||||
const bunFlags = [`--origin=${serverURL}`].filter(Boolean);
|
||||
const bunExec = process.env.BUN_BIN || "bun";
|
||||
const bunProcess = child_process.spawn(bunExec, bunFlags, {
|
||||
cwd: process.cwd(),
|
||||
stdio: "ignore",
|
||||
env: {
|
||||
...process.env,
|
||||
DISABLE_BUN_ANALYTICS: "1",
|
||||
},
|
||||
|
||||
shell: false,
|
||||
});
|
||||
console.log("$", bunExec, bunFlags.join(" "));
|
||||
const isDebug = bunExec.endsWith("-debug");
|
||||
|
||||
// bunProcess.stderr.pipe(process.stderr);
|
||||
// bunProcess.stdout.pipe(process.stdout);
|
||||
bunProcess.once("error", err => {
|
||||
console.error("❌ bun error", err);
|
||||
process.exit(1);
|
||||
});
|
||||
process.on("beforeExit", () => {
|
||||
bunProcess?.kill(0);
|
||||
});
|
||||
} else if (process.env.PROJECT === "next") {
|
||||
const bunProcess = child_process.spawn("./node_modules/.bin/next", ["--port", "8080"], {
|
||||
cwd: process.cwd(),
|
||||
stdio: "ignore",
|
||||
env: {
|
||||
...process.env,
|
||||
},
|
||||
|
||||
shell: false,
|
||||
});
|
||||
}
|
||||
|
||||
const delay = new Promise((resolve, reject) => {
|
||||
const watcher = fs.watch(path.resolve(process.cwd(), "src/colors.css.blob"));
|
||||
watcher.once("change", () => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
||||
async function main() {
|
||||
const browser = await puppeteer.launch({
|
||||
headless: false,
|
||||
waitForInitialPage: true,
|
||||
args: [
|
||||
`--window-size=${parseInt(process.env.SCREEN_WIDTH || "1024", 10) / 2},${
|
||||
parseInt(process.env.SCREEN_HEIGHT || "1024", 10) / 2
|
||||
}`,
|
||||
],
|
||||
defaultViewport: {
|
||||
width: parseInt(process.env.SCREEN_WIDTH || "1024", 10) / 2,
|
||||
height: parseInt(process.env.SCREEN_HEIGHT || "1024", 10) / 2,
|
||||
},
|
||||
});
|
||||
const promises = [];
|
||||
let allTestsPassed = true;
|
||||
|
||||
async function runPage(key) {
|
||||
var page;
|
||||
|
||||
try {
|
||||
console.log("Opening page");
|
||||
page = await browser.newPage();
|
||||
|
||||
console.log(`Navigating to "http://localhost:8080/"`);
|
||||
|
||||
while (true) {
|
||||
try {
|
||||
await page.goto("http://localhost:8080/", { waitUntil: "load" });
|
||||
break;
|
||||
} catch (exception) {
|
||||
if (!exception.toString().includes("ERR_CONNECTION_REFUSED")) break;
|
||||
}
|
||||
}
|
||||
|
||||
await page.bringToFront();
|
||||
|
||||
await delay;
|
||||
|
||||
// runner.stdout.pipe(process.stdout);
|
||||
// runner.stderr.pipe(process.stderr);
|
||||
var didResolve = false;
|
||||
|
||||
console.log(`Completed. Done.`);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
await page.close();
|
||||
await browser.close();
|
||||
}
|
||||
}
|
||||
|
||||
return runPage();
|
||||
}
|
||||
|
||||
main().catch(error =>
|
||||
setTimeout(() => {
|
||||
throw error;
|
||||
}),
|
||||
);
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=16 PROJECT=bun node read-frames.js
|
||||
bun
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 22.2ms
|
||||
75th percentile: 23.9ms
|
||||
90th percentile: 25.3ms
|
||||
95th percentile: 43.6ms
|
||||
99th percentile: 49.1ms
|
||||
Rendered frames: 922 / 1024 (90%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=24 PROJECT=bun node read-frames.js
|
||||
bun
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 33.4ms
|
||||
75th percentile: 34.5ms
|
||||
90th percentile: 35.8ms
|
||||
95th percentile: 65.5ms
|
||||
99th percentile: 87.9ms
|
||||
Rendered frames: 937 / 1024 (92%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=32 PROJECT=bun node read-frames.js
|
||||
bun
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 40.7ms
|
||||
75th percentile: 42.3ms
|
||||
90th percentile: 43.5ms
|
||||
95th percentile: 76.4ms
|
||||
99th percentile: 118.8ms
|
||||
Rendered frames: 958 / 1024 (94%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=8 PROJECT=bun node read-frames.js
|
||||
bun
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 20ms
|
||||
75th percentile: 24.4ms
|
||||
90th percentile: 41ms
|
||||
95th percentile: 53.9ms
|
||||
99th percentile: 90.4ms
|
||||
Rendered frames: 475 / 1024 (46%)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,218 +0,0 @@
|
||||
const std = @import("std");
|
||||
|
||||
pub const Counter = extern struct {
|
||||
timestamp: usize,
|
||||
percent: f64,
|
||||
rotate: u32,
|
||||
color_values: [8 * 3]u32,
|
||||
};
|
||||
|
||||
const RUN_COUNT = 1024;
|
||||
|
||||
var counters: [RUN_COUNT]Counter = undefined;
|
||||
|
||||
pub const Blob = extern struct {
|
||||
run_count: u32,
|
||||
interval: u64,
|
||||
};
|
||||
|
||||
pub var all_timestamps: [RUN_COUNT + 1]usize = undefined;
|
||||
|
||||
// usage:
|
||||
// ./file-path:0 10
|
||||
// 1 2 3
|
||||
|
||||
// 1. file path
|
||||
// 2. Byte offset in file
|
||||
// 3. ms update interval
|
||||
var color_buf: [8192 + SIMULATE_LONG_FILE.len]u8 = undefined;
|
||||
|
||||
pub fn main() anyerror!void {
|
||||
var allocator = std.heap.c_allocator;
|
||||
var timer = try std.time.Timer.start();
|
||||
|
||||
var args = std.mem.span(try std.process.argsAlloc(allocator));
|
||||
|
||||
var basepath_with_colon: []u8 = args[args.len - 2];
|
||||
var basepath: []u8 = "";
|
||||
var position_str: []u8 = "";
|
||||
if (std.mem.lastIndexOfScalar(u8, basepath_with_colon, ':')) |colon| {
|
||||
basepath = basepath_with_colon[0..colon];
|
||||
position_str = basepath_with_colon[colon + 1 ..];
|
||||
}
|
||||
var position = try std.fmt.parseInt(u32, position_str, 10);
|
||||
const filepath = try std.fs.path.resolve(allocator, &.{basepath});
|
||||
var file = try std.fs.openFileAbsolute(filepath, .{ .write = true });
|
||||
var ms = @as(u64, @truncate((try std.fmt.parseInt(u128, args[args.len - 1], 10)) * std.time.ns_per_ms));
|
||||
std.debug.assert(ms > 0);
|
||||
// std.debug.assert(std.math.isFinite(position));
|
||||
var prng = std.rand.DefaultPrng.init(0);
|
||||
var stdout = std.io.getStdOut();
|
||||
var log = stdout.writer();
|
||||
var colors = std.mem.zeroes([4][3]u32);
|
||||
var progress_bar: f64 = 0.0;
|
||||
var destination_count: f64 = 18.0;
|
||||
|
||||
// Randomize initial colors
|
||||
colors[0][0] = prng.random.int(u32);
|
||||
colors[0][1] = prng.random.int(u32);
|
||||
colors[0][2] = prng.random.int(u32);
|
||||
|
||||
colors[1][0] = prng.random.int(u32);
|
||||
colors[1][1] = prng.random.int(u32);
|
||||
colors[1][2] = prng.random.int(u32);
|
||||
|
||||
colors[2][0] = prng.random.int(u32);
|
||||
colors[2][1] = prng.random.int(u32);
|
||||
colors[2][2] = prng.random.int(u32);
|
||||
|
||||
colors[3][0] = prng.random.int(u32);
|
||||
colors[3][1] = prng.random.int(u32);
|
||||
colors[3][2] = prng.random.int(u32);
|
||||
var rotate: u32 = 0;
|
||||
var counter: usize = 0;
|
||||
const video = std.fmt.allocPrint(allocator, "{s}.mov", .{filepath}) catch unreachable;
|
||||
std.fs.deleteFileAbsolute(video) catch {};
|
||||
var screen_recorder_argv = [_][]const u8{ "screencapture", "-v", video };
|
||||
|
||||
var recorder = std.ChildProcess.init(&screen_recorder_argv, allocator);
|
||||
recorder.stdin_behavior = .Pipe;
|
||||
try recorder.spawn();
|
||||
std.time.sleep(std.time.ns_per_s);
|
||||
var wrote: []u8 = undefined;
|
||||
while (counter < RUN_COUNT) {
|
||||
colors[0][0] += 1;
|
||||
colors[0][1] += 1;
|
||||
colors[0][2] += 1;
|
||||
colors[1][0] += 1;
|
||||
colors[1][1] += 1;
|
||||
colors[1][2] += 1;
|
||||
colors[2][0] += 1;
|
||||
colors[2][1] += 1;
|
||||
colors[2][2] += 1;
|
||||
colors[3][0] += 1;
|
||||
colors[3][1] += 1;
|
||||
colors[3][2] += 1;
|
||||
rotate += 1;
|
||||
const fmtd: []const u8 = comptime brk: {
|
||||
break :brk (
|
||||
\\
|
||||
\\import {{ Global }} from "@emotion/react";
|
||||
\\export function CSSInJSStyles() {{
|
||||
\\ return (
|
||||
\\ <Global
|
||||
\\ styles={{`
|
||||
\\:root {{
|
||||
\\ --timestamp: "{d}";
|
||||
\\ --interval: "{s}";
|
||||
\\ --progress-bar: {d}%;
|
||||
\\ --spinner-1-muted: rgb({d}, {d}, {d});
|
||||
\\ --spinner-1-primary: rgb({d}, {d}, {d});
|
||||
\\ --spinner-2-muted: rgb({d}, {d}, {d});
|
||||
\\ --spinner-2-primary: rgb({d}, {d}, {d});
|
||||
\\ --spinner-3-muted: rgb({d}, {d}, {d});
|
||||
\\ --spinner-3-primary: rgb({d}, {d}, {d});
|
||||
\\ --spinner-4-muted: rgb({d}, {d}, {d});
|
||||
\\ --spinner-4-primary: rgb({d}, {d}, {d});
|
||||
\\ --spinner-rotate: {d}deg;
|
||||
\\}}
|
||||
++ SIMULATE_LONG_FILE ++
|
||||
\\ `}}
|
||||
\\ />
|
||||
\\ );
|
||||
\\}}
|
||||
\\
|
||||
);
|
||||
};
|
||||
|
||||
counters[counter].timestamp = @as(u64, @truncate(@as(u128, @intCast(std.time.nanoTimestamp())) / (std.time.ns_per_ms / 10)));
|
||||
counters[counter].rotate = rotate % 360;
|
||||
counters[counter].percent = std.math.mod(f64, std.math.round(((progress_bar + 1.0) / destination_count) * 1000) / 1000, 100) catch 0;
|
||||
counters[counter].color_values[0] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[0][0] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[1] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[0][1] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[2] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[0][2] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[3] = (colors[0][0] + 1) % 256;
|
||||
counters[counter].color_values[4] = (colors[0][1] + 1) % 256;
|
||||
counters[counter].color_values[5] = (colors[0][2] + 1) % 256;
|
||||
counters[counter].color_values[6] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[1][0] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[7] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[1][1] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[8] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[1][2] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[9] = (colors[1][0] + 1) % 256;
|
||||
counters[counter].color_values[10] = (colors[1][1] + 1) % 256;
|
||||
counters[counter].color_values[11] = (colors[1][2] + 1) % 256;
|
||||
counters[counter].color_values[12] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[2][0] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[13] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[2][1] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[14] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[2][2] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[15] = (colors[2][0] + 1) % 256;
|
||||
counters[counter].color_values[16] = (colors[2][1] + 1) % 256;
|
||||
counters[counter].color_values[17] = (colors[2][2] + 1) % 256;
|
||||
counters[counter].color_values[18] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[3][0] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[19] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[3][1] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[20] = @as(u32, @intFromFloat(std.math.round(@as(f64, @floatFromInt(((colors[3][2] + 1) % 256))) * 0.8)));
|
||||
counters[counter].color_values[21] = (colors[3][0] + 1) % 256;
|
||||
counters[counter].color_values[22] = (colors[3][1] + 1) % 256;
|
||||
counters[counter].color_values[23] = (colors[3][2] + 1) % 256;
|
||||
|
||||
file = try std.fs.createFileAbsolute(filepath, .{ .truncate = true });
|
||||
wrote = try std.fmt.bufPrint(&color_buf, fmtd, .{
|
||||
counters[counter].timestamp,
|
||||
args[args.len - 1],
|
||||
counters[counter].percent,
|
||||
counters[counter].color_values[0],
|
||||
counters[counter].color_values[1],
|
||||
counters[counter].color_values[2],
|
||||
counters[counter].color_values[3],
|
||||
counters[counter].color_values[4],
|
||||
counters[counter].color_values[5],
|
||||
counters[counter].color_values[6],
|
||||
counters[counter].color_values[7],
|
||||
counters[counter].color_values[8],
|
||||
counters[counter].color_values[9],
|
||||
counters[counter].color_values[10],
|
||||
counters[counter].color_values[11],
|
||||
counters[counter].color_values[12],
|
||||
counters[counter].color_values[13],
|
||||
counters[counter].color_values[14],
|
||||
counters[counter].color_values[15],
|
||||
counters[counter].color_values[16],
|
||||
counters[counter].color_values[17],
|
||||
counters[counter].color_values[18],
|
||||
counters[counter].color_values[19],
|
||||
counters[counter].color_values[20],
|
||||
counters[counter].color_values[21],
|
||||
counters[counter].color_values[22],
|
||||
counters[counter].color_values[23],
|
||||
counters[counter].rotate,
|
||||
});
|
||||
progress_bar += 1.0;
|
||||
_ = try file.writeAll(wrote);
|
||||
|
||||
try log.print("[{d}] \"{s}\":{d}\n", .{
|
||||
std.time.nanoTimestamp(),
|
||||
filepath,
|
||||
position,
|
||||
});
|
||||
counter += 1;
|
||||
// If we don't close the file, Parcel seems to never recognize it
|
||||
file.close();
|
||||
std.time.sleep(ms);
|
||||
}
|
||||
|
||||
try recorder.stdin.?.writeAll(&[_]u8{ 3, ';' });
|
||||
|
||||
_ = try recorder.wait();
|
||||
|
||||
all_timestamps[0] = wrote.len;
|
||||
for (counters, 0..) |count, i| {
|
||||
all_timestamps[i + 1] = count.timestamp;
|
||||
}
|
||||
|
||||
std.time.sleep(std.time.ns_per_s);
|
||||
var blob_file = try std.fs.createFileAbsolute(std.fmt.allocPrint(std.heap.c_allocator, "{s}.blob", .{filepath}) catch unreachable, .{ .truncate = true });
|
||||
try blob_file.writeAll(std.mem.asBytes(&all_timestamps));
|
||||
blob_file.close();
|
||||
}
|
||||
|
||||
const SIMULATE_LONG_FILE =
|
||||
\\
|
||||
;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
crossorigin="anonymous"
|
||||
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap"
|
||||
/>
|
||||
<link rel="stylesheet" href="src/index.css" />
|
||||
<script async src="src/index.tsx" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="reactroot"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,2 +0,0 @@
|
||||
import React from "react";
|
||||
export { React };
|
||||
@@ -1,6 +0,0 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/types/global" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
experimental: {
|
||||
swcLoader: true,
|
||||
},
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=16 PROJECT=next node read-frames.js
|
||||
next
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 312ms
|
||||
75th percentile: 337.6ms
|
||||
90th percentile: 387.7ms
|
||||
95th percentile: 446.9ms
|
||||
99th percentile: 591.7ms
|
||||
Rendered frames: 64 / 1024 (6%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=24 PROJECT=next node read-frames.js
|
||||
next
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 310.1ms
|
||||
75th percentile: 360.3ms
|
||||
90th percentile: 461.6ms
|
||||
95th percentile: 660.4ms
|
||||
99th percentile: 1009.9ms
|
||||
Rendered frames: 78 / 1024 (8%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=32 PROJECT=next node read-frames.js
|
||||
next
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 306.7ms
|
||||
75th percentile: 324.7ms
|
||||
90th percentile: 380ms
|
||||
95th percentile: 483.6ms
|
||||
99th percentile: 933.6ms
|
||||
Rendered frames: 116 / 1024 (11%)
|
||||
@@ -1,11 +0,0 @@
|
||||
SLEEP_INTERVAL=8 PROJECT=next node read-frames.js
|
||||
next
|
||||
--------------------------------------------------
|
||||
CSS HMR FRAME TIME
|
||||
|
||||
50th percentile: 320.4ms
|
||||
75th percentile: 368.8ms
|
||||
90th percentile: 527.2ms
|
||||
95th percentile: 532.4ms
|
||||
99th percentile: 532.4ms
|
||||
Rendered frames: 32 / 1024 (3%)
|
||||
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"name": "simple-react",
|
||||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@emotion/core": "latest",
|
||||
"@emotion/css": "latest",
|
||||
"@emotion/react": "latest",
|
||||
"@vitejs/plugin-react-refresh": "^1.3.3",
|
||||
"antd": "^4.16.1",
|
||||
"bun-framework-next": "latest",
|
||||
"left-pad": "^1.3.0",
|
||||
"next": "^12",
|
||||
"parcel": "2.0.0-beta.3",
|
||||
"path-browserify": "^1.0.1",
|
||||
"percentile": "^1.5.0",
|
||||
"puppeteer": "^10.4.0",
|
||||
"puppeteer-video-recorder": "^1.0.5",
|
||||
"react": "^17.0.2",
|
||||
"react-bootstrap": "^1.6.1",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-form": "^4.0.1",
|
||||
"react-hook-form": "^7.8.3",
|
||||
"url": "^0.11.0",
|
||||
"wipwipwipwip-next-donotuse": "4.0.0"
|
||||
},
|
||||
"parcel": "parceldist/index.js",
|
||||
"targets": {
|
||||
"parcel": {
|
||||
"outputFormat": "esmodule",
|
||||
"sourceMap": false,
|
||||
"optimize": false,
|
||||
"engines": {
|
||||
"chrome": "last 1 version"
|
||||
}
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/fetch-event-source": "^2.0.1",
|
||||
"@snowpack/plugin-react-refresh": "^2.5.0",
|
||||
"typescript": "^4.3.4"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
// @ts-nocheck
|
||||
import "../src/index.css";
|
||||
|
||||
import App from "next/app";
|
||||
|
||||
class MyApp extends App {
|
||||
render() {
|
||||
const { Component, pageProps } = this.props;
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
}
|
||||
|
||||
export default MyApp;
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Main } from "src/main";
|
||||
export function IndexPage() {
|
||||
return (
|
||||
<Main
|
||||
productName={
|
||||
// @ts-ignore
|
||||
typeof location !== "undefined" ? location.search.substring(1) : ""
|
||||
}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default IndexPage;
|
||||
@@ -1 +0,0 @@
|
||||
export { default as React } from "react";
|
||||
@@ -1,99 +0,0 @@
|
||||
const fs = require("fs");
|
||||
|
||||
const path = require("path");
|
||||
const PROJECT = process.env.PROJECT || "bun";
|
||||
const percentile = require("percentile");
|
||||
const PACKAGE_NAME = process.env.PACKAGE_NAME;
|
||||
const label = `${PACKAGE_NAME}@${require(PACKAGE_NAME + "/package.json").version}`;
|
||||
|
||||
const BASEFOLDER = path.resolve(PROJECT);
|
||||
const OUTFILE = path.join(process.cwd(), process.env.OUTFILE);
|
||||
|
||||
const buf = fs.readFileSync(BASEFOLDER + "/colors.css.blob");
|
||||
const VALID_TIMES = new BigUint64Array(buf.buffer).subarray(1);
|
||||
const cssFileSize = new BigUint64Array(buf.buffer)[0];
|
||||
|
||||
const TOTAL_FRAMES = VALID_TIMES.length;
|
||||
|
||||
const timings = fs
|
||||
.readFileSync(BASEFOLDER + "/frames.all.clean", "utf8")
|
||||
.split("\n")
|
||||
.map(a => a.replace(/[Ran:'\.]?/gm, "").trim())
|
||||
.filter(a => parseInt(a, 10))
|
||||
.filter(a => a.length > 0 && VALID_TIMES.includes(BigInt(parseInt(a, 10))))
|
||||
.map(num => BigInt(num));
|
||||
|
||||
timings.sort();
|
||||
|
||||
const frameTimesCount = timings.length;
|
||||
|
||||
var frameTime = new Array(Math.floor(frameTimesCount / 2));
|
||||
|
||||
for (let i = 0; i < frameTime.length; i++) {
|
||||
const i1 = i * 2;
|
||||
const i2 = i * 2 + 1;
|
||||
|
||||
frameTime[i] = Math.max(Number(timings[i2] - timings[i1]), 0);
|
||||
}
|
||||
|
||||
const report = {
|
||||
label,
|
||||
cssFileSize: Number(cssFileSize),
|
||||
at: new Date().toISOString(),
|
||||
sleep: process.env.SLEEP_INTERVAL,
|
||||
package: {
|
||||
name: PACKAGE_NAME,
|
||||
version: require(PACKAGE_NAME + "/package.json").version,
|
||||
},
|
||||
timestamps: timings.map(a => Number(a)),
|
||||
frameTimes: frameTime,
|
||||
percentileMs: {
|
||||
50: percentile(50, frameTime) / 10,
|
||||
75: percentile(75, frameTime) / 10,
|
||||
90: percentile(90, frameTime) / 10,
|
||||
95: percentile(95, frameTime) / 10,
|
||||
99: percentile(99, frameTime) / 10,
|
||||
},
|
||||
};
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(
|
||||
path.dirname(OUTFILE),
|
||||
path.basename(OUTFILE) +
|
||||
"@" +
|
||||
report.package.version +
|
||||
"." +
|
||||
process.env.SLEEP_INTERVAL +
|
||||
"ms." +
|
||||
`${process.platform}-${process.arch === "arm64" ? "aarch64" : process.arch}` +
|
||||
".json",
|
||||
),
|
||||
JSON.stringify(report, null, 2),
|
||||
);
|
||||
|
||||
console.log(
|
||||
label + "\n",
|
||||
"-".repeat(50) + "\n",
|
||||
"CSS HMR FRAME TIME\n" + "\n",
|
||||
|
||||
"50th percentile:",
|
||||
percentile(50, frameTime) / 10 + "ms",
|
||||
"\n",
|
||||
"75th percentile:",
|
||||
percentile(75, frameTime) / 10 + "ms",
|
||||
"\n",
|
||||
"90th percentile:",
|
||||
percentile(90, frameTime) / 10 + "ms",
|
||||
"\n",
|
||||
"95th percentile:",
|
||||
percentile(95, frameTime) / 10 + "ms",
|
||||
"\n",
|
||||
"99th percentile:",
|
||||
percentile(99, frameTime) / 10 + "ms",
|
||||
"\n",
|
||||
"Rendered frames:",
|
||||
timings.length,
|
||||
"/",
|
||||
TOTAL_FRAMES,
|
||||
"(" + Math.round(Math.max(Math.min(1.0, timings.length / TOTAL_FRAMES), 0) * 100) + "%)",
|
||||
);
|
||||
@@ -1,83 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
echo "Running next at 24ms"
|
||||
PROJECT=next SLEEP_INTERVAL=24 make generate &
|
||||
PROJECT=next SLEEP_INTERVAL=24 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=next SLEEP_INTERVAL=24 make process_video
|
||||
PROJECT=next SLEEP_INTERVAL=24 make frames -j$(nproc)
|
||||
PROJECT=next SLEEP_INTERVAL=24 make trim
|
||||
cp src/colors.css.blob next/colors.css.blob
|
||||
PROJECT=next SLEEP_INTERVAL=24 make print > "next.latest.24ms.txt"
|
||||
|
||||
echo "Running bun at 24ms"
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make generate &
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make process_video
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make frames -j$(nproc)
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make trim
|
||||
cp src/colors.css.blob bun/colors.css.blob
|
||||
PROJECT=bun SLEEP_INTERVAL=24 make print > "bun.latest.24ms.txt"
|
||||
|
||||
echo "Running next at 16ms"
|
||||
PROJECT=next SLEEP_INTERVAL=16 make generate &
|
||||
PROJECT=next SLEEP_INTERVAL=16 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=next SLEEP_INTERVAL=16 make process_video
|
||||
PROJECT=next SLEEP_INTERVAL=16 make frames -j$(nproc)
|
||||
PROJECT=next SLEEP_INTERVAL=16 make trim
|
||||
cp src/colors.css.blob next/colors.css.blob
|
||||
PROJECT=next SLEEP_INTERVAL=16 make print > "next.latest.16ms.txt"
|
||||
|
||||
echo "Running bun at 16ms"
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make generate &
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make process_video
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make frames -j$(nproc)
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make trim
|
||||
cp src/colors.css.blob bun/colors.css.blob
|
||||
PROJECT=bun SLEEP_INTERVAL=16 make print > "bun.latest.16ms.txt"
|
||||
|
||||
echo "Running bun at 8ms"
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make generate &
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make process_video
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make frames -j$(nproc)
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make trim
|
||||
cp src/colors.css.blob bun/colors.css.blob
|
||||
PROJECT=bun SLEEP_INTERVAL=8 make print > "bun.latest.8ms.txt"
|
||||
|
||||
|
||||
echo "Running next at 8ms"
|
||||
PROJECT=next SLEEP_INTERVAL=8 make generate &
|
||||
PROJECT=next SLEEP_INTERVAL=8 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=next SLEEP_INTERVAL=8 make process_video
|
||||
PROJECT=next SLEEP_INTERVAL=8 make frames -j$(nproc)
|
||||
PROJECT=next SLEEP_INTERVAL=8 make trim
|
||||
cp src/colors.css.blob next/colors.css.blob
|
||||
PROJECT=next SLEEP_INTERVAL=8 make print > "next.latest.8ms.txt"
|
||||
|
||||
echo "Running bun at 32ms"
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make generate &
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make process_video
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make frames -j$(nproc)
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make trim
|
||||
cp src/colors.css.blob bun/colors.css.blob
|
||||
PROJECT=bun SLEEP_INTERVAL=32 make print > "bun.latest.32ms.txt"
|
||||
|
||||
echo "Running next at 32ms"
|
||||
PROJECT=next SLEEP_INTERVAL=32 make generate &
|
||||
PROJECT=next SLEEP_INTERVAL=32 make loop
|
||||
killall Chromium || echo "";
|
||||
PROJECT=next SLEEP_INTERVAL=32 make process_video
|
||||
PROJECT=next SLEEP_INTERVAL=32 make frames -j$(nproc)
|
||||
PROJECT=next SLEEP_INTERVAL=32 make trim
|
||||
cp src/colors.css.blob next/colors.css.blob
|
||||
PROJECT=next SLEEP_INTERVAL=32 make print > "next.latest.32ms.txt"
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
:root {
|
||||
--timestamp: "0";
|
||||
--interval: "8";
|
||||
--progress-bar: 0%;
|
||||
--spinner-1-muted: rgb(179, 6, 202);
|
||||
--spinner-1-primary: rgb(224, 8, 253);
|
||||
--spinner-2-muted: rgb(22, 188, 124);
|
||||
--spinner-2-primary: rgb(27, 235, 155);
|
||||
--spinner-3-muted: rgb(89, 72, 0);
|
||||
--spinner-3-primary: rgb(111, 90, 0);
|
||||
--spinner-4-muted: rgb(18, 84, 202);
|
||||
--spinner-4-primary: rgb(23, 105, 253);
|
||||
--spinner-rotate: 304deg;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
import { Global } from "@emotion/react";
|
||||
export function CSSInJSStyles() {
|
||||
return (
|
||||
<Global
|
||||
styles={`
|
||||
:root {
|
||||
--timestamp: "0";
|
||||
--interval: "8";
|
||||
--progress-bar: 11.83299999999997%;
|
||||
--spinner-1-muted: rgb(142, 6, 182);
|
||||
--spinner-1-primary: rgb(177, 8, 227);
|
||||
--spinner-2-muted: rgb(110, 148, 190);
|
||||
--spinner-2-primary: rgb(138, 185, 238);
|
||||
--spinner-3-muted: rgb(75, 45, 64);
|
||||
--spinner-3-primary: rgb(94, 56, 80);
|
||||
--spinner-4-muted: rgb(155, 129, 108);
|
||||
--spinner-4-primary: rgb(194, 161, 135);
|
||||
--spinner-rotate: 213deg;
|
||||
}
|
||||
`}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
import { Global } from "@emotion/react";
|
||||
export function CSSInJSStyles() {
|
||||
return (
|
||||
<Global
|
||||
styles={`
|
||||
:root {
|
||||
--timestamp: "16336621338281";
|
||||
--interval: "16";
|
||||
--progress-bar: 56.889%;
|
||||
--spinner-1-muted: rgb(179, 6, 202);
|
||||
--spinner-1-primary: rgb(224, 8, 253);
|
||||
--spinner-2-muted: rgb(22, 188, 124);
|
||||
--spinner-2-primary: rgb(27, 235, 155);
|
||||
--spinner-3-muted: rgb(89, 72, 0);
|
||||
--spinner-3-primary: rgb(111, 90, 0);
|
||||
--spinner-4-muted: rgb(18, 84, 202);
|
||||
--spinner-4-primary: rgb(23, 105, 253);
|
||||
--spinner-rotate: 304deg;
|
||||
} `}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,248 +0,0 @@
|
||||
@import "./colors.css";
|
||||
|
||||
:root {
|
||||
--heading-font: "Space Mono", system-ui;
|
||||
--body-font: "IBM Plex Sans", system-ui;
|
||||
|
||||
--color-brand: #02ff00;
|
||||
--color-brand-muted: rgb(2, 150, 0);
|
||||
|
||||
--padding-horizontal: 90px;
|
||||
|
||||
--page-background: black;
|
||||
--page-background-alpha: rgba(0, 0, 0, 0.8);
|
||||
|
||||
--result__background-color: black;
|
||||
--result__primary-color: var(--color-brand);
|
||||
--result__foreground-color: white;
|
||||
--result__muted-color: rgb(165, 165, 165);
|
||||
|
||||
--card-width: 352px;
|
||||
|
||||
--page-width: 1152px;
|
||||
|
||||
--snippets_container-background-unfocused: #171717;
|
||||
--snippets_container-background-focused: #0017e9;
|
||||
--snippets_container-background: var(
|
||||
--snippets_container-background-unfocused
|
||||
);
|
||||
--snippets_container-muted-color: rgb(153, 153, 153);
|
||||
}
|
||||
|
||||
body {
|
||||
color: white;
|
||||
margin: 0;
|
||||
|
||||
padding: 0;
|
||||
font-family: var(--body-font);
|
||||
background-color: var(--page-background);
|
||||
color: var(--result__muted-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.Subtitle {
|
||||
text-align: center;
|
||||
font-size: 4em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin-bottom: 0.25em;
|
||||
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
#reactroot,
|
||||
#__next,
|
||||
body,
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.Title {
|
||||
color: var(--color-brand);
|
||||
font-family: var(--heading-font);
|
||||
font-weight: 700;
|
||||
margin-top: 48px;
|
||||
font-size: 48px;
|
||||
text-transform: capitalize;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.Description {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
header,
|
||||
.main {
|
||||
width: 650px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
section {
|
||||
width: 650px;
|
||||
}
|
||||
|
||||
header {
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
footer {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
#reactroot,
|
||||
#__next {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
section {
|
||||
height: 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ran,
|
||||
.timer {
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
-webkit-text-stroke: white;
|
||||
-webkit-text-stroke-width: 2px;
|
||||
color: white;
|
||||
font-size: 100px;
|
||||
}
|
||||
.ran {
|
||||
}
|
||||
|
||||
.ProgressBar-container {
|
||||
width: 100%;
|
||||
display: block;
|
||||
position: relative;
|
||||
border-left: 10px solid red;
|
||||
border-right: 10px solid pink;
|
||||
border-top: 10px solid yellow;
|
||||
border-bottom: 10px solid orange;
|
||||
border-radius: 4px;
|
||||
|
||||
height: 92px;
|
||||
}
|
||||
|
||||
.ProgressBar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
background-color: var(--color-brand);
|
||||
transform-origin: top left;
|
||||
border-radius: 4px;
|
||||
transform: scaleX(var(--progress-bar, 0%));
|
||||
}
|
||||
|
||||
.Bundler-container {
|
||||
background-color: var(--snippets_container-background-focused);
|
||||
font-size: 64px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
left: 0;
|
||||
right: 0;
|
||||
padding: 0.8em 0.8em;
|
||||
}
|
||||
|
||||
.Bundler-updateRate {
|
||||
font-size: 0.8em;
|
||||
font-weight: normal;
|
||||
display: flex;
|
||||
color: var(--result__muted-color);
|
||||
}
|
||||
|
||||
.interval:before {
|
||||
content: var(--interval, "16");
|
||||
}
|
||||
|
||||
.highlight {
|
||||
margin-left: 0.5ch;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.timer:after {
|
||||
content: var(--timestamp);
|
||||
font-variant-numeric: tabular-nums;
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
|
||||
display: inline;
|
||||
font-weight: 500;
|
||||
color: white;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.SectionLabel {
|
||||
font-weight: 300;
|
||||
font-family: var(--heading-font);
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
font-weight: 700;
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.FooterLabel {
|
||||
margin-top: 0;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.Spinner-container {
|
||||
--spinner-muted: rgb(0, 255, 0);
|
||||
--spinner-primary: rgb(0, 60, 255);
|
||||
|
||||
width: 96px;
|
||||
height: 96px;
|
||||
border-radius: 50%;
|
||||
background-color: var(--page-background);
|
||||
border-top: 1.1em solid var(--spinner-muted);
|
||||
border-right: 1.1em solid var(--spinner-muted);
|
||||
border-bottom: 1.1em solid var(--spinner-muted);
|
||||
border-left: 1.1em solid var(--spinner-primary);
|
||||
|
||||
transform: rotate(var(--spinner-rotate, 12deg));
|
||||
}
|
||||
|
||||
.Spinners {
|
||||
display: grid;
|
||||
grid-auto-flow: column;
|
||||
justify-content: space-between;
|
||||
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.Spinner-1.Spinner-container {
|
||||
--spinner-muted: var(--spinner-1-muted);
|
||||
--spinner-primary: var(--spinner-1-primary);
|
||||
}
|
||||
|
||||
.Spinner-2.Spinner-container {
|
||||
--spinner-muted: var(--spinner-2-muted);
|
||||
--spinner-primary: var(--spinner-2-primary);
|
||||
}
|
||||
|
||||
.Spinner-3.Spinner-container {
|
||||
--spinner-muted: var(--spinner-3-muted);
|
||||
--spinner-primary: var(--spinner-3-primary);
|
||||
}
|
||||
|
||||
.Spinner-4.Spinner-container {
|
||||
--spinner-muted: var(--spinner-4-muted);
|
||||
--spinner-primary: var(--spinner-4-primary);
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import ReactDOM from "react-dom";
|
||||
import { Main } from "./main";
|
||||
|
||||
const Base = () => {
|
||||
const name = typeof location !== "undefined" ? decodeURIComponent(location.search.substring(1)) : null;
|
||||
return <Main productName={name} />;
|
||||
};
|
||||
|
||||
function startReact() {
|
||||
ReactDOM.hydrate(<Base />, document.querySelector("#reactroot"));
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") {
|
||||
globalThis.addEventListener("DOMContentLoaded", () => {
|
||||
startReact();
|
||||
});
|
||||
|
||||
startReact();
|
||||
}
|
||||
|
||||
export { Base };
|
||||
@@ -1,56 +0,0 @@
|
||||
export const Main = (props: { productName: string; cssInJS?: string }) => {
|
||||
return (
|
||||
<>
|
||||
<header>
|
||||
<div className="Title">CSS HMR Stress Test!</div>
|
||||
<p className="Description">
|
||||
This page visually tests how quickly a bundler can update {props.cssInJS ? "CSS-in-JS" : "CSS"} over Hot
|
||||
Module Reloading.
|
||||
</p>
|
||||
</header>
|
||||
<main className="main">
|
||||
<section className="ProgressSection">
|
||||
<p className="Subtitle">
|
||||
<span className="Subtitle-part ran">
|
||||
Ran: <span className="timer"></span>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div className="ProgressBar-container">
|
||||
<div className="ProgressBar"></div>
|
||||
</div>
|
||||
<div className="SectionLabel">The progress bar should move from left to right smoothly.</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<div className="Spinners">
|
||||
<div className="Spinner-container Spinner-1">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-2">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-3">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
|
||||
<div className="Spinner-container Spinner-4">
|
||||
<div className="Spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="SectionLabel">The spinners should rotate & change color smoothly.</div>
|
||||
</section>
|
||||
</main>
|
||||
<footer>
|
||||
<div className="SectionLabel FooterLabel">There are no CSS animations on this page.</div>
|
||||
|
||||
<div className="Bundler-container">
|
||||
<div className="Bundler">{props.productName}</div>
|
||||
<div className="Bundler-updateRate">{props.cssInJS ? "CSS-in-JS framework: " + props.cssInJS : ""}</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -1,178 +0,0 @@
|
||||
{
|
||||
"label": "bun-cli@0.0.34",
|
||||
"at": "2021-10-08T01:01:18.129Z",
|
||||
"sleep": "32",
|
||||
"package": {
|
||||
"name": "bun-cli",
|
||||
"version": "0.0.34"
|
||||
},
|
||||
"timestamps": [
|
||||
16336202536562, 16336202536908, 16336202537294, 16336202537705, 16336202538114, 16336202538534, 16336202538941,
|
||||
16336202539323, 16336202539742, 16336202540159, 16336202540877, 16336202541310, 16336202541749, 16336202542159,
|
||||
16336202542565, 16336202542996, 16336202543333, 16336202543761, 16336202544159, 16336202544534, 16336202544944,
|
||||
16336202545345, 16336202545744, 16336202546159, 16336202546573, 16336202546986, 16336202547399, 16336202547781,
|
||||
16336202548202, 16336202548564, 16336202548949, 16336202549329, 16336202549762, 16336202550168, 16336202550534,
|
||||
16336202550887, 16336202551305, 16336202551659, 16336202552060, 16336202552449, 16336202552854, 16336202553270,
|
||||
16336202553609, 16336202554034, 16336202554437, 16336202554783, 16336202555191, 16336202555623, 16336202556034,
|
||||
16336202556449, 16336202556890, 16336202557283, 16336202557669, 16336202558084, 16336202558496, 16336202558863,
|
||||
16336202559271, 16336202559659, 16336202560051, 16336202560452, 16336202560873, 16336202561290, 16336202561659,
|
||||
16336202562035, 16336202562440, 16336202562862, 16336202563284, 16336202563659, 16336202564034, 16336202564444,
|
||||
16336202564853, 16336202565245, 16336202565659, 16336202566034, 16336202566455, 16336202566873, 16336202567284,
|
||||
16336202567659, 16336202568034, 16336202568386, 16336202568790, 16336202569204, 16336202569620, 16336202570384,
|
||||
16336202570768, 16336202571188, 16336202571551, 16336202572327, 16336202572717, 16336202573116, 16336202573541,
|
||||
16336202573959, 16336202574319, 16336202574682, 16336202575040, 16336202575375, 16336202577001, 16336202577342,
|
||||
16336202577680, 16336202578066, 16336202578451, 16336202579166, 16336202579534, 16336202579960, 16336202580370,
|
||||
16336202580789, 16336202581159, 16336202581576, 16336202581949, 16336202582294, 16336202583087, 16336202583496,
|
||||
16336202583858, 16336202584203, 16336202584606, 16336202585034, 16336202585386, 16336202585788, 16336202586211,
|
||||
16336202586604, 16336202587034, 16336202587459, 16336202587869, 16336202588295, 16336202588668, 16336202589092,
|
||||
16336202589452, 16336202589831, 16336202590197, 16336202590608, 16336202591034, 16336202591460, 16336202591880,
|
||||
16336202592295, 16336202592727, 16336202593172, 16336202593567, 16336202593994, 16336202594397, 16336202594795,
|
||||
16336202595224, 16336202595659, 16336202596058, 16336202596463, 16336202596890, 16336202597322, 16336202597732,
|
||||
16336202598159, 16336202598534, 16336202598951, 16336202599365, 16336202599785, 16336202600159, 16336202600593,
|
||||
16336202601005, 16336202601402, 16336202601807, 16336202602214, 16336202602556, 16336202602895, 16336202603307,
|
||||
16336202603661, 16336202604075, 16336202604491, 16336202604853, 16336202605268, 16336202605670, 16336202606034,
|
||||
16336202606393, 16336202606748, 16336202607170, 16336202607568, 16336202607982, 16336202608411, 16336202608836,
|
||||
16336202609197, 16336202609596, 16336202609965, 16336202610333, 16336202610740, 16336202611159, 16336202611573,
|
||||
16336202611975, 16336202612317, 16336202612691, 16336202613060, 16336202613474, 16336202613903, 16336202614341,
|
||||
16336202614707, 16336202615094, 16336202615534, 16336202615883, 16336202616296, 16336202616671, 16336202617034,
|
||||
16336202617391, 16336202617727, 16336202618159, 16336202618534, 16336202618937, 16336202619360, 16336202619770,
|
||||
16336202620179, 16336202620716, 16336202621143, 16336202621534, 16336202622303, 16336202622659, 16336202623085,
|
||||
16336202623498, 16336202623850, 16336202624220, 16336202624606, 16336202625034, 16336202625387, 16336202625805,
|
||||
16336202626210, 16336202626599, 16336202627034, 16336202627386, 16336202627748, 16336202628159, 16336202628534,
|
||||
16336202628954, 16336202629373, 16336202629809, 16336202630197, 16336202630535, 16336202630916, 16336202631290,
|
||||
16336202631666, 16336202632034, 16336202632369, 16336202633152, 16336202633534, 16336202633883, 16336202634309,
|
||||
16336202634717, 16336202635106, 16336202635871, 16336202636253, 16336202636671, 16336202637070, 16336202637434,
|
||||
16336202637798, 16336202638184, 16336202638539, 16336202638938, 16336202639307, 16336202639666, 16336202640095,
|
||||
16336202640534, 16336202640962, 16336202641307, 16336202641659, 16336202642087, 16336202642521, 16336202642886,
|
||||
16336202643309, 16336202643662, 16336202644067, 16336202644491, 16336202644853, 16336202645226, 16336202645659,
|
||||
16336202646074, 16336202646497, 16336202646890, 16336202647311, 16336202647749, 16336202648169, 16336202648976,
|
||||
16336202649378, 16336202649810, 16336202650165, 16336202650534, 16336202650875, 16336202651250, 16336202651659,
|
||||
16336202652093, 16336202652516, 16336202652921, 16336202653332, 16336202653722, 16336202654142, 16336202654534,
|
||||
16336202654880, 16336202655221, 16336202655562, 16336202655997, 16336202656378, 16336202656811, 16336202657161,
|
||||
16336202657588, 16336202657944, 16336202658360, 16336202658708, 16336202659089, 16336202659428, 16336202659849,
|
||||
16336202660273, 16336202660685, 16336202661105, 16336202661534, 16336202661873, 16336202662228, 16336202662658,
|
||||
16336202663438, 16336202663843, 16336202664219, 16336202664646, 16336202665050, 16336202665487, 16336202665838,
|
||||
16336202666211, 16336202666573, 16336202666927, 16336202667334, 16336202667746, 16336202668158, 16336202668563,
|
||||
16336202668980, 16336202669406, 16336202669753, 16336202670192, 16336202670554, 16336202670903, 16336202671324,
|
||||
16336202671734, 16336202672159, 16336202672573, 16336202672982, 16336202673346, 16336202673680, 16336202674087,
|
||||
16336202674499, 16336202674909, 16336202675260, 16336202676110, 16336202676535, 16336202676913, 16336202677312,
|
||||
16336202677658, 16336202678044, 16336202678413, 16336202678793, 16336202679208, 16336202679604, 16336202680034,
|
||||
16336202680385, 16336202680799, 16336202681213, 16336202681595, 16336202682004, 16336202682346, 16336202682726,
|
||||
16336202683158, 16336202683586, 16336202683990, 16336202684323, 16336202684742, 16336202685175, 16336202685578,
|
||||
16336202685979, 16336202686805, 16336202687206, 16336202687614, 16336202688038, 16336202688473, 16336202688848,
|
||||
16336202689221, 16336202689559, 16336202689971, 16336202690368, 16336202690776, 16336202691159, 16336202691585,
|
||||
16336202692010, 16336202692373, 16336202692780, 16336202693179, 16336202693580, 16336202693991, 16336202694324,
|
||||
16336202694727, 16336202695159, 16336202695588, 16336202695991, 16336202696335, 16336202697160, 16336202697542,
|
||||
16336202697929, 16336202698323, 16336202698674, 16336202699060, 16336202699492, 16336202699835, 16336202700238,
|
||||
16336202700658, 16336202701059, 16336202701420, 16336202701815, 16336202702229, 16336202702659, 16336202703857,
|
||||
16336202704256, 16336202704659, 16336202705497, 16336202706309, 16336202706660, 16336202707085, 16336202707511,
|
||||
16336202707866, 16336202708210, 16336202708552, 16336202708925, 16336202709287, 16336202709670, 16336202710045,
|
||||
16336202710402, 16336202710802, 16336202711167, 16336202711533, 16336202712249, 16336202712660, 16336202713088,
|
||||
16336202713519, 16336202713936, 16336202714355, 16336202714740, 16336202715160, 16336202715533, 16336202715878,
|
||||
16336202716290, 16336202716708, 16336202717102, 16336202718290, 16336202718699, 16336202719052, 16336202719388,
|
||||
16336202719808, 16336202720225, 16336202720659, 16336202721052, 16336202721414, 16336202721828, 16336202722925,
|
||||
16336202723664, 16336202724063, 16336202724405, 16336202726003, 16336202726736, 16336202727158, 16336202727543,
|
||||
16336202727930, 16336202728336, 16336202728703, 16336202729061, 16336202729483, 16336202729832, 16336202730222,
|
||||
16336202730659, 16336202731084, 16336202731500, 16336202731911, 16336202732326, 16336202733158, 16336202733585,
|
||||
16336202734001, 16336202734691, 16336202735042, 16336202735442, 16336202735863, 16336202736255, 16336202736671,
|
||||
16336202737043, 16336202737884, 16336202738671, 16336202739110, 16336202739533, 16336202739886, 16336202740283,
|
||||
16336202740706, 16336202741143, 16336202741534, 16336202741942, 16336202742352, 16336202742697, 16336202743103,
|
||||
16336202743940, 16336202745172, 16336202745542, 16336202745937, 16336202746339, 16336202746758, 16336202747531,
|
||||
16336202747877, 16336202748232, 16336202748658, 16336202749055, 16336202749468, 16336202749859, 16336202750416,
|
||||
16336202750839, 16336202751178, 16336202751572, 16336202752002, 16336202752419, 16336202753269, 16336202753678,
|
||||
16336202754086, 16336202754432, 16336202754835, 16336202755260, 16336202755683, 16336202756059, 16336202756402,
|
||||
16336202756837, 16336202758084, 16336202758507, 16336202758879, 16336202759270, 16336202759674, 16336202760044,
|
||||
16336202760400, 16336202760801, 16336202761659, 16336202762053, 16336202762397, 16336202763199, 16336202763547,
|
||||
16336202763948, 16336202764714, 16336202765113, 16336202765947, 16336202766329, 16336202766664, 16336202767085,
|
||||
16336202768233, 16336202769056, 16336202769758, 16336202770178, 16336202770585, 16336202770929, 16336202771325,
|
||||
16336202772158, 16336202772594, 16336202773033, 16336202773403, 16336202773801, 16336202774179, 16336202774555,
|
||||
16336202774989, 16336202775393, 16336202775809, 16336202776209, 16336202776618, 16336202777033, 16336202777421,
|
||||
16336202777845, 16336202778246, 16336202778658, 16336202779055, 16336202779411, 16336202779761, 16336202780175,
|
||||
16336202780594, 16336202781002, 16336202781848, 16336202782658, 16336202783033, 16336202783857, 16336202784211,
|
||||
16336202784557, 16336202784972, 16336202785377, 16336202785810, 16336202786172, 16336202786934, 16336202787343,
|
||||
16336202787765, 16336202788201, 16336202788563, 16336202788970, 16336202789329, 16336202789672, 16336202790055,
|
||||
16336202790456, 16336202790802, 16336202791580, 16336202791920, 16336202792326, 16336202793158, 16336202793953,
|
||||
16336202794368, 16336202795187, 16336202795622, 16336202796033, 16336202796393, 16336202796777, 16336202797173,
|
||||
16336202797540, 16336202797975, 16336202798317, 16336202798739, 16336202799158, 16336202799567, 16336202799966,
|
||||
16336202800378, 16336202800803, 16336202801232, 16336202801658, 16336202802033, 16336202802374, 16336202802759,
|
||||
16336202803158, 16336202803533, 16336202803947, 16336202804354, 16336202804729, 16336202805158, 16336202805534,
|
||||
16336202805950, 16336202806390, 16336202806805, 16336202807219, 16336202807643, 16336202808033, 16336202808377,
|
||||
16336202808790, 16336202809211, 16336202809560, 16336202809920, 16336202810355, 16336202810758, 16336202811187,
|
||||
16336202811596, 16336202811943, 16336202812348, 16336202812710, 16336202813060, 16336202813398, 16336202813791,
|
||||
16336202814158, 16336202814533, 16336202814878, 16336202815246, 16336202815658, 16336202816079, 16336202816851,
|
||||
16336202817202, 16336202817540, 16336202817905, 16336202818244, 16336202818663, 16336202819068, 16336202819418,
|
||||
16336202819777, 16336202820193, 16336202820599, 16336202821033, 16336202821395, 16336202821745, 16336202822158,
|
||||
16336202822590, 16336202822996, 16336202823396, 16336202823804, 16336202824210, 16336202824581, 16336202824991,
|
||||
16336202825406, 16336202825806, 16336202826210, 16336202826598, 16336202827033, 16336202827446, 16336202827839,
|
||||
16336202828201, 16336202828577, 16336202828968, 16336202829362, 16336202829709, 16336202830096, 16336202830533,
|
||||
16336202830917, 16336202831290, 16336202831699, 16336202832035, 16336202832406, 16336202832804, 16336202833200,
|
||||
16336202833604, 16336202834033, 16336202834386, 16336202834759, 16336202835190, 16336202835621, 16336202836033,
|
||||
16336202836405, 16336202837191, 16336202837613, 16336202838033, 16336202838374, 16336202838798, 16336202839200,
|
||||
16336202839603, 16336202840034, 16336202840389, 16336202840783, 16336202841200, 16336202841617, 16336202842034,
|
||||
16336202842390, 16336202842737, 16336202843158, 16336202843585, 16336202843923, 16336202844313, 16336202844724,
|
||||
16336202845158, 16336202845576, 16336202845939, 16336202846368, 16336202846728, 16336202847158, 16336202847568,
|
||||
16336202847911, 16336202848291, 16336202848695, 16336202849103, 16336202849533, 16336202849942, 16336202850368,
|
||||
16336202850747, 16336202851158, 16336202851549, 16336202851978, 16336202852383, 16336202852725, 16336202853158,
|
||||
16336202853554, 16336202853961, 16336202854308, 16336202854704, 16336202855060, 16336202855418, 16336202855776,
|
||||
16336202856203, 16336202856617, 16336202857036, 16336202857455, 16336202857884, 16336202858262, 16336202858658,
|
||||
16336202859071, 16336202859847, 16336202860237, 16336202860658, 16336202861037, 16336202861452, 16336202861869,
|
||||
16336202862218, 16336202862590, 16336202863001, 16336202863422, 16336202863857, 16336202864219, 16336202864658,
|
||||
16336202865047, 16336202865404, 16336202865789, 16336202866210, 16336202866624, 16336202867033, 16336202867380,
|
||||
16336202867797, 16336202868227, 16336202868658, 16336202869083, 16336202869500, 16336202869906, 16336202870246,
|
||||
16336202870658, 16336202871086, 16336202871441, 16336202871820, 16336202872204, 16336202872546, 16336202872943,
|
||||
16336202873380, 16336202873811, 16336202874213, 16336202874566, 16336202874918, 16336202875261, 16336202875655,
|
||||
16336202876047, 16336202876771, 16336202877202, 16336202877612, 16336202878033, 16336202878412, 16336202878846,
|
||||
16336202879241, 16336202879658, 16336202880072, 16336202880508, 16336202880901, 16336202881308, 16336202881725,
|
||||
16336202882158, 16336202882579, 16336202882945, 16336202883286, 16336202883657, 16336202884048, 16336202884404,
|
||||
16336202884752, 16336202885158, 16336202885533, 16336202885938, 16336202886364, 16336202886759, 16336202887175,
|
||||
16336202887585, 16336202887929, 16336202888345, 16336202888743, 16336202889157, 16336202889570, 16336202889970,
|
||||
16336202890382, 16336202890761, 16336202891187, 16336202891600, 16336202892033, 16336202892454, 16336202892794,
|
||||
16336202893178, 16336202893533, 16336202893903, 16336202894264, 16336202894668, 16336202895049, 16336202895400,
|
||||
16336202895774, 16336202896157, 16336202896537, 16336202896883, 16336202897232, 16336202897658, 16336202898065,
|
||||
16336202898493, 16336202898884, 16336202899251, 16336202899673, 16336202900047, 16336202900467, 16336202900883,
|
||||
16336202901300, 16336202901676, 16336202902068, 16336202902479, 16336202902902, 16336202903260, 16336202903675,
|
||||
16336202904094, 16336202904476, 16336202904824, 16336202905158, 16336202905533, 16336202905934, 16336202906289,
|
||||
16336202906717, 16336202907158, 16336202907547, 16336202907904, 16336202908294, 16336202908717, 16336202909157,
|
||||
16336202909582, 16336202910005, 16336202910399, 16336202910800, 16336202911220, 16336202911657, 16336202912064,
|
||||
16336202912405, 16336202912779, 16336202913158, 16336202913553, 16336202913966, 16336202914376, 16336202914719,
|
||||
16336202915091, 16336202915515, 16336202915887, 16336202916293, 16336202916649, 16336202917438, 16336202917869,
|
||||
16336202918221, 16336202919053, 16336202919425, 16336202919833, 16336202920234, 16336202920658, 16336202921033,
|
||||
16336202921433, 16336202921801, 16336202922161, 16336202922589, 16336202923017, 16336202923418, 16336202923804,
|
||||
16336202924199, 16336202924593, 16336202925033, 16336202925449, 16336202925818, 16336202926223, 16336202926662,
|
||||
16336202927431, 16336202927812, 16336202928227, 16336202928658, 16336202929061, 16336202929473, 16336202929891,
|
||||
16336202930241, 16336202930657, 16336202931057, 16336202931396, 16336202931811, 16336202932225, 16336202932657,
|
||||
16336202933058, 16336202933445, 16336202933790, 16336202934157, 16336202934562, 16336202934988, 16336202935391,
|
||||
16336202935777, 16336202936160, 16336202936562, 16336202936986, 16336202937396, 16336202937751, 16336202938158,
|
||||
16336202938578, 16336202938985, 16336202939396, 16336202939752, 16336202940157, 16336202940585
|
||||
],
|
||||
"frameTimes": [
|
||||
346, 411, 420, 382, 417, 433, 410, 431, 428, 375, 401, 415, 413, 382, 362, 380, 406, 353, 354, 389, 416, 425, 346,
|
||||
432, 415, 393, 415, 367, 388, 401, 417, 376, 422, 375, 410, 392, 375, 418, 375, 352, 414, 764, 420, 776, 399, 418,
|
||||
363, 335, 341, 386, 715, 426, 419, 417, 345, 409, 345, 428, 402, 393, 425, 426, 424, 379, 411, 426, 415, 445, 427,
|
||||
398, 435, 405, 432, 427, 417, 420, 434, 397, 407, 339, 354, 416, 415, 364, 355, 398, 429, 361, 369, 407, 414, 342,
|
||||
369, 429, 366, 440, 413, 363, 336, 375, 423, 409, 427, 769, 426, 352, 386, 353, 405, 435, 362, 375, 419, 388, 381,
|
||||
376, 335, 382, 426, 389, 382, 399, 364, 355, 369, 429, 428, 352, 434, 423, 405, 362, 433, 423, 421, 420, 402, 355,
|
||||
341, 409, 423, 411, 420, 346, 341, 381, 350, 356, 348, 339, 424, 420, 339, 430, 405, 427, 437, 373, 354, 412, 405,
|
||||
426, 439, 349, 410, 414, 364, 407, 410, 850, 378, 346, 369, 415, 430, 414, 382, 342, 432, 404, 419, 403, 826, 408,
|
||||
435, 373, 412, 408, 426, 363, 399, 411, 403, 429, 344, 382, 394, 386, 343, 420, 361, 414, 1198, 403, 812, 425, 355,
|
||||
342, 362, 375, 400, 366, 411, 431, 419, 420, 345, 418, 1188, 353, 420, 434, 362, 1097, 399, 1598, 422, 387, 367,
|
||||
422, 390, 425, 411, 832, 416, 351, 421, 416, 841, 439, 353, 423, 391, 410, 406, 1232, 395, 419, 346, 426, 413, 557,
|
||||
339, 430, 850, 408, 403, 423, 343, 1247, 372, 404, 356, 858, 344, 348, 766, 834, 335, 1148, 702, 407, 396, 436, 370,
|
||||
378, 434, 416, 409, 388, 401, 397, 350, 419, 846, 375, 354, 415, 433, 762, 422, 362, 359, 383, 346, 340, 832, 415,
|
||||
435, 360, 396, 435, 422, 409, 412, 429, 375, 385, 375, 407, 429, 416, 415, 424, 344, 421, 360, 403, 409, 405, 350,
|
||||
393, 375, 368, 421, 351, 365, 419, 350, 416, 434, 350, 432, 400, 406, 410, 400, 388, 413, 362, 391, 347, 437, 373,
|
||||
336, 398, 404, 353, 431, 412, 786, 420, 424, 403, 355, 417, 417, 347, 427, 390, 434, 363, 360, 410, 380, 408, 409,
|
||||
379, 391, 405, 433, 407, 396, 358, 427, 419, 429, 396, 776, 421, 415, 349, 411, 435, 439, 357, 421, 409, 417, 431,
|
||||
417, 340, 428, 379, 342, 437, 402, 352, 394, 724, 410, 379, 395, 414, 393, 417, 421, 341, 391, 348, 375, 426, 416,
|
||||
344, 398, 413, 412, 426, 433, 340, 355, 361, 381, 374, 380, 349, 407, 391, 422, 420, 417, 392, 423, 415, 382, 334,
|
||||
401, 428, 389, 390, 440, 423, 401, 437, 341, 379, 413, 343, 424, 406, 789, 352, 372, 401, 375, 368, 428, 401, 395,
|
||||
440, 369, 439, 381, 431, 412, 350, 400, 415, 432, 387, 367, 426, 386, 402, 410, 407, 407, 356, 428
|
||||
],
|
||||
"percentileMs": {
|
||||
"50": 40.7,
|
||||
"75": 42.3,
|
||||
"90": 43.5,
|
||||
"95": 76.4,
|
||||
"99": 118.8
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"jsx": "react-jsx",
|
||||
"paths": {}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import reactRefresh from "@vitejs/plugin-react-refresh";
|
||||
|
||||
export default {
|
||||
plugins: [reactRefresh()],
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
# Benchmarking hot module reloading
|
||||
|
||||
## Methodology
|
||||
|
||||
How do you benchmark hot module reloading? What do you call "done" and what do you call "start"?
|
||||
|
||||
The answer for "done" is certainly not compilation time. Compilation time is one step.
|
||||
|
||||
I think the answer should be different depending on the type of content loaded.
|
||||
|
||||
For CSS, the answer should be "when the updated stylesheet was drawn on the screen"
|
||||
For JavaScript, the answer should be "when the rebuilt code completed execution such that any changes are applied"
|
||||
For images & assets, the answer should be "when the updated asset finished loading"
|
||||
|
||||
The start time should be defined as "the timestamp the filesystem set as the write time". As in, the time the developer pressed save in their editor.
|
||||
@@ -3,7 +3,7 @@
|
||||
// Enable latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
|
||||
@@ -8,9 +8,9 @@ for (let builtin of builtinModules) {
|
||||
path,
|
||||
`
|
||||
const builtin = ${JSON.stringify(builtin)};
|
||||
const now = require("perf_hooks").performance.now();
|
||||
const now = performance.now();
|
||||
require(builtin);
|
||||
const end = require("perf_hooks").performance.now();
|
||||
const end = performance.now();
|
||||
process.stdout.write(JSON.stringify({builtin, time: end - now}) + "\\n");
|
||||
`,
|
||||
);
|
||||
|
||||
1
bench/stress/hot-reload-files/.gitignore
vendored
Normal file
1
bench/stress/hot-reload-files/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
modules
|
||||
48
bench/stress/hot-reload-files/README.md
Normal file
48
bench/stress/hot-reload-files/README.md
Normal file
@@ -0,0 +1,48 @@
|
||||
# Hot Reload Files Stress Test
|
||||
|
||||
This is a stress test for Bun's hot reloading functionality, designed to test performance with a high number of interdependent files.
|
||||
|
||||
## What It Does
|
||||
|
||||
- Generates 1000 interconnected TypeScript modules
|
||||
- Each module imports 2 other modules
|
||||
- Uses IPC (Inter-Process Communication) to detect reloads
|
||||
- Performs 1,000 hot reloads and tracks memory usage
|
||||
- Reports statistics about hot reload performance
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
./run-stress-test.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Generate 1000 interconnected modules
|
||||
2. Run the stress test that performs 10,000 hot reloads
|
||||
3. Report complete performance statistics
|
||||
|
||||
## How The Test Works
|
||||
|
||||
The test utilizes Node.js's child_process fork API for communication:
|
||||
|
||||
1. The main process (stress-test.ts) creates a child process running Bun with hot reloading
|
||||
2. The modules communicate with the parent process via IPC when they're reloaded
|
||||
3. After detecting a successful reload, the parent modifies another file
|
||||
4. This continues for 1,000 iterations
|
||||
5. Memory usage is tracked throughout the process
|
||||
|
||||
## Architecture
|
||||
|
||||
- **generate.ts**: Creates 1000 interconnected modules with IPC signaling
|
||||
- **stress-test.ts**: Controls the test, forks Bun, and tracks metrics
|
||||
- **run-stress-test.sh**: Script to run the entire test from scratch
|
||||
|
||||
## Performance Metrics
|
||||
|
||||
The test reports:
|
||||
|
||||
- Total number of hot reloads completed
|
||||
- Time taken to complete all reloads
|
||||
- Average time per reload
|
||||
- Initial and final RSS memory usage
|
||||
166
bench/stress/hot-reload-files/generate.ts
Normal file
166
bench/stress/hot-reload-files/generate.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
import { mkdir, writeFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
const MODULES_DIR = join(process.cwd(), "modules");
|
||||
const NUM_MODULES = 1000;
|
||||
|
||||
// Create the modules directory if it doesn't exist
|
||||
async function ensureModulesDir() {
|
||||
try {
|
||||
await mkdir(MODULES_DIR, { recursive: true });
|
||||
console.log(`Created directory: ${MODULES_DIR}`);
|
||||
} catch (err) {
|
||||
if ((err as NodeJS.ErrnoException).code !== "EEXIST") {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const html = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Hot Reload Stress Test</title>
|
||||
<script src="./client_1.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hot Reload Stress Test</h1>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
|
||||
// Generate the HTTP server file (the last file)
|
||||
async function generateServerFile() {
|
||||
const content = `
|
||||
// File: module_${NUM_MODULES}.ts
|
||||
console.log("Server module loaded");
|
||||
import html from './index.html';
|
||||
|
||||
// Create a server to prove things are running
|
||||
const server = Bun.serve({
|
||||
port: 0,
|
||||
routes: {
|
||||
"/": html,
|
||||
},
|
||||
fetch() {
|
||||
return new Response("Hot reload stress test server running");
|
||||
},
|
||||
});
|
||||
|
||||
if (process.send) {
|
||||
process.send({
|
||||
type: "server-started",
|
||||
url: server.url.href,
|
||||
});
|
||||
}
|
||||
|
||||
console.log(\`Server started on http://localhost:\${server.port}\`);
|
||||
|
||||
// Print RSS memory usage
|
||||
const rss = process.memoryUsage().rss / 1024 / 1024;
|
||||
console.log(\`RSS Memory: \${rss.toFixed(2)} MB\`);
|
||||
`;
|
||||
|
||||
await writeFile(join(MODULES_DIR, `module_${NUM_MODULES}.ts`), content);
|
||||
}
|
||||
|
||||
// Generate interconnected module files
|
||||
async function generateModuleFiles() {
|
||||
// Generate modules 1 through NUM_MODULES-1
|
||||
for (let i = 1; i < NUM_MODULES; i++) {
|
||||
// Each module imports 2 other modules (except for the ones near the end that need to import the server)
|
||||
const importIdx1 = Math.min(i + 1, NUM_MODULES);
|
||||
const importIdx2 = Math.min(i + 2, NUM_MODULES);
|
||||
|
||||
const content = `
|
||||
// File: module_${i}.ts
|
||||
import "./module_${importIdx1}";
|
||||
import "./module_${importIdx2}";
|
||||
|
||||
// This value will be changed during hot reload stress testing
|
||||
export const value${i} = {
|
||||
moduleId: ${i},
|
||||
timestamp: \`\${new Date().toISOString()}\`,
|
||||
counter: 0
|
||||
};
|
||||
|
||||
`;
|
||||
|
||||
await writeFile(join(MODULES_DIR, `module_${i}.ts`), content);
|
||||
|
||||
if (i % 100 === 0) {
|
||||
console.log(`Generated ${i} modules`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the entry point file
|
||||
async function generateEntryPoint() {
|
||||
const content = `
|
||||
|
||||
if (!globalThis.hasLoadedOnce) {
|
||||
globalThis.hasLoadedOnce = true;
|
||||
console.log("Starting hot-reload stress test...");
|
||||
|
||||
// Print RSS memory usage
|
||||
const rss = process.memoryUsage().rss / 1024 / 1024;
|
||||
console.log(\`RSS Memory: \${rss.toFixed(2)} MB\`);
|
||||
|
||||
// Signal when the entry point is loaded
|
||||
if (process.send && process.env.HOT_RELOAD_TEST === "true") {
|
||||
process.send({
|
||||
type: 'test-started',
|
||||
rss: rss.toFixed(2)
|
||||
});
|
||||
}
|
||||
|
||||
// Print memory usage periodically
|
||||
setInterval(() => {
|
||||
const rss = process.memoryUsage().rss / 1024 / 1024;
|
||||
console.log(\`[MEMORY] RSS: \${rss.toFixed(2)} MB at \${new Date().toISOString()}\`);
|
||||
|
||||
// Also send via IPC if available
|
||||
if (process.send && process.env.HOT_RELOAD_TEST === "true") {
|
||||
process.send({
|
||||
type: 'memory-update',
|
||||
rss: rss.toFixed(2),
|
||||
time: Date.now()
|
||||
});
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
await import("./module_1");
|
||||
|
||||
process.send({
|
||||
type: "module-reloaded",
|
||||
rss: (process.memoryUsage.rss() / 1024 / 1024) | 0,
|
||||
});
|
||||
|
||||
|
||||
`;
|
||||
|
||||
await writeFile(join(MODULES_DIR, "index.ts"), content);
|
||||
}
|
||||
|
||||
async function generateClientFile() {
|
||||
const content = `
|
||||
// File: client_1.js
|
||||
console.log("Client module loaded");
|
||||
`;
|
||||
await writeFile(join(MODULES_DIR, "client_1.js"), content);
|
||||
await writeFile(join(MODULES_DIR, "index.html"), html);
|
||||
console.log("Generated client module");
|
||||
}
|
||||
|
||||
await ensureModulesDir();
|
||||
console.log("Generating server module...");
|
||||
await generateServerFile();
|
||||
console.log("Generating client module...");
|
||||
await generateClientFile();
|
||||
console.log("Generating interconnected modules...");
|
||||
await generateModuleFiles();
|
||||
console.log("Generating entry point...");
|
||||
await generateEntryPoint();
|
||||
console.log("Generation complete!");
|
||||
console.log("Run with: HOT_RELOAD_TEST=true RELOAD_ID=initial bun --hot modules/index.ts");
|
||||
14
bench/stress/hot-reload-files/run-stress-test.sh
Executable file
14
bench/stress/hot-reload-files/run-stress-test.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Clean up modules directory
|
||||
rm -rf modules
|
||||
|
||||
# Generate the module files
|
||||
echo "Generating 1000 module files..."
|
||||
bun generate.ts
|
||||
|
||||
# Run the stress test
|
||||
echo "Running stress test for 1000 reloads..."
|
||||
bun stress-test.ts
|
||||
|
||||
# All done - the stress test manages the child process internally
|
||||
161
bench/stress/hot-reload-files/stress-test.ts
Normal file
161
bench/stress/hot-reload-files/stress-test.ts
Normal file
@@ -0,0 +1,161 @@
|
||||
import { Subprocess } from "bun";
|
||||
import { readFile, writeFile } from "fs/promises";
|
||||
import { join } from "path";
|
||||
|
||||
const MODULES_DIR = join(process.cwd(), "modules");
|
||||
const NUM_MODULES = 1000;
|
||||
const TOTAL_RELOADS = 1000;
|
||||
|
||||
// Tracking metrics
|
||||
let completedReloads = 0;
|
||||
let startTime = 0;
|
||||
let lastRss = 0;
|
||||
|
||||
// Function to write modified files
|
||||
async function modifyFile(moduleNum: number, reloadId: string): Promise<void> {
|
||||
const modulePath = join(MODULES_DIR, `module_${moduleNum}.ts`);
|
||||
|
||||
try {
|
||||
// Read the current file content
|
||||
const content = await readFile(modulePath, "utf8");
|
||||
|
||||
// Create a new timestamp
|
||||
const timestamp = new Date().toISOString();
|
||||
|
||||
// Replace the timestamp and counter
|
||||
const newContent = content.replace(
|
||||
/export const value\d+ = \{[\s\S]*?\};/,
|
||||
`export const value${moduleNum} = {
|
||||
moduleId: ${moduleNum},
|
||||
timestamp: "${timestamp}",
|
||||
// comment ${completedReloads}!
|
||||
counter: ${completedReloads + 1}
|
||||
};
|
||||
|
||||
`,
|
||||
);
|
||||
|
||||
// Write the modified content back to the file
|
||||
await writeFile(modulePath, newContent);
|
||||
console.count("Modify");
|
||||
return;
|
||||
} catch (error) {
|
||||
console.error(`Error modifying module_${moduleNum}.ts:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// Get a random number between min and max (inclusive)
|
||||
function getRandomInt(min: number, max: number): number {
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
|
||||
// Start the child process with Bun's hot reloading
|
||||
function startBunProcess() {
|
||||
// Start the Bun process with hot reloading enabled
|
||||
const child = Bun.spawn({
|
||||
cmd: [process.execPath, "--hot", "--no-clear-screen", "./modules/index.ts"],
|
||||
stdio: ["inherit", "inherit", "inherit"],
|
||||
env: {
|
||||
...process.env,
|
||||
HOT_RELOAD_TEST: "true",
|
||||
RELOAD_ID: "initial",
|
||||
},
|
||||
ipc(message, subprocess) {
|
||||
if (message.type === "test-started") {
|
||||
console.log(`Test started with initial RSS: ${message.rss} MB`);
|
||||
lastRss = parseFloat(message.rss);
|
||||
startNextReload();
|
||||
} else if (message.type === "module-reloaded") {
|
||||
const { rss } = message;
|
||||
lastRss = parseFloat(rss);
|
||||
|
||||
// Check if this is the current reload we're waiting for
|
||||
completedReloads++;
|
||||
console.log(`[${completedReloads}/${TOTAL_RELOADS}] Module reloaded - RSS: ${rss} MB`);
|
||||
|
||||
// Start the next reload or finish
|
||||
if (completedReloads < TOTAL_RELOADS) {
|
||||
startNextReload();
|
||||
} else {
|
||||
finishTest();
|
||||
}
|
||||
} else if (message.type === "memory-update") {
|
||||
// Periodic memory updates from the child process
|
||||
lastRss = parseFloat(message.rss);
|
||||
} else if (message.type === "server-started") {
|
||||
fetch(message.url).then(res => {
|
||||
res.text().then(text => {
|
||||
console.count("Request completed");
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return child;
|
||||
}
|
||||
|
||||
// Start the next reload
|
||||
async function startNextReload() {
|
||||
const nextReloadNum = completedReloads + 1;
|
||||
if (nextReloadNum > TOTAL_RELOADS) return;
|
||||
|
||||
try {
|
||||
// Generate a unique reload ID for this reload
|
||||
const reloadId = `reload-${nextReloadNum}`;
|
||||
|
||||
// Set the reload ID in the environment for the child process
|
||||
process.env.RELOAD_ID = reloadId;
|
||||
|
||||
// Pick a random module to modify
|
||||
const moduleNum = getRandomInt(1, NUM_MODULES - 1);
|
||||
|
||||
// Modify the file to trigger a hot reload
|
||||
await modifyFile(moduleNum, reloadId);
|
||||
} catch (error) {
|
||||
console.error(`Error during reload #${nextReloadNum}:`, error);
|
||||
// Try the next reload immediately
|
||||
startNextReload();
|
||||
}
|
||||
}
|
||||
|
||||
// Finish the test and print statistics
|
||||
function finishTest() {
|
||||
const endTime = Date.now();
|
||||
const duration = (endTime - startTime) / 1000;
|
||||
|
||||
console.log(`\nStress test complete!`);
|
||||
console.log(`Performed ${completedReloads} hot reloads in ${duration.toFixed(2)} seconds`);
|
||||
console.log(`Average: ${((duration / completedReloads) * 1000).toFixed(2)} ms per reload`);
|
||||
console.log(`Final RSS: ${lastRss.toFixed(2)} MB`);
|
||||
|
||||
// Kill the child process and exit immediately
|
||||
if (childProcess) {
|
||||
childProcess.kill();
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
// Run the stress test
|
||||
let childProcess: Subprocess | null = null;
|
||||
|
||||
async function runStressTest() {
|
||||
console.log(`Starting stress test - will perform ${TOTAL_RELOADS} hot reloads`);
|
||||
startTime = Date.now();
|
||||
|
||||
// Start the Bun process with hot reloading
|
||||
childProcess = startBunProcess();
|
||||
}
|
||||
|
||||
// Start the stress test
|
||||
runStressTest();
|
||||
|
||||
// Handle process termination
|
||||
process.on("SIGINT", () => {
|
||||
console.log("\nTest interrupted by user");
|
||||
if (childProcess) {
|
||||
childProcess.kill();
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
4
bun.lock
4
bun.lock
@@ -17,7 +17,7 @@
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"mitata": "^0.1.11",
|
||||
"peechy": "0.4.34",
|
||||
"prettier": "^3.2.5",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-plugin-organize-imports": "^4.0.0",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
@@ -684,7 +684,7 @@
|
||||
|
||||
"prelude-ls": ["prelude-ls@1.2.1", "", {}, "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g=="],
|
||||
|
||||
"prettier": ["prettier@3.3.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew=="],
|
||||
"prettier": ["prettier@3.5.3", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw=="],
|
||||
|
||||
"prettier-plugin-organize-imports": ["prettier-plugin-organize-imports@4.1.0", "", { "peerDependencies": { "prettier": ">=2.0", "typescript": ">=2.9", "vue-tsc": "^2.1.0" }, "optionalPeers": ["vue-tsc"] }, "sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A=="],
|
||||
|
||||
|
||||
23
cmake/BakeRuntimeSources.txt
Normal file
23
cmake/BakeRuntimeSources.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
src/bake/bake.bind.ts
|
||||
src/bake/bake.d.ts
|
||||
src/bake/bake.private.d.ts
|
||||
src/bake/bun-framework-react/index.ts
|
||||
src/bake/client/css-reloader.ts
|
||||
src/bake/client/data-view.ts
|
||||
src/bake/client/error-serialization.ts
|
||||
src/bake/client/inspect.ts
|
||||
src/bake/client/JavaScriptSyntaxHighlighter.css
|
||||
src/bake/client/JavaScriptSyntaxHighlighter.ts
|
||||
src/bake/client/overlay.css
|
||||
src/bake/client/overlay.ts
|
||||
src/bake/client/stack-trace.ts
|
||||
src/bake/client/websocket.ts
|
||||
src/bake/debug.ts
|
||||
src/bake/DevServer.bind.ts
|
||||
src/bake/enums.ts
|
||||
src/bake/hmr-module.ts
|
||||
src/bake/hmr-runtime-client.ts
|
||||
src/bake/hmr-runtime-error.ts
|
||||
src/bake/hmr-runtime-server.ts
|
||||
src/bake/server/stack-trace-stub.ts
|
||||
src/bake/shared.ts
|
||||
7
cmake/BindgenSources.txt
Normal file
7
cmake/BindgenSources.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
src/bake/bake.bind.ts
|
||||
src/bake/DevServer.bind.ts
|
||||
src/bun.js/api/BunObject.bind.ts
|
||||
src/bun.js/bindgen_test.bind.ts
|
||||
src/bun.js/bindings/NodeModuleModule.bind.ts
|
||||
src/bun.js/node/node_os.bind.ts
|
||||
src/fmt.bind.ts
|
||||
12
cmake/BunErrorSources.txt
Normal file
12
cmake/BunErrorSources.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
packages/bun-error/bun-error.css
|
||||
packages/bun-error/img/close.png
|
||||
packages/bun-error/img/error.png
|
||||
packages/bun-error/img/powered-by.png
|
||||
packages/bun-error/img/powered-by.webp
|
||||
packages/bun-error/index.tsx
|
||||
packages/bun-error/markdown.ts
|
||||
packages/bun-error/package.json
|
||||
packages/bun-error/runtime-error.ts
|
||||
packages/bun-error/sourcemap.ts
|
||||
packages/bun-error/stack-trace-parser.ts
|
||||
packages/bun-error/tsconfig.json
|
||||
12
cmake/CSources.txt
Normal file
12
cmake/CSources.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
packages/bun-usockets/src/bsd.c
|
||||
packages/bun-usockets/src/context.c
|
||||
packages/bun-usockets/src/crypto/openssl.c
|
||||
packages/bun-usockets/src/eventing/epoll_kqueue.c
|
||||
packages/bun-usockets/src/eventing/libuv.c
|
||||
packages/bun-usockets/src/loop.c
|
||||
packages/bun-usockets/src/quic.c
|
||||
packages/bun-usockets/src/socket.c
|
||||
packages/bun-usockets/src/udp.c
|
||||
src/bun.js/bindings/uv-posix-polyfills.c
|
||||
src/bun.js/bindings/uv-posix-stubs.c
|
||||
src/asan-config.c
|
||||
466
cmake/CxxSources.txt
Normal file
466
cmake/CxxSources.txt
Normal file
@@ -0,0 +1,466 @@
|
||||
packages/bun-usockets/src/crypto/root_certs.cpp
|
||||
packages/bun-usockets/src/crypto/sni_tree.cpp
|
||||
src/bake/BakeGlobalObject.cpp
|
||||
src/bake/BakeProduction.cpp
|
||||
src/bake/BakeSourceProvider.cpp
|
||||
src/bun.js/bindings/ActiveDOMCallback.cpp
|
||||
src/bun.js/bindings/AsymmetricKeyValue.cpp
|
||||
src/bun.js/bindings/AsyncContextFrame.cpp
|
||||
src/bun.js/bindings/Base64Helpers.cpp
|
||||
src/bun.js/bindings/bindings.cpp
|
||||
src/bun.js/bindings/blob.cpp
|
||||
src/bun.js/bindings/bun-simdutf.cpp
|
||||
src/bun.js/bindings/bun-spawn.cpp
|
||||
src/bun.js/bindings/BunClientData.cpp
|
||||
src/bun.js/bindings/BunCommonStrings.cpp
|
||||
src/bun.js/bindings/BunDebugger.cpp
|
||||
src/bun.js/bindings/BunGCOutputConstraint.cpp
|
||||
src/bun.js/bindings/BunGlobalScope.cpp
|
||||
src/bun.js/bindings/BunHttp2CommonStrings.cpp
|
||||
src/bun.js/bindings/BunInjectedScriptHost.cpp
|
||||
src/bun.js/bindings/BunInspector.cpp
|
||||
src/bun.js/bindings/BunJSCEventLoop.cpp
|
||||
src/bun.js/bindings/BunObject.cpp
|
||||
src/bun.js/bindings/BunPlugin.cpp
|
||||
src/bun.js/bindings/BunProcess.cpp
|
||||
src/bun.js/bindings/BunString.cpp
|
||||
src/bun.js/bindings/BunWorkerGlobalScope.cpp
|
||||
src/bun.js/bindings/c-bindings.cpp
|
||||
src/bun.js/bindings/CallSite.cpp
|
||||
src/bun.js/bindings/CallSitePrototype.cpp
|
||||
src/bun.js/bindings/CodeCoverage.cpp
|
||||
src/bun.js/bindings/ConsoleObject.cpp
|
||||
src/bun.js/bindings/Cookie.cpp
|
||||
src/bun.js/bindings/CookieMap.cpp
|
||||
src/bun.js/bindings/coroutine.cpp
|
||||
src/bun.js/bindings/CPUFeatures.cpp
|
||||
src/bun.js/bindings/decodeURIComponentSIMD.cpp
|
||||
src/bun.js/bindings/DOMException.cpp
|
||||
src/bun.js/bindings/DOMFormData.cpp
|
||||
src/bun.js/bindings/DOMURL.cpp
|
||||
src/bun.js/bindings/DOMWrapperWorld.cpp
|
||||
src/bun.js/bindings/DoubleFormatter.cpp
|
||||
src/bun.js/bindings/EncodeURIComponent.cpp
|
||||
src/bun.js/bindings/ErrorCode.cpp
|
||||
src/bun.js/bindings/ErrorStackFrame.cpp
|
||||
src/bun.js/bindings/ErrorStackTrace.cpp
|
||||
src/bun.js/bindings/EventLoopTaskNoContext.cpp
|
||||
src/bun.js/bindings/ExposeNodeModuleGlobals.cpp
|
||||
src/bun.js/bindings/ffi.cpp
|
||||
src/bun.js/bindings/helpers.cpp
|
||||
src/bun.js/bindings/highway_strings.cpp
|
||||
src/bun.js/bindings/HTMLEntryPoint.cpp
|
||||
src/bun.js/bindings/ImportMetaObject.cpp
|
||||
src/bun.js/bindings/inlines.cpp
|
||||
src/bun.js/bindings/InspectorBunFrontendDevServerAgent.cpp
|
||||
src/bun.js/bindings/InspectorHTTPServerAgent.cpp
|
||||
src/bun.js/bindings/InspectorLifecycleAgent.cpp
|
||||
src/bun.js/bindings/InspectorTestReporterAgent.cpp
|
||||
src/bun.js/bindings/InternalForTesting.cpp
|
||||
src/bun.js/bindings/InternalModuleRegistry.cpp
|
||||
src/bun.js/bindings/IPC.cpp
|
||||
src/bun.js/bindings/isBuiltinModule.cpp
|
||||
src/bun.js/bindings/JS2Native.cpp
|
||||
src/bun.js/bindings/JSBigIntBinding.cpp
|
||||
src/bun.js/bindings/JSBuffer.cpp
|
||||
src/bun.js/bindings/JSBufferEncodingType.cpp
|
||||
src/bun.js/bindings/JSBufferList.cpp
|
||||
src/bun.js/bindings/JSBundlerPlugin.cpp
|
||||
src/bun.js/bindings/JSBunRequest.cpp
|
||||
src/bun.js/bindings/JSCommonJSExtensions.cpp
|
||||
src/bun.js/bindings/JSCommonJSModule.cpp
|
||||
src/bun.js/bindings/JSCTaskScheduler.cpp
|
||||
src/bun.js/bindings/JSCTestingHelpers.cpp
|
||||
src/bun.js/bindings/JSDOMExceptionHandling.cpp
|
||||
src/bun.js/bindings/JSDOMFile.cpp
|
||||
src/bun.js/bindings/JSDOMGlobalObject.cpp
|
||||
src/bun.js/bindings/JSDOMWrapper.cpp
|
||||
src/bun.js/bindings/JSDOMWrapperCache.cpp
|
||||
src/bun.js/bindings/JSEnvironmentVariableMap.cpp
|
||||
src/bun.js/bindings/JSFFIFunction.cpp
|
||||
src/bun.js/bindings/JSMockFunction.cpp
|
||||
src/bun.js/bindings/JSNextTickQueue.cpp
|
||||
src/bun.js/bindings/JSPropertyIterator.cpp
|
||||
src/bun.js/bindings/JSS3File.cpp
|
||||
src/bun.js/bindings/JSSocketAddressDTO.cpp
|
||||
src/bun.js/bindings/JSStringDecoder.cpp
|
||||
src/bun.js/bindings/JSWrappingFunction.cpp
|
||||
src/bun.js/bindings/JSX509Certificate.cpp
|
||||
src/bun.js/bindings/JSX509CertificateConstructor.cpp
|
||||
src/bun.js/bindings/JSX509CertificatePrototype.cpp
|
||||
src/bun.js/bindings/linux_perf_tracing.cpp
|
||||
src/bun.js/bindings/MarkingConstraint.cpp
|
||||
src/bun.js/bindings/ModuleLoader.cpp
|
||||
src/bun.js/bindings/napi_external.cpp
|
||||
src/bun.js/bindings/napi_finalizer.cpp
|
||||
src/bun.js/bindings/napi_handle_scope.cpp
|
||||
src/bun.js/bindings/napi_type_tag.cpp
|
||||
src/bun.js/bindings/napi.cpp
|
||||
src/bun.js/bindings/ncrpyto_engine.cpp
|
||||
src/bun.js/bindings/ncrypto.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoDhJob.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenDhKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenDsaKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenEcKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenNidKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoGenRsaKeyPair.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoHkdf.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoKeygen.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoKeys.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoPrimes.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoSignJob.cpp
|
||||
src/bun.js/bindings/node/crypto/CryptoUtil.cpp
|
||||
src/bun.js/bindings/node/crypto/JSCipher.cpp
|
||||
src/bun.js/bindings/node/crypto/JSCipherConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSCipherPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellman.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellmanConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellmanGroup.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellmanGroupPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSDiffieHellmanPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSECDH.cpp
|
||||
src/bun.js/bindings/node/crypto/JSECDHConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSECDHPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSHash.cpp
|
||||
src/bun.js/bindings/node/crypto/JSHmac.cpp
|
||||
src/bun.js/bindings/node/crypto/JSKeyObject.cpp
|
||||
src/bun.js/bindings/node/crypto/JSKeyObjectConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSKeyObjectPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPrivateKeyObject.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPrivateKeyObjectConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPrivateKeyObjectPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPublicKeyObject.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPublicKeyObjectConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSPublicKeyObjectPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSSecretKeyObject.cpp
|
||||
src/bun.js/bindings/node/crypto/JSSecretKeyObjectConstructor.cpp
|
||||
src/bun.js/bindings/node/crypto/JSSecretKeyObjectPrototype.cpp
|
||||
src/bun.js/bindings/node/crypto/JSSign.cpp
|
||||
src/bun.js/bindings/node/crypto/JSVerify.cpp
|
||||
src/bun.js/bindings/node/crypto/KeyObject.cpp
|
||||
src/bun.js/bindings/node/crypto/node_crypto_binding.cpp
|
||||
src/bun.js/bindings/node/NodeTimers.cpp
|
||||
src/bun.js/bindings/NodeAsyncHooks.cpp
|
||||
src/bun.js/bindings/NodeDirent.cpp
|
||||
src/bun.js/bindings/NodeFetch.cpp
|
||||
src/bun.js/bindings/NodeFSStatBinding.cpp
|
||||
src/bun.js/bindings/NodeFSStatFSBinding.cpp
|
||||
src/bun.js/bindings/NodeHTTP.cpp
|
||||
src/bun.js/bindings/NodeTimerObject.cpp
|
||||
src/bun.js/bindings/NodeTLS.cpp
|
||||
src/bun.js/bindings/NodeURL.cpp
|
||||
src/bun.js/bindings/NodeValidator.cpp
|
||||
src/bun.js/bindings/NodeVM.cpp
|
||||
src/bun.js/bindings/NoOpForTesting.cpp
|
||||
src/bun.js/bindings/ObjectBindings.cpp
|
||||
src/bun.js/bindings/objects.cpp
|
||||
src/bun.js/bindings/OsBinding.cpp
|
||||
src/bun.js/bindings/Path.cpp
|
||||
src/bun.js/bindings/ProcessBindingBuffer.cpp
|
||||
src/bun.js/bindings/ProcessBindingConstants.cpp
|
||||
src/bun.js/bindings/ProcessBindingFs.cpp
|
||||
src/bun.js/bindings/ProcessBindingNatives.cpp
|
||||
src/bun.js/bindings/ProcessBindingTTYWrap.cpp
|
||||
src/bun.js/bindings/ProcessBindingUV.cpp
|
||||
src/bun.js/bindings/ProcessIdentifier.cpp
|
||||
src/bun.js/bindings/RegularExpression.cpp
|
||||
src/bun.js/bindings/S3Error.cpp
|
||||
src/bun.js/bindings/ScriptExecutionContext.cpp
|
||||
src/bun.js/bindings/Serialization.cpp
|
||||
src/bun.js/bindings/ServerRouteList.cpp
|
||||
src/bun.js/bindings/spawn.cpp
|
||||
src/bun.js/bindings/SQLClient.cpp
|
||||
src/bun.js/bindings/sqlite/JSSQLStatement.cpp
|
||||
src/bun.js/bindings/Strong.cpp
|
||||
src/bun.js/bindings/Uint8Array.cpp
|
||||
src/bun.js/bindings/Undici.cpp
|
||||
src/bun.js/bindings/URLDecomposition.cpp
|
||||
src/bun.js/bindings/URLSearchParams.cpp
|
||||
src/bun.js/bindings/UtilInspect.cpp
|
||||
src/bun.js/bindings/v8/node.cpp
|
||||
src/bun.js/bindings/v8/shim/Function.cpp
|
||||
src/bun.js/bindings/v8/shim/FunctionTemplate.cpp
|
||||
src/bun.js/bindings/v8/shim/GlobalInternals.cpp
|
||||
src/bun.js/bindings/v8/shim/Handle.cpp
|
||||
src/bun.js/bindings/v8/shim/HandleScopeBuffer.cpp
|
||||
src/bun.js/bindings/v8/shim/InternalFieldObject.cpp
|
||||
src/bun.js/bindings/v8/shim/Map.cpp
|
||||
src/bun.js/bindings/v8/shim/ObjectTemplate.cpp
|
||||
src/bun.js/bindings/v8/shim/Oddball.cpp
|
||||
src/bun.js/bindings/v8/shim/TaggedPointer.cpp
|
||||
src/bun.js/bindings/v8/v8_api_internal.cpp
|
||||
src/bun.js/bindings/v8/v8_internal.cpp
|
||||
src/bun.js/bindings/v8/V8Array.cpp
|
||||
src/bun.js/bindings/v8/V8Boolean.cpp
|
||||
src/bun.js/bindings/v8/V8Context.cpp
|
||||
src/bun.js/bindings/v8/V8EscapableHandleScope.cpp
|
||||
src/bun.js/bindings/v8/V8EscapableHandleScopeBase.cpp
|
||||
src/bun.js/bindings/v8/V8External.cpp
|
||||
src/bun.js/bindings/v8/V8Function.cpp
|
||||
src/bun.js/bindings/v8/V8FunctionCallbackInfo.cpp
|
||||
src/bun.js/bindings/v8/V8FunctionTemplate.cpp
|
||||
src/bun.js/bindings/v8/V8HandleScope.cpp
|
||||
src/bun.js/bindings/v8/V8Isolate.cpp
|
||||
src/bun.js/bindings/v8/V8Local.cpp
|
||||
src/bun.js/bindings/v8/V8Maybe.cpp
|
||||
src/bun.js/bindings/v8/V8Number.cpp
|
||||
src/bun.js/bindings/v8/V8Object.cpp
|
||||
src/bun.js/bindings/v8/V8ObjectTemplate.cpp
|
||||
src/bun.js/bindings/v8/V8String.cpp
|
||||
src/bun.js/bindings/v8/V8Template.cpp
|
||||
src/bun.js/bindings/v8/V8Value.cpp
|
||||
src/bun.js/bindings/Weak.cpp
|
||||
src/bun.js/bindings/webcore/AbortController.cpp
|
||||
src/bun.js/bindings/webcore/AbortSignal.cpp
|
||||
src/bun.js/bindings/webcore/ActiveDOMObject.cpp
|
||||
src/bun.js/bindings/webcore/BroadcastChannel.cpp
|
||||
src/bun.js/bindings/webcore/BunBroadcastChannelRegistry.cpp
|
||||
src/bun.js/bindings/webcore/CloseEvent.cpp
|
||||
src/bun.js/bindings/webcore/CommonAtomStrings.cpp
|
||||
src/bun.js/bindings/webcore/ContextDestructionObserver.cpp
|
||||
src/bun.js/bindings/webcore/CustomEvent.cpp
|
||||
src/bun.js/bindings/webcore/CustomEventCustom.cpp
|
||||
src/bun.js/bindings/webcore/DOMJITHelpers.cpp
|
||||
src/bun.js/bindings/webcore/ErrorCallback.cpp
|
||||
src/bun.js/bindings/webcore/ErrorEvent.cpp
|
||||
src/bun.js/bindings/webcore/Event.cpp
|
||||
src/bun.js/bindings/webcore/EventContext.cpp
|
||||
src/bun.js/bindings/webcore/EventDispatcher.cpp
|
||||
src/bun.js/bindings/webcore/EventEmitter.cpp
|
||||
src/bun.js/bindings/webcore/EventFactory.cpp
|
||||
src/bun.js/bindings/webcore/EventListenerMap.cpp
|
||||
src/bun.js/bindings/webcore/EventNames.cpp
|
||||
src/bun.js/bindings/webcore/EventPath.cpp
|
||||
src/bun.js/bindings/webcore/EventTarget.cpp
|
||||
src/bun.js/bindings/webcore/EventTargetConcrete.cpp
|
||||
src/bun.js/bindings/webcore/EventTargetFactory.cpp
|
||||
src/bun.js/bindings/webcore/FetchHeaders.cpp
|
||||
src/bun.js/bindings/webcore/HeaderFieldTokenizer.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderField.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderIdentifiers.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderMap.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderNames.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderStrings.cpp
|
||||
src/bun.js/bindings/webcore/HTTPHeaderValues.cpp
|
||||
src/bun.js/bindings/webcore/HTTPParsers.cpp
|
||||
src/bun.js/bindings/webcore/IdentifierEventListenerMap.cpp
|
||||
src/bun.js/bindings/webcore/InternalWritableStream.cpp
|
||||
src/bun.js/bindings/webcore/JSAbortAlgorithm.cpp
|
||||
src/bun.js/bindings/webcore/JSAbortController.cpp
|
||||
src/bun.js/bindings/webcore/JSAbortSignal.cpp
|
||||
src/bun.js/bindings/webcore/JSAbortSignalCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSAddEventListenerOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSBroadcastChannel.cpp
|
||||
src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.cpp
|
||||
src/bun.js/bindings/webcore/JSCallbackData.cpp
|
||||
src/bun.js/bindings/webcore/JSCloseEvent.cpp
|
||||
src/bun.js/bindings/webcore/JSCookie.cpp
|
||||
src/bun.js/bindings/webcore/JSCookieMap.cpp
|
||||
src/bun.js/bindings/webcore/JSCountQueuingStrategy.cpp
|
||||
src/bun.js/bindings/webcore/JSCustomEvent.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMBindingInternalsBuiltins.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMBuiltinConstructorBase.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMConstructorBase.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMConvertDate.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMConvertNumbers.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMConvertStrings.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMConvertWebGL.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMException.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMFormData.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMGuardedObject.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMIterator.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMOperation.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMPromise.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMPromiseDeferred.cpp
|
||||
src/bun.js/bindings/webcore/JSDOMURL.cpp
|
||||
src/bun.js/bindings/webcore/JSErrorCallback.cpp
|
||||
src/bun.js/bindings/webcore/JSErrorEvent.cpp
|
||||
src/bun.js/bindings/webcore/JSErrorEventCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSErrorHandler.cpp
|
||||
src/bun.js/bindings/webcore/JSEvent.cpp
|
||||
src/bun.js/bindings/webcore/JSEventCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSEventDOMJIT.cpp
|
||||
src/bun.js/bindings/webcore/JSEventEmitter.cpp
|
||||
src/bun.js/bindings/webcore/JSEventEmitterCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSEventInit.cpp
|
||||
src/bun.js/bindings/webcore/JSEventListener.cpp
|
||||
src/bun.js/bindings/webcore/JSEventListenerOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSEventModifierInit.cpp
|
||||
src/bun.js/bindings/webcore/JSEventTarget.cpp
|
||||
src/bun.js/bindings/webcore/JSEventTargetCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSEventTargetNode.cpp
|
||||
src/bun.js/bindings/webcore/JSFetchHeaders.cpp
|
||||
src/bun.js/bindings/webcore/JSMessageChannel.cpp
|
||||
src/bun.js/bindings/webcore/JSMessageChannelCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSMessageEvent.cpp
|
||||
src/bun.js/bindings/webcore/JSMessageEventCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSMessagePort.cpp
|
||||
src/bun.js/bindings/webcore/JSMessagePortCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSMIMEBindings.cpp
|
||||
src/bun.js/bindings/webcore/JSMIMEParams.cpp
|
||||
src/bun.js/bindings/webcore/JSMIMEType.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformance.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceEntry.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceEntryCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceMark.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceMarkOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceMeasure.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceMeasureOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceObserver.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceObserverCallback.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceObserverCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceObserverEntryList.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceResourceTiming.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceServerTiming.cpp
|
||||
src/bun.js/bindings/webcore/JSPerformanceTiming.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableByteStreamController.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStream.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamDefaultController.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamSink.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamSource.cpp
|
||||
src/bun.js/bindings/webcore/JSReadableStreamSourceCustom.cpp
|
||||
src/bun.js/bindings/webcore/JSStructuredSerializeOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSTextDecoderStream.cpp
|
||||
src/bun.js/bindings/webcore/JSTextEncoder.cpp
|
||||
src/bun.js/bindings/webcore/JSTextEncoderStream.cpp
|
||||
src/bun.js/bindings/webcore/JSTransformStream.cpp
|
||||
src/bun.js/bindings/webcore/JSTransformStreamDefaultController.cpp
|
||||
src/bun.js/bindings/webcore/JSURLSearchParams.cpp
|
||||
src/bun.js/bindings/webcore/JSWebSocket.cpp
|
||||
src/bun.js/bindings/webcore/JSWorker.cpp
|
||||
src/bun.js/bindings/webcore/JSWorkerOptions.cpp
|
||||
src/bun.js/bindings/webcore/JSWritableStream.cpp
|
||||
src/bun.js/bindings/webcore/JSWritableStreamDefaultController.cpp
|
||||
src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.cpp
|
||||
src/bun.js/bindings/webcore/JSWritableStreamSink.cpp
|
||||
src/bun.js/bindings/webcore/MessageChannel.cpp
|
||||
src/bun.js/bindings/webcore/MessageEvent.cpp
|
||||
src/bun.js/bindings/webcore/MessagePort.cpp
|
||||
src/bun.js/bindings/webcore/MessagePortChannel.cpp
|
||||
src/bun.js/bindings/webcore/MessagePortChannelProvider.cpp
|
||||
src/bun.js/bindings/webcore/MessagePortChannelProviderImpl.cpp
|
||||
src/bun.js/bindings/webcore/MessagePortChannelRegistry.cpp
|
||||
src/bun.js/bindings/webcore/NetworkLoadMetrics.cpp
|
||||
src/bun.js/bindings/webcore/Performance.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceEntry.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceMark.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceMeasure.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceObserver.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceObserverEntryList.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceResourceTiming.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceServerTiming.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceTiming.cpp
|
||||
src/bun.js/bindings/webcore/PerformanceUserTiming.cpp
|
||||
src/bun.js/bindings/webcore/ReadableStream.cpp
|
||||
src/bun.js/bindings/webcore/ReadableStreamDefaultController.cpp
|
||||
src/bun.js/bindings/webcore/ReadableStreamSink.cpp
|
||||
src/bun.js/bindings/webcore/ReadableStreamSource.cpp
|
||||
src/bun.js/bindings/webcore/ResourceTiming.cpp
|
||||
src/bun.js/bindings/webcore/RFC7230.cpp
|
||||
src/bun.js/bindings/webcore/SerializedScriptValue.cpp
|
||||
src/bun.js/bindings/webcore/ServerTiming.cpp
|
||||
src/bun.js/bindings/webcore/ServerTimingParser.cpp
|
||||
src/bun.js/bindings/webcore/StructuredClone.cpp
|
||||
src/bun.js/bindings/webcore/TextEncoder.cpp
|
||||
src/bun.js/bindings/webcore/WebCoreTypedArrayController.cpp
|
||||
src/bun.js/bindings/webcore/WebSocket.cpp
|
||||
src/bun.js/bindings/webcore/Worker.cpp
|
||||
src/bun.js/bindings/webcore/WritableStream.cpp
|
||||
src/bun.js/bindings/webcrypto/CommonCryptoDERUtilities.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBC.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CBCOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFB.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CFBOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTR.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_CTROpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCM.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_GCMOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KW.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmAES_KWOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmECDH.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmECDHOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSA.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmECDSAOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmEd25519.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDF.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmHKDFOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmHMAC.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmHMACOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmPBKDF2OpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistry.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRegistryOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEP.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_OAEPOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSS.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSA_PSSOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSAES_PKCS1_v1_5OpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmRSASSA_PKCS1_v1_5OpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA1.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA224.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA256.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA384.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoAlgorithmSHA512.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoDigest.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKey.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyAES.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyEC.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyECOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyHMAC.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyOKP.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyOKPOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyRaw.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyRSA.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyRSAComponents.cpp
|
||||
src/bun.js/bindings/webcrypto/CryptoKeyRSAOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/JSAesCbcCfbParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSAesCtrParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSAesGcmParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSAesKeyParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoAesKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoAlgorithmParameters.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoEcKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoHmacKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoKey.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoKeyPair.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoKeyUsage.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoRsaHashedKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSCryptoRsaKeyAlgorithm.cpp
|
||||
src/bun.js/bindings/webcrypto/JSEcdhKeyDeriveParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSEcdsaParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSEcKeyParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSHkdfParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSHmacKeyParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSJsonWebKey.cpp
|
||||
src/bun.js/bindings/webcrypto/JSPbkdf2Params.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaHashedImportParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaHashedKeyGenParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaKeyGenParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaOaepParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaOtherPrimesInfo.cpp
|
||||
src/bun.js/bindings/webcrypto/JSRsaPssParams.cpp
|
||||
src/bun.js/bindings/webcrypto/JSSubtleCrypto.cpp
|
||||
src/bun.js/bindings/webcrypto/OpenSSLUtilities.cpp
|
||||
src/bun.js/bindings/webcrypto/PhonyWorkQueue.cpp
|
||||
src/bun.js/bindings/webcrypto/SerializedCryptoKeyWrapOpenSSL.cpp
|
||||
src/bun.js/bindings/webcrypto/SubtleCrypto.cpp
|
||||
src/bun.js/bindings/workaround-missing-symbols.cpp
|
||||
src/bun.js/bindings/wtf-bindings.cpp
|
||||
src/bun.js/bindings/ZigGeneratedCode.cpp
|
||||
src/bun.js/bindings/ZigGlobalObject.cpp
|
||||
src/bun.js/bindings/ZigSourceProvider.cpp
|
||||
src/bun.js/modules/NodeModuleModule.cpp
|
||||
src/bun.js/modules/NodeTTYModule.cpp
|
||||
src/bun.js/modules/NodeUtilTypesModule.cpp
|
||||
src/bun.js/modules/ObjectModule.cpp
|
||||
src/deps/libuwsockets.cpp
|
||||
src/io/io_darwin.cpp
|
||||
18
cmake/JavaScriptCodegenSources.txt
Normal file
18
cmake/JavaScriptCodegenSources.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
src/codegen/bake-codegen.ts
|
||||
src/codegen/bindgen-lib-internal.ts
|
||||
src/codegen/bindgen-lib.ts
|
||||
src/codegen/bindgen.ts
|
||||
src/codegen/buildTypeFlag.ts
|
||||
src/codegen/builtin-parser.ts
|
||||
src/codegen/bundle-functions.ts
|
||||
src/codegen/bundle-modules.ts
|
||||
src/codegen/class-definitions.ts
|
||||
src/codegen/client-js.ts
|
||||
src/codegen/create-hash-table.ts
|
||||
src/codegen/generate-classes.ts
|
||||
src/codegen/generate-js2native.ts
|
||||
src/codegen/generate-jssink.ts
|
||||
src/codegen/generate-node-errors.ts
|
||||
src/codegen/helpers.ts
|
||||
src/codegen/internal-module-registry-scanner.ts
|
||||
src/codegen/replacements.ts
|
||||
163
cmake/JavaScriptSources.txt
Normal file
163
cmake/JavaScriptSources.txt
Normal file
@@ -0,0 +1,163 @@
|
||||
src/js/builtins.d.ts
|
||||
src/js/builtins/Bake.ts
|
||||
src/js/builtins/BundlerPlugin.ts
|
||||
src/js/builtins/ByteLengthQueuingStrategy.ts
|
||||
src/js/builtins/CommonJS.ts
|
||||
src/js/builtins/ConsoleObject.ts
|
||||
src/js/builtins/CountQueuingStrategy.ts
|
||||
src/js/builtins/Glob.ts
|
||||
src/js/builtins/ImportMetaObject.ts
|
||||
src/js/builtins/Ipc.ts
|
||||
src/js/builtins/JSBufferConstructor.ts
|
||||
src/js/builtins/JSBufferPrototype.ts
|
||||
src/js/builtins/NodeModuleObject.ts
|
||||
src/js/builtins/Peek.ts
|
||||
src/js/builtins/ProcessObjectInternals.ts
|
||||
src/js/builtins/ReadableByteStreamController.ts
|
||||
src/js/builtins/ReadableByteStreamInternals.ts
|
||||
src/js/builtins/ReadableStream.ts
|
||||
src/js/builtins/ReadableStreamBYOBReader.ts
|
||||
src/js/builtins/ReadableStreamBYOBRequest.ts
|
||||
src/js/builtins/ReadableStreamDefaultController.ts
|
||||
src/js/builtins/ReadableStreamDefaultReader.ts
|
||||
src/js/builtins/ReadableStreamInternals.ts
|
||||
src/js/builtins/shell.ts
|
||||
src/js/builtins/StreamInternals.ts
|
||||
src/js/builtins/TextDecoderStream.ts
|
||||
src/js/builtins/TextEncoderStream.ts
|
||||
src/js/builtins/TransformStream.ts
|
||||
src/js/builtins/TransformStreamDefaultController.ts
|
||||
src/js/builtins/TransformStreamInternals.ts
|
||||
src/js/builtins/UtilInspect.ts
|
||||
src/js/builtins/WritableStreamDefaultController.ts
|
||||
src/js/builtins/WritableStreamDefaultWriter.ts
|
||||
src/js/builtins/WritableStreamInternals.ts
|
||||
src/js/bun/ffi.ts
|
||||
src/js/bun/sql.ts
|
||||
src/js/bun/sqlite.ts
|
||||
src/js/internal-for-testing.ts
|
||||
src/js/internal/abort_listener.ts
|
||||
src/js/internal/assert/assertion_error.ts
|
||||
src/js/internal/assert/calltracker.ts
|
||||
src/js/internal/assert/myers_diff.ts
|
||||
src/js/internal/assert/utils.ts
|
||||
src/js/internal/buffer.ts
|
||||
src/js/internal/cluster/child.ts
|
||||
src/js/internal/cluster/isPrimary.ts
|
||||
src/js/internal/cluster/primary.ts
|
||||
src/js/internal/cluster/RoundRobinHandle.ts
|
||||
src/js/internal/cluster/Worker.ts
|
||||
src/js/internal/crypto/x509.ts
|
||||
src/js/internal/debugger.ts
|
||||
src/js/internal/errors.ts
|
||||
src/js/internal/fifo.ts
|
||||
src/js/internal/fixed_queue.ts
|
||||
src/js/internal/fs/cp-sync.ts
|
||||
src/js/internal/fs/cp.ts
|
||||
src/js/internal/fs/glob.ts
|
||||
src/js/internal/fs/streams.ts
|
||||
src/js/internal/html.ts
|
||||
src/js/internal/http.ts
|
||||
src/js/internal/http/FakeSocket.ts
|
||||
src/js/internal/linkedlist.ts
|
||||
src/js/internal/primordials.js
|
||||
src/js/internal/promisify.ts
|
||||
src/js/internal/shared.ts
|
||||
src/js/internal/stream.promises.ts
|
||||
src/js/internal/stream.ts
|
||||
src/js/internal/streams/add-abort-signal.ts
|
||||
src/js/internal/streams/compose.ts
|
||||
src/js/internal/streams/destroy.ts
|
||||
src/js/internal/streams/duplex.ts
|
||||
src/js/internal/streams/duplexify.ts
|
||||
src/js/internal/streams/duplexpair.ts
|
||||
src/js/internal/streams/end-of-stream.ts
|
||||
src/js/internal/streams/from.ts
|
||||
src/js/internal/streams/lazy_transform.ts
|
||||
src/js/internal/streams/legacy.ts
|
||||
src/js/internal/streams/native-readable.ts
|
||||
src/js/internal/streams/operators.ts
|
||||
src/js/internal/streams/passthrough.ts
|
||||
src/js/internal/streams/pipeline.ts
|
||||
src/js/internal/streams/readable.ts
|
||||
src/js/internal/streams/state.ts
|
||||
src/js/internal/streams/transform.ts
|
||||
src/js/internal/streams/utils.ts
|
||||
src/js/internal/streams/writable.ts
|
||||
src/js/internal/timers.ts
|
||||
src/js/internal/tls.ts
|
||||
src/js/internal/tty.ts
|
||||
src/js/internal/url.ts
|
||||
src/js/internal/util/colors.ts
|
||||
src/js/internal/util/inspect.d.ts
|
||||
src/js/internal/util/inspect.js
|
||||
src/js/internal/util/mime.ts
|
||||
src/js/internal/validators.ts
|
||||
src/js/internal/webstreams_adapters.ts
|
||||
src/js/node/_http_agent.ts
|
||||
src/js/node/_http_client.ts
|
||||
src/js/node/_http_common.ts
|
||||
src/js/node/_http_incoming.ts
|
||||
src/js/node/_http_outgoing.ts
|
||||
src/js/node/_http_server.ts
|
||||
src/js/node/_stream_duplex.ts
|
||||
src/js/node/_stream_passthrough.ts
|
||||
src/js/node/_stream_readable.ts
|
||||
src/js/node/_stream_transform.ts
|
||||
src/js/node/_stream_wrap.ts
|
||||
src/js/node/_stream_writable.ts
|
||||
src/js/node/_tls_common.ts
|
||||
src/js/node/assert.strict.ts
|
||||
src/js/node/assert.ts
|
||||
src/js/node/async_hooks.ts
|
||||
src/js/node/child_process.ts
|
||||
src/js/node/cluster.ts
|
||||
src/js/node/console.ts
|
||||
src/js/node/crypto.ts
|
||||
src/js/node/dgram.ts
|
||||
src/js/node/diagnostics_channel.ts
|
||||
src/js/node/dns.promises.ts
|
||||
src/js/node/dns.ts
|
||||
src/js/node/domain.ts
|
||||
src/js/node/events.ts
|
||||
src/js/node/fs.promises.ts
|
||||
src/js/node/fs.ts
|
||||
src/js/node/http.ts
|
||||
src/js/node/http2.ts
|
||||
src/js/node/https.ts
|
||||
src/js/node/inspector.ts
|
||||
src/js/node/net.ts
|
||||
src/js/node/os.ts
|
||||
src/js/node/path.posix.ts
|
||||
src/js/node/path.ts
|
||||
src/js/node/path.win32.ts
|
||||
src/js/node/perf_hooks.ts
|
||||
src/js/node/punycode.ts
|
||||
src/js/node/querystring.ts
|
||||
src/js/node/readline.promises.ts
|
||||
src/js/node/readline.ts
|
||||
src/js/node/repl.ts
|
||||
src/js/node/stream.consumers.ts
|
||||
src/js/node/stream.promises.ts
|
||||
src/js/node/stream.ts
|
||||
src/js/node/stream.web.ts
|
||||
src/js/node/test.ts
|
||||
src/js/node/timers.promises.ts
|
||||
src/js/node/timers.ts
|
||||
src/js/node/tls.ts
|
||||
src/js/node/trace_events.ts
|
||||
src/js/node/tty.ts
|
||||
src/js/node/url.ts
|
||||
src/js/node/util.ts
|
||||
src/js/node/v8.ts
|
||||
src/js/node/vm.ts
|
||||
src/js/node/wasi.ts
|
||||
src/js/node/worker_threads.ts
|
||||
src/js/node/zlib.ts
|
||||
src/js/private.d.ts
|
||||
src/js/thirdparty/isomorphic-fetch.ts
|
||||
src/js/thirdparty/node-fetch.ts
|
||||
src/js/thirdparty/undici.js
|
||||
src/js/thirdparty/vercel_fetch.js
|
||||
src/js/thirdparty/ws.js
|
||||
src/js/wasi-runner.js
|
||||
23
cmake/NodeFallbacksSources.txt
Normal file
23
cmake/NodeFallbacksSources.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
src/node-fallbacks/assert.js
|
||||
src/node-fallbacks/buffer.js
|
||||
src/node-fallbacks/console.js
|
||||
src/node-fallbacks/constants.js
|
||||
src/node-fallbacks/crypto.js
|
||||
src/node-fallbacks/domain.js
|
||||
src/node-fallbacks/events.js
|
||||
src/node-fallbacks/http.js
|
||||
src/node-fallbacks/https.js
|
||||
src/node-fallbacks/net.js
|
||||
src/node-fallbacks/os.js
|
||||
src/node-fallbacks/path.js
|
||||
src/node-fallbacks/process.js
|
||||
src/node-fallbacks/punycode.js
|
||||
src/node-fallbacks/querystring.js
|
||||
src/node-fallbacks/stream.js
|
||||
src/node-fallbacks/string_decoder.js
|
||||
src/node-fallbacks/sys.js
|
||||
src/node-fallbacks/timers.js
|
||||
src/node-fallbacks/tty.js
|
||||
src/node-fallbacks/url.js
|
||||
src/node-fallbacks/util.js
|
||||
src/node-fallbacks/zlib.js
|
||||
65
cmake/Sources.json
Normal file
65
cmake/Sources.json
Normal file
@@ -0,0 +1,65 @@
|
||||
[
|
||||
{
|
||||
"output": "BunErrorSources.txt",
|
||||
"paths": ["packages/bun-error/*.{json,ts,tsx,css}", "packages/bun-error/img/*"]
|
||||
},
|
||||
{
|
||||
"output": "NodeFallbacksSources.txt",
|
||||
"paths": ["src/node-fallbacks/*.js"]
|
||||
},
|
||||
{
|
||||
"output": "ZigGeneratedClassesSources.txt",
|
||||
"paths": ["src/bun.js/*.classes.ts", "src/bun.js/{api,node,test,webcore}/*.classes.ts"]
|
||||
},
|
||||
{
|
||||
"output": "JavaScriptSources.txt",
|
||||
"paths": ["src/js/**/*.{js,ts}"]
|
||||
},
|
||||
{
|
||||
"output": "JavaScriptCodegenSources.txt",
|
||||
"paths": ["src/codegen/*.ts"]
|
||||
},
|
||||
{
|
||||
"output": "BakeRuntimeSources.txt",
|
||||
"paths": ["src/bake/*.ts", "src/bake/*/*.{ts,css}"],
|
||||
"exclude": ["src/bake/generated.ts"]
|
||||
},
|
||||
{
|
||||
"output": "BindgenSources.txt",
|
||||
"paths": ["src/**/*.bind.ts"]
|
||||
},
|
||||
{
|
||||
"output": "ZigSources.txt",
|
||||
"paths": ["src/**/*.zig"]
|
||||
},
|
||||
{
|
||||
"output": "CxxSources.txt",
|
||||
"paths": [
|
||||
"src/io/*.cpp",
|
||||
"src/bun.js/modules/*.cpp",
|
||||
"src/bun.js/bindings/*.cpp",
|
||||
"src/bun.js/bindings/webcore/*.cpp",
|
||||
"src/bun.js/bindings/sqlite/*.cpp",
|
||||
"src/bun.js/bindings/webcrypto/*.cpp",
|
||||
"src/bun.js/bindings/webcrypto/*/*.cpp",
|
||||
"src/bun.js/bindings/node/*.cpp",
|
||||
"src/bun.js/bindings/node/crypto/*.cpp",
|
||||
"src/bun.js/bindings/v8/*.cpp",
|
||||
"src/bun.js/bindings/v8/shim/*.cpp",
|
||||
"src/bake/*.cpp",
|
||||
"src/deps/*.cpp",
|
||||
"packages/bun-usockets/src/crypto/*.cpp"
|
||||
]
|
||||
},
|
||||
{
|
||||
"output": "CSources.txt",
|
||||
"paths": [
|
||||
"packages/bun-usockets/src/*.c",
|
||||
"packages/bun-usockets/src/eventing/*.c",
|
||||
"packages/bun-usockets/src/internal/*.c",
|
||||
"packages/bun-usockets/src/crypto/*.c",
|
||||
"src/bun.js/bindings/uv-posix-polyfills.c",
|
||||
"src/bun.js/bindings/uv-posix-stubs.c"
|
||||
]
|
||||
}
|
||||
]
|
||||
23
cmake/ZigGeneratedClassesSources.txt
Normal file
23
cmake/ZigGeneratedClassesSources.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
src/bun.js/api/BunObject.classes.ts
|
||||
src/bun.js/api/crypto.classes.ts
|
||||
src/bun.js/api/ffi.classes.ts
|
||||
src/bun.js/api/filesystem_router.classes.ts
|
||||
src/bun.js/api/Glob.classes.ts
|
||||
src/bun.js/api/h2.classes.ts
|
||||
src/bun.js/api/html_rewriter.classes.ts
|
||||
src/bun.js/api/JSBundler.classes.ts
|
||||
src/bun.js/api/postgres.classes.ts
|
||||
src/bun.js/api/S3Client.classes.ts
|
||||
src/bun.js/api/S3Stat.classes.ts
|
||||
src/bun.js/api/server.classes.ts
|
||||
src/bun.js/api/Shell.classes.ts
|
||||
src/bun.js/api/ShellArgs.classes.ts
|
||||
src/bun.js/api/sockets.classes.ts
|
||||
src/bun.js/api/streams.classes.ts
|
||||
src/bun.js/api/valkey.classes.ts
|
||||
src/bun.js/api/zlib.classes.ts
|
||||
src/bun.js/node/node.classes.ts
|
||||
src/bun.js/resolve_message.classes.ts
|
||||
src/bun.js/test/jest.classes.ts
|
||||
src/bun.js/webcore/encoding.classes.ts
|
||||
src/bun.js/webcore/response.classes.ts
|
||||
610
cmake/ZigSources.txt
Normal file
610
cmake/ZigSources.txt
Normal file
@@ -0,0 +1,610 @@
|
||||
src/allocators.zig
|
||||
src/allocators/AllocationScope.zig
|
||||
src/allocators/linux_memfd_allocator.zig
|
||||
src/allocators/max_heap_allocator.zig
|
||||
src/allocators/memory_allocator.zig
|
||||
src/allocators/MemoryReportingAllocator.zig
|
||||
src/allocators/mimalloc_arena.zig
|
||||
src/allocators/mimalloc.zig
|
||||
src/allocators/NullableAllocator.zig
|
||||
src/analytics/analytics_schema.zig
|
||||
src/analytics/analytics_thread.zig
|
||||
src/api/schema.zig
|
||||
src/ast/base.zig
|
||||
src/async/posix_event_loop.zig
|
||||
src/async/stub_event_loop.zig
|
||||
src/async/windows_event_loop.zig
|
||||
src/baby_list.zig
|
||||
src/bake/bake.zig
|
||||
src/bake/DevServer.zig
|
||||
src/bake/FrameworkRouter.zig
|
||||
src/bake/production.zig
|
||||
src/base64/base64.zig
|
||||
src/bit_set.zig
|
||||
src/bits.zig
|
||||
src/boringssl.zig
|
||||
src/brotli.zig
|
||||
src/btjs.zig
|
||||
src/bun_js.zig
|
||||
src/bun.js/api.zig
|
||||
src/bun.js/api/bun/dns_resolver.zig
|
||||
src/bun.js/api/bun/h2_frame_parser.zig
|
||||
src/bun.js/api/bun/lshpack.zig
|
||||
src/bun.js/api/bun/process.zig
|
||||
src/bun.js/api/bun/socket.zig
|
||||
src/bun.js/api/bun/socket/SocketAddress.zig
|
||||
src/bun.js/api/bun/spawn.zig
|
||||
src/bun.js/api/bun/spawn/stdio.zig
|
||||
src/bun.js/api/bun/ssl_wrapper.zig
|
||||
src/bun.js/api/bun/subprocess.zig
|
||||
src/bun.js/api/bun/udp_socket.zig
|
||||
src/bun.js/api/bun/x509.zig
|
||||
src/bun.js/api/BunObject.zig
|
||||
src/bun.js/api/crypto.zig
|
||||
src/bun.js/api/crypto/CryptoHasher.zig
|
||||
src/bun.js/api/crypto/EVP.zig
|
||||
src/bun.js/api/crypto/HMAC.zig
|
||||
src/bun.js/api/crypto/PasswordObject.zig
|
||||
src/bun.js/api/crypto/PBKDF2.zig
|
||||
src/bun.js/api/ffi.zig
|
||||
src/bun.js/api/FFIObject.zig
|
||||
src/bun.js/api/filesystem_router.zig
|
||||
src/bun.js/api/glob.zig
|
||||
src/bun.js/api/HashObject.zig
|
||||
src/bun.js/api/html_rewriter.zig
|
||||
src/bun.js/api/JSBundler.zig
|
||||
src/bun.js/api/JSTranspiler.zig
|
||||
src/bun.js/api/server.zig
|
||||
src/bun.js/api/server/HTMLBundle.zig
|
||||
src/bun.js/api/server/InspectorBunFrontendDevServerAgent.zig
|
||||
src/bun.js/api/server/NodeHTTPResponse.zig
|
||||
src/bun.js/api/server/ServerWebSocket.zig
|
||||
src/bun.js/api/server/StaticRoute.zig
|
||||
src/bun.js/api/streams.classes.zig
|
||||
src/bun.js/api/Timer.zig
|
||||
src/bun.js/api/TOMLObject.zig
|
||||
src/bun.js/api/UnsafeObject.zig
|
||||
src/bun.js/bindgen_test.zig
|
||||
src/bun.js/bindings/AbortSignal.zig
|
||||
src/bun.js/bindings/AnyPromise.zig
|
||||
src/bun.js/bindings/bun-simdutf.zig
|
||||
src/bun.js/bindings/CachedBytecode.zig
|
||||
src/bun.js/bindings/CallFrame.zig
|
||||
src/bun.js/bindings/codegen.zig
|
||||
src/bun.js/bindings/CommonAbortReason.zig
|
||||
src/bun.js/bindings/CommonStrings.zig
|
||||
src/bun.js/bindings/CPUFeatures.zig
|
||||
src/bun.js/bindings/CustomGetterSetter.zig
|
||||
src/bun.js/bindings/DeferredError.zig
|
||||
src/bun.js/bindings/DOMFormData.zig
|
||||
src/bun.js/bindings/DOMURL.zig
|
||||
src/bun.js/bindings/EncodedJSValue.zig
|
||||
src/bun.js/bindings/Errorable.zig
|
||||
src/bun.js/bindings/ErrorCode.zig
|
||||
src/bun.js/bindings/EventType.zig
|
||||
src/bun.js/bindings/Exception.zig
|
||||
src/bun.js/bindings/FetchHeaders.zig
|
||||
src/bun.js/bindings/FFI.zig
|
||||
src/bun.js/bindings/generated_classes_list.zig
|
||||
src/bun.js/bindings/GeneratedBindings.zig
|
||||
src/bun.js/bindings/GeneratedJS2Native.zig
|
||||
src/bun.js/bindings/GetterSetter.zig
|
||||
src/bun.js/bindings/HTTPServerAgent.zig
|
||||
src/bun.js/bindings/JSArray.zig
|
||||
src/bun.js/bindings/JSArrayIterator.zig
|
||||
src/bun.js/bindings/JSBigInt.zig
|
||||
src/bun.js/bindings/JSCell.zig
|
||||
src/bun.js/bindings/JSErrorCode.zig
|
||||
src/bun.js/bindings/JSFunction.zig
|
||||
src/bun.js/bindings/JSGlobalObject.zig
|
||||
src/bun.js/bindings/JSInternalPromise.zig
|
||||
src/bun.js/bindings/JSMap.zig
|
||||
src/bun.js/bindings/JSModuleLoader.zig
|
||||
src/bun.js/bindings/JSObject.zig
|
||||
src/bun.js/bindings/JSPromise.zig
|
||||
src/bun.js/bindings/JSPromiseRejectionOperation.zig
|
||||
src/bun.js/bindings/JSPropertyIterator.zig
|
||||
src/bun.js/bindings/JSRef.zig
|
||||
src/bun.js/bindings/JSRuntimeType.zig
|
||||
src/bun.js/bindings/JSString.zig
|
||||
src/bun.js/bindings/JSUint8Array.zig
|
||||
src/bun.js/bindings/JSValue.zig
|
||||
src/bun.js/bindings/NodeModuleModule.zig
|
||||
src/bun.js/bindings/RegularExpression.zig
|
||||
src/bun.js/bindings/ResolvedSource.zig
|
||||
src/bun.js/bindings/ScriptExecutionStatus.zig
|
||||
src/bun.js/bindings/sizes.zig
|
||||
src/bun.js/bindings/SourceProvider.zig
|
||||
src/bun.js/bindings/SourceType.zig
|
||||
src/bun.js/bindings/static_export.zig
|
||||
src/bun.js/bindings/SystemError.zig
|
||||
src/bun.js/bindings/URL.zig
|
||||
src/bun.js/bindings/URLSearchParams.zig
|
||||
src/bun.js/bindings/VM.zig
|
||||
src/bun.js/bindings/WTF.zig
|
||||
src/bun.js/bindings/ZigErrorType.zig
|
||||
src/bun.js/bindings/ZigException.zig
|
||||
src/bun.js/bindings/ZigStackFrame.zig
|
||||
src/bun.js/bindings/ZigStackFrameCode.zig
|
||||
src/bun.js/bindings/ZigStackFramePosition.zig
|
||||
src/bun.js/bindings/ZigStackTrace.zig
|
||||
src/bun.js/bindings/ZigString.zig
|
||||
src/bun.js/BuildMessage.zig
|
||||
src/bun.js/config.zig
|
||||
src/bun.js/ConsoleObject.zig
|
||||
src/bun.js/Counters.zig
|
||||
src/bun.js/Debugger.zig
|
||||
src/bun.js/event_loop.zig
|
||||
src/bun.js/hot_reloader.zig
|
||||
src/bun.js/ipc.zig
|
||||
src/bun.js/javascript_core_c_api.zig
|
||||
src/bun.js/jsc.zig
|
||||
src/bun.js/jsc/array_buffer.zig
|
||||
src/bun.js/jsc/dom_call.zig
|
||||
src/bun.js/jsc/host_fn.zig
|
||||
src/bun.js/jsc/RefString.zig
|
||||
src/bun.js/ModuleLoader.zig
|
||||
src/bun.js/node.zig
|
||||
src/bun.js/node/assert/myers_diff.zig
|
||||
src/bun.js/node/buffer.zig
|
||||
src/bun.js/node/dir_iterator.zig
|
||||
src/bun.js/node/fs_events.zig
|
||||
src/bun.js/node/net/BlockList.zig
|
||||
src/bun.js/node/node_assert_binding.zig
|
||||
src/bun.js/node/node_assert.zig
|
||||
src/bun.js/node/node_cluster_binding.zig
|
||||
src/bun.js/node/node_crypto_binding.zig
|
||||
src/bun.js/node/node_error_binding.zig
|
||||
src/bun.js/node/node_fs_binding.zig
|
||||
src/bun.js/node/node_fs_constant.zig
|
||||
src/bun.js/node/node_fs_stat_watcher.zig
|
||||
src/bun.js/node/node_fs_watcher.zig
|
||||
src/bun.js/node/node_fs.zig
|
||||
src/bun.js/node/node_http_binding.zig
|
||||
src/bun.js/node/node_net_binding.zig
|
||||
src/bun.js/node/node_os.zig
|
||||
src/bun.js/node/node_process.zig
|
||||
src/bun.js/node/node_util_binding.zig
|
||||
src/bun.js/node/node_zlib_binding.zig
|
||||
src/bun.js/node/nodejs_error_code.zig
|
||||
src/bun.js/node/os/constants.zig
|
||||
src/bun.js/node/path_watcher.zig
|
||||
src/bun.js/node/path.zig
|
||||
src/bun.js/node/Stat.zig
|
||||
src/bun.js/node/StatFS.zig
|
||||
src/bun.js/node/time_like.zig
|
||||
src/bun.js/node/types.zig
|
||||
src/bun.js/node/util/parse_args_utils.zig
|
||||
src/bun.js/node/util/parse_args.zig
|
||||
src/bun.js/node/util/validators.zig
|
||||
src/bun.js/node/win_watcher.zig
|
||||
src/bun.js/ProcessAutoKiller.zig
|
||||
src/bun.js/rare_data.zig
|
||||
src/bun.js/ResolveMessage.zig
|
||||
src/bun.js/RuntimeTranspilerCache.zig
|
||||
src/bun.js/SavedSourceMap.zig
|
||||
src/bun.js/Strong.zig
|
||||
src/bun.js/test/diff_format.zig
|
||||
src/bun.js/test/expect.zig
|
||||
src/bun.js/test/jest.zig
|
||||
src/bun.js/test/pretty_format.zig
|
||||
src/bun.js/test/snapshot.zig
|
||||
src/bun.js/test/test.zig
|
||||
src/bun.js/unbounded_queue.zig
|
||||
src/bun.js/uuid.zig
|
||||
src/bun.js/virtual_machine_exports.zig
|
||||
src/bun.js/VirtualMachine.zig
|
||||
src/bun.js/Weak.zig
|
||||
src/bun.js/web_worker.zig
|
||||
src/bun.js/webcore.zig
|
||||
src/bun.js/webcore/ArrayBufferSink.zig
|
||||
src/bun.js/webcore/AutoFlusher.zig
|
||||
src/bun.js/webcore/Blob.zig
|
||||
src/bun.js/webcore/blob/copy_file.zig
|
||||
src/bun.js/webcore/blob/read_file.zig
|
||||
src/bun.js/webcore/blob/Store.zig
|
||||
src/bun.js/webcore/blob/write_file.zig
|
||||
src/bun.js/webcore/Body.zig
|
||||
src/bun.js/webcore/ByteBlobLoader.zig
|
||||
src/bun.js/webcore/ByteStream.zig
|
||||
src/bun.js/webcore/CookieMap.zig
|
||||
src/bun.js/webcore/Crypto.zig
|
||||
src/bun.js/webcore/encoding.zig
|
||||
src/bun.js/webcore/EncodingLabel.zig
|
||||
src/bun.js/webcore/fetch.zig
|
||||
src/bun.js/webcore/FileReader.zig
|
||||
src/bun.js/webcore/FileSink.zig
|
||||
src/bun.js/webcore/ObjectURLRegistry.zig
|
||||
src/bun.js/webcore/prompt.zig
|
||||
src/bun.js/webcore/ReadableStream.zig
|
||||
src/bun.js/webcore/Request.zig
|
||||
src/bun.js/webcore/Response.zig
|
||||
src/bun.js/webcore/S3Client.zig
|
||||
src/bun.js/webcore/S3File.zig
|
||||
src/bun.js/webcore/S3Stat.zig
|
||||
src/bun.js/webcore/Sink.zig
|
||||
src/bun.js/webcore/streams.zig
|
||||
src/bun.js/webcore/TextDecoder.zig
|
||||
src/bun.js/webcore/TextEncoder.zig
|
||||
src/bun.js/webcore/TextEncoderStreamEncoder.zig
|
||||
src/bun.js/WTFTimer.zig
|
||||
src/bun.zig
|
||||
src/bundler/bundle_v2.zig
|
||||
src/bundler/entry_points.zig
|
||||
src/bunfig.zig
|
||||
src/cache.zig
|
||||
src/ci_info.zig
|
||||
src/cli.zig
|
||||
src/cli/add_command.zig
|
||||
src/cli/add_completions.zig
|
||||
src/cli/build_command.zig
|
||||
src/cli/bunx_command.zig
|
||||
src/cli/colon_list_type.zig
|
||||
src/cli/create_command.zig
|
||||
src/cli/discord_command.zig
|
||||
src/cli/exec_command.zig
|
||||
src/cli/filter_arg.zig
|
||||
src/cli/filter_run.zig
|
||||
src/cli/init_command.zig
|
||||
src/cli/install_command.zig
|
||||
src/cli/install_completions_command.zig
|
||||
src/cli/link_command.zig
|
||||
src/cli/list-of-yarn-commands.zig
|
||||
src/cli/outdated_command.zig
|
||||
src/cli/pack_command.zig
|
||||
src/cli/package_manager_command.zig
|
||||
src/cli/patch_command.zig
|
||||
src/cli/patch_commit_command.zig
|
||||
src/cli/pm_trusted_command.zig
|
||||
src/cli/publish_command.zig
|
||||
src/cli/remove_command.zig
|
||||
src/cli/run_command.zig
|
||||
src/cli/shell_completions.zig
|
||||
src/cli/test_command.zig
|
||||
src/cli/test/Scanner.zig
|
||||
src/cli/unlink_command.zig
|
||||
src/cli/update_command.zig
|
||||
src/cli/upgrade_command.zig
|
||||
src/codegen/process_windows_translate_c.zig
|
||||
src/compile_target.zig
|
||||
src/comptime_string_map.zig
|
||||
src/copy_file.zig
|
||||
src/crash_handler.zig
|
||||
src/create/SourceFileProjectGenerator.zig
|
||||
src/csrf.zig
|
||||
src/css_scanner.zig
|
||||
src/css/compat.zig
|
||||
src/css/context.zig
|
||||
src/css/css_internals.zig
|
||||
src/css/css_modules.zig
|
||||
src/css/css_parser.zig
|
||||
src/css/declaration.zig
|
||||
src/css/dependencies.zig
|
||||
src/css/error.zig
|
||||
src/css/generics.zig
|
||||
src/css/logical.zig
|
||||
src/css/media_query.zig
|
||||
src/css/prefixes.zig
|
||||
src/css/printer.zig
|
||||
src/css/properties/align.zig
|
||||
src/css/properties/animation.zig
|
||||
src/css/properties/background.zig
|
||||
src/css/properties/border_image.zig
|
||||
src/css/properties/border_radius.zig
|
||||
src/css/properties/border.zig
|
||||
src/css/properties/box_shadow.zig
|
||||
src/css/properties/contain.zig
|
||||
src/css/properties/css_modules.zig
|
||||
src/css/properties/custom.zig
|
||||
src/css/properties/display.zig
|
||||
src/css/properties/effects.zig
|
||||
src/css/properties/flex.zig
|
||||
src/css/properties/font.zig
|
||||
src/css/properties/grid.zig
|
||||
src/css/properties/list.zig
|
||||
src/css/properties/margin_padding.zig
|
||||
src/css/properties/masking.zig
|
||||
src/css/properties/outline.zig
|
||||
src/css/properties/overflow.zig
|
||||
src/css/properties/position.zig
|
||||
src/css/properties/prefix_handler.zig
|
||||
src/css/properties/properties_generated.zig
|
||||
src/css/properties/properties_impl.zig
|
||||
src/css/properties/properties.zig
|
||||
src/css/properties/shape.zig
|
||||
src/css/properties/size.zig
|
||||
src/css/properties/svg.zig
|
||||
src/css/properties/text.zig
|
||||
src/css/properties/transform.zig
|
||||
src/css/properties/transition.zig
|
||||
src/css/properties/ui.zig
|
||||
src/css/rules/container.zig
|
||||
src/css/rules/counter_style.zig
|
||||
src/css/rules/custom_media.zig
|
||||
src/css/rules/document.zig
|
||||
src/css/rules/font_face.zig
|
||||
src/css/rules/font_palette_values.zig
|
||||
src/css/rules/import.zig
|
||||
src/css/rules/keyframes.zig
|
||||
src/css/rules/layer.zig
|
||||
src/css/rules/media.zig
|
||||
src/css/rules/namespace.zig
|
||||
src/css/rules/nesting.zig
|
||||
src/css/rules/page.zig
|
||||
src/css/rules/property.zig
|
||||
src/css/rules/rules.zig
|
||||
src/css/rules/scope.zig
|
||||
src/css/rules/starting_style.zig
|
||||
src/css/rules/style.zig
|
||||
src/css/rules/supports.zig
|
||||
src/css/rules/tailwind.zig
|
||||
src/css/rules/unknown.zig
|
||||
src/css/rules/viewport.zig
|
||||
src/css/selectors/builder.zig
|
||||
src/css/selectors/parser.zig
|
||||
src/css/selectors/selector.zig
|
||||
src/css/small_list.zig
|
||||
src/css/sourcemap.zig
|
||||
src/css/targets.zig
|
||||
src/css/values/alpha.zig
|
||||
src/css/values/angle.zig
|
||||
src/css/values/calc.zig
|
||||
src/css/values/color_generated.zig
|
||||
src/css/values/color_js.zig
|
||||
src/css/values/color.zig
|
||||
src/css/values/css_string.zig
|
||||
src/css/values/easing.zig
|
||||
src/css/values/gradient.zig
|
||||
src/css/values/ident.zig
|
||||
src/css/values/image.zig
|
||||
src/css/values/length.zig
|
||||
src/css/values/number.zig
|
||||
src/css/values/percentage.zig
|
||||
src/css/values/position.zig
|
||||
src/css/values/ratio.zig
|
||||
src/css/values/rect.zig
|
||||
src/css/values/resolution.zig
|
||||
src/css/values/size.zig
|
||||
src/css/values/syntax.zig
|
||||
src/css/values/time.zig
|
||||
src/css/values/url.zig
|
||||
src/css/values/values.zig
|
||||
src/darwin.zig
|
||||
src/defines-table.zig
|
||||
src/defines.zig
|
||||
src/deps/boringssl.translated.zig
|
||||
src/deps/brotli_c.zig
|
||||
src/deps/c_ares.zig
|
||||
src/deps/diffz/DiffMatchPatch.zig
|
||||
src/deps/libdeflate.zig
|
||||
src/deps/libuv.zig
|
||||
src/deps/lol-html.zig
|
||||
src/deps/picohttp.zig
|
||||
src/deps/picohttpparser.zig
|
||||
src/deps/tcc.zig
|
||||
src/deps/uws.zig
|
||||
src/deps/uws/socket.zig
|
||||
src/deps/zig-clap/clap.zig
|
||||
src/deps/zig-clap/clap/args.zig
|
||||
src/deps/zig-clap/clap/comptime.zig
|
||||
src/deps/zig-clap/clap/streaming.zig
|
||||
src/deps/zlib.posix.zig
|
||||
src/deps/zlib.shared.zig
|
||||
src/deps/zlib.win32.zig
|
||||
src/deps/zstd.zig
|
||||
src/dir.zig
|
||||
src/dns.zig
|
||||
src/env_loader.zig
|
||||
src/env.zig
|
||||
src/errno/darwin_errno.zig
|
||||
src/errno/linux_errno.zig
|
||||
src/errno/windows_errno.zig
|
||||
src/exact_size_matcher.zig
|
||||
src/fd.zig
|
||||
src/feature_flags.zig
|
||||
src/fmt.zig
|
||||
src/fs.zig
|
||||
src/futex.zig
|
||||
src/generated_perf_trace_events.zig
|
||||
src/generated_versions_list.zig
|
||||
src/glob.zig
|
||||
src/glob/GlobWalker.zig
|
||||
src/glob/match.zig
|
||||
src/Global.zig
|
||||
src/grapheme.zig
|
||||
src/heap_breakdown.zig
|
||||
src/highway.zig
|
||||
src/hive_array.zig
|
||||
src/hmac.zig
|
||||
src/HTMLScanner.zig
|
||||
src/http.zig
|
||||
src/http/header_builder.zig
|
||||
src/http/method.zig
|
||||
src/http/mime_type.zig
|
||||
src/http/url_path.zig
|
||||
src/http/websocket_client.zig
|
||||
src/http/websocket_client/CppWebSocket.zig
|
||||
src/http/websocket_client/WebSocketUpgradeClient.zig
|
||||
src/http/websocket_http_client.zig
|
||||
src/http/websocket.zig
|
||||
src/http/zlib.zig
|
||||
src/identity_context.zig
|
||||
src/import_record.zig
|
||||
src/ini.zig
|
||||
src/install/bin.zig
|
||||
src/install/bun.lock.zig
|
||||
src/install/dependency.zig
|
||||
src/install/extract_tarball.zig
|
||||
src/install/install.zig
|
||||
src/install/integrity.zig
|
||||
src/install/lifecycle_script_runner.zig
|
||||
src/install/lockfile.zig
|
||||
src/install/migration.zig
|
||||
src/install/npm.zig
|
||||
src/install/padding_checker.zig
|
||||
src/install/patch_install.zig
|
||||
src/install/repository.zig
|
||||
src/install/resolution.zig
|
||||
src/install/resolvers/folder_resolver.zig
|
||||
src/install/versioned_url.zig
|
||||
src/install/windows-shim/BinLinkingShim.zig
|
||||
src/install/windows-shim/bun_shim_impl.zig
|
||||
src/io/heap.zig
|
||||
src/io/io.zig
|
||||
src/io/MaxBuf.zig
|
||||
src/io/PipeReader.zig
|
||||
src/io/pipes.zig
|
||||
src/io/PipeWriter.zig
|
||||
src/io/source.zig
|
||||
src/io/time.zig
|
||||
src/js_ast.zig
|
||||
src/js_lexer_tables.zig
|
||||
src/js_lexer.zig
|
||||
src/js_lexer/identifier.zig
|
||||
src/js_parser.zig
|
||||
src/js_printer.zig
|
||||
src/jsc_stub.zig
|
||||
src/json_parser.zig
|
||||
src/libarchive/libarchive-bindings.zig
|
||||
src/libarchive/libarchive.zig
|
||||
src/linear_fifo.zig
|
||||
src/linker.zig
|
||||
src/linux.zig
|
||||
src/logger.zig
|
||||
src/macho.zig
|
||||
src/main_test.zig
|
||||
src/main_wasm.zig
|
||||
src/main.zig
|
||||
src/meta.zig
|
||||
src/multi_array_list.zig
|
||||
src/Mutex.zig
|
||||
src/napi/napi.zig
|
||||
src/node_fallbacks.zig
|
||||
src/open.zig
|
||||
src/options.zig
|
||||
src/output.zig
|
||||
src/OutputFile.zig
|
||||
src/patch.zig
|
||||
src/perf.zig
|
||||
src/pool.zig
|
||||
src/Progress.zig
|
||||
src/ptr.zig
|
||||
src/ptr/Cow.zig
|
||||
src/ptr/CowSlice.zig
|
||||
src/ptr/ref_count.zig
|
||||
src/ptr/tagged_pointer.zig
|
||||
src/ptr/weak_ptr.zig
|
||||
src/renamer.zig
|
||||
src/resolver/data_url.zig
|
||||
src/resolver/dir_info.zig
|
||||
src/resolver/package_json.zig
|
||||
src/resolver/resolve_path.zig
|
||||
src/resolver/resolver.zig
|
||||
src/resolver/tsconfig_json.zig
|
||||
src/result.zig
|
||||
src/router.zig
|
||||
src/runtime.zig
|
||||
src/s3/acl.zig
|
||||
src/s3/client.zig
|
||||
src/s3/credentials.zig
|
||||
src/s3/download_stream.zig
|
||||
src/s3/error.zig
|
||||
src/s3/list_objects.zig
|
||||
src/s3/multipart_options.zig
|
||||
src/s3/multipart.zig
|
||||
src/s3/simple_request.zig
|
||||
src/s3/storage_class.zig
|
||||
src/semver.zig
|
||||
src/semver/ExternalString.zig
|
||||
src/semver/SemverObject.zig
|
||||
src/semver/SemverQuery.zig
|
||||
src/semver/SemverRange.zig
|
||||
src/semver/SemverString.zig
|
||||
src/semver/SlicedString.zig
|
||||
src/semver/Version.zig
|
||||
src/sha.zig
|
||||
src/shell/braces.zig
|
||||
src/shell/Builtin.zig
|
||||
src/shell/builtin/basename.zig
|
||||
src/shell/builtin/cat.zig
|
||||
src/shell/builtin/cd.zig
|
||||
src/shell/builtin/cp.zig
|
||||
src/shell/builtin/dirname.zig
|
||||
src/shell/builtin/echo.zig
|
||||
src/shell/builtin/exit.zig
|
||||
src/shell/builtin/export.zig
|
||||
src/shell/builtin/false.zig
|
||||
src/shell/builtin/ls.zig
|
||||
src/shell/builtin/mkdir.zig
|
||||
src/shell/builtin/mv.zig
|
||||
src/shell/builtin/pwd.zig
|
||||
src/shell/builtin/rm.zig
|
||||
src/shell/builtin/seq.zig
|
||||
src/shell/builtin/touch.zig
|
||||
src/shell/builtin/true.zig
|
||||
src/shell/builtin/which.zig
|
||||
src/shell/builtin/yes.zig
|
||||
src/shell/EnvMap.zig
|
||||
src/shell/EnvStr.zig
|
||||
src/shell/interpreter.zig
|
||||
src/shell/IOWriter.zig
|
||||
src/shell/ParsedShellScript.zig
|
||||
src/shell/RefCountedStr.zig
|
||||
src/shell/shell.zig
|
||||
src/shell/subproc.zig
|
||||
src/shell/util.zig
|
||||
src/sourcemap/CodeCoverage.zig
|
||||
src/sourcemap/LineOffsetTable.zig
|
||||
src/sourcemap/sourcemap.zig
|
||||
src/sourcemap/VLQ.zig
|
||||
src/sql/DataCell.zig
|
||||
src/sql/postgres.zig
|
||||
src/sql/postgres/postgres_protocol.zig
|
||||
src/sql/postgres/postgres_types.zig
|
||||
src/StandaloneModuleGraph.zig
|
||||
src/StaticHashMap.zig
|
||||
src/string_immutable.zig
|
||||
src/string_types.zig
|
||||
src/string.zig
|
||||
src/string/HashedString.zig
|
||||
src/string/MutableString.zig
|
||||
src/string/PathString.zig
|
||||
src/string/SmolStr.zig
|
||||
src/string/StringBuilder.zig
|
||||
src/string/StringJoiner.zig
|
||||
src/string/WTFStringImpl.zig
|
||||
src/sync.zig
|
||||
src/sys_uv.zig
|
||||
src/sys.zig
|
||||
src/system_timer.zig
|
||||
src/test/fixtures.zig
|
||||
src/test/recover.zig
|
||||
src/thread_pool.zig
|
||||
src/tmp.zig
|
||||
src/toml/toml_lexer.zig
|
||||
src/toml/toml_parser.zig
|
||||
src/tracy.zig
|
||||
src/trait.zig
|
||||
src/transpiler.zig
|
||||
src/unit_test.zig
|
||||
src/url.zig
|
||||
src/util.zig
|
||||
src/valkey/index.zig
|
||||
src/valkey/js_valkey_functions.zig
|
||||
src/valkey/js_valkey.zig
|
||||
src/valkey/valkey_protocol.zig
|
||||
src/valkey/valkey.zig
|
||||
src/valkey/ValkeyCommand.zig
|
||||
src/valkey/ValkeyContext.zig
|
||||
src/walker_skippable.zig
|
||||
src/Watcher.zig
|
||||
src/watcher/INotifyWatcher.zig
|
||||
src/watcher/KEventWatcher.zig
|
||||
src/watcher/WindowsWatcher.zig
|
||||
src/which_npm_client.zig
|
||||
src/which.zig
|
||||
src/windows.zig
|
||||
src/work_pool.zig
|
||||
src/workaround_missing_symbols.zig
|
||||
src/wyhash.zig
|
||||
src/zlib.zig
|
||||
35
cmake/scripts/PathUtils.cmake
Normal file
35
cmake/scripts/PathUtils.cmake
Normal file
@@ -0,0 +1,35 @@
|
||||
# Function to convert relative paths from a file to absolute paths
|
||||
# Usage: absolute_sources(OUTPUT_VAR INPUT_FILE [BASE_DIR])
|
||||
# OUTPUT_VAR: Variable name to store the resulting absolute paths
|
||||
# INPUT_FILE: File containing relative paths (one per line)
|
||||
# BASE_DIR: Optional base directory for resolving paths (defaults to CMAKE_CURRENT_SOURCE_DIR)
|
||||
function(absolute_sources OUTPUT_VAR INPUT_FILE)
|
||||
# Check if a custom base directory was provided
|
||||
if(${ARGC} GREATER 2)
|
||||
set(BASE_DIR ${ARGV2})
|
||||
else()
|
||||
set(BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Read the file containing relative paths
|
||||
file(STRINGS "${INPUT_FILE}" RELATIVE_PATHS)
|
||||
|
||||
# Create a list to store absolute paths
|
||||
set(RESULT_LIST "")
|
||||
|
||||
# Convert each relative path to absolute
|
||||
foreach(REL_PATH ${RELATIVE_PATHS})
|
||||
# Skip empty lines
|
||||
if(NOT "${REL_PATH}" STREQUAL "")
|
||||
# Construct the absolute path
|
||||
get_filename_component(ABS_PATH "${BASE_DIR}/${REL_PATH}" ABSOLUTE)
|
||||
list(APPEND RESULT_LIST ${ABS_PATH})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# Set the output variable in the parent scope
|
||||
set(${OUTPUT_VAR} ${RESULT_LIST} PARENT_SCOPE)
|
||||
|
||||
# Tell CMake that the configuration depends on this file
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${INPUT_FILE}")
|
||||
endfunction()
|
||||
@@ -1,3 +1,5 @@
|
||||
include(PathUtils)
|
||||
|
||||
if(DEBUG)
|
||||
set(bun bun-debug)
|
||||
elseif(ENABLE_ASAN)
|
||||
@@ -44,13 +46,7 @@ endif()
|
||||
|
||||
set(BUN_ERROR_SOURCE ${CWD}/packages/bun-error)
|
||||
|
||||
file(GLOB BUN_ERROR_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${BUN_ERROR_SOURCE}/*.json
|
||||
${BUN_ERROR_SOURCE}/*.ts
|
||||
${BUN_ERROR_SOURCE}/*.tsx
|
||||
${BUN_ERROR_SOURCE}/*.css
|
||||
${BUN_ERROR_SOURCE}/img/*
|
||||
)
|
||||
absolute_sources(BUN_ERROR_SOURCES ${CWD}/cmake/BunErrorSources.txt)
|
||||
|
||||
set(BUN_ERROR_OUTPUT ${CODEGEN_PATH}/bun-error)
|
||||
set(BUN_ERROR_OUTPUTS
|
||||
@@ -139,9 +135,7 @@ register_command(
|
||||
|
||||
set(BUN_NODE_FALLBACKS_SOURCE ${CWD}/src/node-fallbacks)
|
||||
|
||||
file(GLOB BUN_NODE_FALLBACKS_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${BUN_NODE_FALLBACKS_SOURCE}/*.js
|
||||
)
|
||||
absolute_sources(BUN_NODE_FALLBACKS_SOURCES ${CWD}/cmake/NodeFallbacksSources.txt)
|
||||
|
||||
set(BUN_NODE_FALLBACKS_OUTPUT ${CODEGEN_PATH}/node-fallbacks)
|
||||
set(BUN_NODE_FALLBACKS_OUTPUTS)
|
||||
@@ -241,13 +235,7 @@ register_command(
|
||||
|
||||
set(BUN_ZIG_GENERATED_CLASSES_SCRIPT ${CWD}/src/codegen/generate-classes.ts)
|
||||
|
||||
file(GLOB BUN_ZIG_GENERATED_CLASSES_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/bun.js/*.classes.ts
|
||||
${CWD}/src/bun.js/api/*.classes.ts
|
||||
${CWD}/src/bun.js/node/*.classes.ts
|
||||
${CWD}/src/bun.js/test/*.classes.ts
|
||||
${CWD}/src/bun.js/webcore/*.classes.ts
|
||||
)
|
||||
absolute_sources(BUN_ZIG_GENERATED_CLASSES_SOURCES ${CWD}/cmake/ZigGeneratedClassesSources.txt)
|
||||
|
||||
set(BUN_ZIG_GENERATED_CLASSES_OUTPUTS
|
||||
${CODEGEN_PATH}/ZigGeneratedClasses.h
|
||||
@@ -280,14 +268,8 @@ register_command(
|
||||
|
||||
set(BUN_JAVASCRIPT_CODEGEN_SCRIPT ${CWD}/src/codegen/bundle-modules.ts)
|
||||
|
||||
file(GLOB_RECURSE BUN_JAVASCRIPT_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/js/*.js
|
||||
${CWD}/src/js/*.ts
|
||||
)
|
||||
|
||||
file(GLOB BUN_JAVASCRIPT_CODEGEN_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/codegen/*.ts
|
||||
)
|
||||
absolute_sources(BUN_JAVASCRIPT_SOURCES ${CWD}/cmake/JavaScriptSources.txt)
|
||||
absolute_sources(BUN_JAVASCRIPT_CODEGEN_SOURCES ${CWD}/cmake/JavaScriptCodegenSources.txt)
|
||||
|
||||
list(APPEND BUN_JAVASCRIPT_CODEGEN_SOURCES
|
||||
${CWD}/src/bun.js/bindings/InternalModuleRegistry.cpp
|
||||
@@ -329,11 +311,7 @@ register_command(
|
||||
|
||||
set(BUN_BAKE_RUNTIME_CODEGEN_SCRIPT ${CWD}/src/codegen/bake-codegen.ts)
|
||||
|
||||
file(GLOB_RECURSE BUN_BAKE_RUNTIME_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/bake/*.ts
|
||||
${CWD}/src/bake/*/*.ts
|
||||
${CWD}/src/bake/*/*.css
|
||||
)
|
||||
absolute_sources(BUN_BAKE_RUNTIME_SOURCES ${CWD}/cmake/BakeRuntimeSources.txt)
|
||||
|
||||
list(APPEND BUN_BAKE_RUNTIME_CODEGEN_SOURCES
|
||||
${CWD}/src/bun.js/bindings/InternalModuleRegistry.cpp
|
||||
@@ -366,9 +344,7 @@ register_command(
|
||||
|
||||
set(BUN_BINDGEN_SCRIPT ${CWD}/src/codegen/bindgen.ts)
|
||||
|
||||
file(GLOB_RECURSE BUN_BINDGEN_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/**/*.bind.ts
|
||||
)
|
||||
absolute_sources(BUN_BINDGEN_SOURCES ${CWD}/cmake/BindgenSources.txt)
|
||||
|
||||
set(BUN_BINDGEN_CPP_OUTPUTS
|
||||
${CODEGEN_PATH}/GeneratedBindings.cpp
|
||||
@@ -525,9 +501,7 @@ WEBKIT_ADD_SOURCE_DEPENDENCIES(
|
||||
|
||||
# --- Zig ---
|
||||
|
||||
file(GLOB_RECURSE BUN_ZIG_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/*.zig
|
||||
)
|
||||
absolute_sources(BUN_ZIG_SOURCES ${CWD}/cmake/ZigSources.txt)
|
||||
|
||||
list(APPEND BUN_ZIG_SOURCES
|
||||
${CWD}/build.zig
|
||||
@@ -624,31 +598,8 @@ set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "build.zig")
|
||||
set(BUN_USOCKETS_SOURCE ${CWD}/packages/bun-usockets)
|
||||
|
||||
# hand written cpp source files. Full list of "source" code (including codegen) is in BUN_CPP_SOURCES
|
||||
file(GLOB BUN_CXX_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${CWD}/src/io/*.cpp
|
||||
${CWD}/src/bun.js/modules/*.cpp
|
||||
${CWD}/src/bun.js/bindings/*.cpp
|
||||
${CWD}/src/bun.js/bindings/webcore/*.cpp
|
||||
${CWD}/src/bun.js/bindings/sqlite/*.cpp
|
||||
${CWD}/src/bun.js/bindings/webcrypto/*.cpp
|
||||
${CWD}/src/bun.js/bindings/webcrypto/*/*.cpp
|
||||
${CWD}/src/bun.js/bindings/node/*.cpp
|
||||
${CWD}/src/bun.js/bindings/node/crypto/*.cpp
|
||||
${CWD}/src/bun.js/bindings/v8/*.cpp
|
||||
${CWD}/src/bun.js/bindings/v8/shim/*.cpp
|
||||
${CWD}/src/bake/*.cpp
|
||||
${CWD}/src/deps/*.cpp
|
||||
${BUN_USOCKETS_SOURCE}/src/crypto/*.cpp
|
||||
)
|
||||
|
||||
file(GLOB BUN_C_SOURCES ${CONFIGURE_DEPENDS}
|
||||
${BUN_USOCKETS_SOURCE}/src/*.c
|
||||
${BUN_USOCKETS_SOURCE}/src/eventing/*.c
|
||||
${BUN_USOCKETS_SOURCE}/src/internal/*.c
|
||||
${BUN_USOCKETS_SOURCE}/src/crypto/*.c
|
||||
${CWD}/src/bun.js/bindings/uv-posix-polyfills.c
|
||||
${CWD}/src/bun.js/bindings/uv-posix-stubs.c
|
||||
)
|
||||
absolute_sources(BUN_CXX_SOURCES ${CWD}/cmake/CxxSources.txt)
|
||||
absolute_sources(BUN_C_SOURCES ${CWD}/cmake/CSources.txt)
|
||||
|
||||
if(WIN32)
|
||||
list(APPEND BUN_CXX_SOURCES ${CWD}/src/bun.js/bindings/windows/rescle.cpp)
|
||||
@@ -1219,9 +1170,7 @@ if(NOT BUN_CPP_ONLY)
|
||||
# ==856230==See https://github.com/google/sanitizers/issues/856 for possible workarounds.
|
||||
# the linked issue refers to very old kernels but this still happens to us on modern ones.
|
||||
# disabling ASLR to run the binary works around it
|
||||
set(TEST_BUN_COMMAND_BASE
|
||||
env BUN_DEBUG_QUIET_LOGS=1
|
||||
${BUILD_PATH}/${bunExe} --revision)
|
||||
set(TEST_BUN_COMMAND_BASE ${BUILD_PATH}/${bunExe} --revision)
|
||||
set(TEST_BUN_COMMAND_ENV_WRAP
|
||||
${CMAKE_COMMAND} -E env BUN_DEBUG_QUIET_LOGS=1)
|
||||
if (LINUX AND ENABLE_ASAN)
|
||||
|
||||
@@ -38,7 +38,11 @@ if(WIN32)
|
||||
set(MIMALLOC_LIBRARY mimalloc-static)
|
||||
endif()
|
||||
elseif(DEBUG)
|
||||
set(MIMALLOC_LIBRARY mimalloc-debug)
|
||||
if (ENABLE_ASAN)
|
||||
set(MIMALLOC_LIBRARY mimalloc-asan-debug)
|
||||
else()
|
||||
set(MIMALLOC_LIBRARY mimalloc-debug)
|
||||
endif()
|
||||
else()
|
||||
set(MIMALLOC_LIBRARY mimalloc)
|
||||
endif()
|
||||
|
||||
@@ -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 c244f567ab804c2558067d00733013c01725d824)
|
||||
set(WEBKIT_VERSION eda8b0fb4fb1aa23db9c2b00933df8b58bcdd289)
|
||||
endif()
|
||||
|
||||
string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)
|
||||
@@ -79,7 +79,10 @@ else()
|
||||
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}")
|
||||
endif()
|
||||
|
||||
if(ENABLE_ASAN AND ((APPLE AND DEBUG AND ARCH STREQUAL "aarch64") OR (LINUX AND RELEASE)))
|
||||
if(ENABLE_ASAN)
|
||||
# We cannot mix and match ASan Bun + non-ASan WebKit, or vice versa, because some WebKit classes
|
||||
# change their layout according to whether ASan is used, for example:
|
||||
# https://github.com/oven-sh/WebKit/blob/eda8b0fb4fb1aa23db9c2b00933df8b58bcdd289/Source/WTF/wtf/Vector.h#L682
|
||||
set(WEBKIT_SUFFIX "${WEBKIT_SUFFIX}-asan")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -54,7 +54,14 @@ optionx(ZIG_OBJECT_FORMAT "obj|bc" "Output file format for Zig object files" DEF
|
||||
|
||||
optionx(ZIG_LOCAL_CACHE_DIR FILEPATH "The path to local the zig cache directory" DEFAULT ${CACHE_PATH}/zig/local)
|
||||
optionx(ZIG_GLOBAL_CACHE_DIR FILEPATH "The path to the global zig cache directory" DEFAULT ${CACHE_PATH}/zig/global)
|
||||
optionx(ZIG_COMPILER_SAFE BOOL "Download a ReleaseSafe build of the Zig compiler. Only availble on macos aarch64." DEFAULT ${BUILDKITE})
|
||||
|
||||
if(CI AND CMAKE_HOST_APPLE)
|
||||
set(ZIG_COMPILER_SAFE_DEFAULT ON)
|
||||
else()
|
||||
set(ZIG_COMPILER_SAFE_DEFAULT OFF)
|
||||
endif()
|
||||
|
||||
optionx(ZIG_COMPILER_SAFE BOOL "Download a ReleaseSafe build of the Zig compiler. Only availble on macos aarch64." DEFAULT ${ZIG_COMPILER_SAFE_DEFAULT})
|
||||
|
||||
setenv(ZIG_LOCAL_CACHE_DIR ${ZIG_LOCAL_CACHE_DIR})
|
||||
setenv(ZIG_GLOBAL_CACHE_DIR ${ZIG_GLOBAL_CACHE_DIR})
|
||||
|
||||
@@ -557,6 +557,7 @@ Buffer.from(buf, 0, 10);
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
new TextDecoder().decode(buf);
|
||||
```
|
||||
@@ -638,6 +639,7 @@ Buffer.from(arr);
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
new TextDecoder().decode(arr);
|
||||
```
|
||||
@@ -716,6 +718,7 @@ Buffer.from(view.buffer, view.byteOffset, view.byteLength);
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
new TextDecoder().decode(view);
|
||||
```
|
||||
@@ -788,16 +791,21 @@ new DataView(buf.buffer, buf.byteOffset, buf.byteLength);
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
buf.toString();
|
||||
```
|
||||
|
||||
As base64:
|
||||
|
||||
```ts
|
||||
buf.toString('base64');
|
||||
buf.toString("base64");
|
||||
```
|
||||
|
||||
As hex:
|
||||
|
||||
```ts
|
||||
buf.toString('hex');
|
||||
buf.toString("hex");
|
||||
```
|
||||
|
||||
#### To `number[]`
|
||||
@@ -876,6 +884,7 @@ Buffer.from(await blob.arrayBuffer());
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
await blob.text();
|
||||
```
|
||||
@@ -962,6 +971,7 @@ Buffer.from(Bun.readableStreamToArrayBuffer(stream));
|
||||
#### To `string`
|
||||
|
||||
As UTF-8:
|
||||
|
||||
```ts
|
||||
// with Response
|
||||
await new Response(stream).text();
|
||||
|
||||
@@ -10,7 +10,7 @@ console.log(addrs);
|
||||
|
||||
## DNS caching in Bun
|
||||
|
||||
In Bun v1.1.9, we added support for DNS caching. This cache makes repeated connections to the same hosts faster.
|
||||
In Bun v1.1.9, we added support for DNS caching. This cache makes repeated connections to the same hosts faster.
|
||||
|
||||
At the time of writing, we cache up to 255 entries for a maximum of 30 seconds (each). If any connections to a host fail, we remove the entry from the cache. When multiple connections are made to the same host simultaneously, DNS lookups are deduplicated to avoid making multiple requests for the same host.
|
||||
|
||||
@@ -27,10 +27,10 @@ This cache is automatically used by:
|
||||
|
||||
Web browsers expose [`<link rel="dns-prefetch">`](https://developer.mozilla.org/en-US/docs/Web/Performance/dns-prefetch) to allow developers to prefetch DNS entries. This is useful when you know you'll need to connect to a host in the near future and want to avoid the initial DNS lookup.
|
||||
|
||||
In Bun, you can use the `dns.prefetch` API to achieve the same effect.
|
||||
In Bun, you can use the `dns.prefetch` API to achieve the same effect.
|
||||
|
||||
```ts
|
||||
import {dns} from "bun";
|
||||
import { dns } from "bun";
|
||||
|
||||
dns.prefetch("my.database-host.com", 5432);
|
||||
```
|
||||
@@ -52,7 +52,7 @@ dns.prefetch(hostname: string, port: number): void;
|
||||
Here's an example:
|
||||
|
||||
```ts
|
||||
import {dns} from "bun";
|
||||
import { dns } from "bun";
|
||||
|
||||
dns.prefetch("bun.sh", 443);
|
||||
//
|
||||
@@ -66,13 +66,13 @@ await fetch("https://bun.sh");
|
||||
**🚧** — This API is experimental and may change in the future.
|
||||
{% /callout %}
|
||||
|
||||
To get the current cache stats, you can use the `dns.getCacheStats` API.
|
||||
To get the current cache stats, you can use the `dns.getCacheStats` API.
|
||||
|
||||
This API returns an object with the following properties:
|
||||
|
||||
```ts
|
||||
{
|
||||
// Cache hits
|
||||
// Cache hits
|
||||
cacheHitsCompleted: number;
|
||||
cacheHitsInflight: number;
|
||||
cacheMisses: number;
|
||||
@@ -90,7 +90,7 @@ This API returns an object with the following properties:
|
||||
Example:
|
||||
|
||||
```ts
|
||||
import {dns} from "bun";
|
||||
import { dns } from "bun";
|
||||
|
||||
const stats = dns.getCacheStats();
|
||||
console.log(stats);
|
||||
@@ -107,7 +107,4 @@ BUN_CONFIG_DNS_TIME_TO_LIVE_SECONDS=5 bun run my-script.ts
|
||||
|
||||
#### Why is 30 seconds the default?
|
||||
|
||||
Unfortunately, the system API underneath (`getaddrinfo`) does not provide a way to get the TTL of a DNS entry. This means we have to pick a number arbitrarily. We chose 30 seconds because it's long enough to see the benefits of caching, and short enough to be unlikely to cause issues if a DNS entry changes. [Amazon Web Services recommends 5 seconds](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/jvm-ttl-dns.html) for the Java Virtual Machine, however the JVM defaults to cache indefinitely.
|
||||
|
||||
|
||||
|
||||
Unfortunately, the system API underneath (`getaddrinfo`) does not provide a way to get the TTL of a DNS entry. This means we have to pick a number arbitrarily. We chose 30 seconds because it's long enough to see the benefits of caching, and short enough to be unlikely to cause issues if a DNS entry changes. [Amazon Web Services recommends 5 seconds](https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/jvm-ttl-dns.html) for the Java Virtual Machine, however the JVM defaults to cache indefinitely.
|
||||
|
||||
@@ -67,7 +67,7 @@ Bun.stderr;
|
||||
You can delete a file by calling the `.delete()` function.
|
||||
|
||||
```ts
|
||||
await Bun.file("logs.json").delete()
|
||||
await Bun.file("logs.json").delete();
|
||||
```
|
||||
|
||||
## Writing files (`Bun.write()`)
|
||||
|
||||
@@ -638,14 +638,10 @@ const credentials = {
|
||||
await S3Client.write("my-file.txt", "Hello World");
|
||||
|
||||
// Write JSON with type
|
||||
await S3Client.write(
|
||||
"data.json",
|
||||
JSON.stringify({hello: "world"}),
|
||||
{
|
||||
...credentials,
|
||||
type: "application/json",
|
||||
}
|
||||
);
|
||||
await S3Client.write("data.json", JSON.stringify({ hello: "world" }), {
|
||||
...credentials,
|
||||
type: "application/json",
|
||||
});
|
||||
|
||||
// Write from fetch
|
||||
const res = await fetch("https://example.com/data");
|
||||
@@ -655,7 +651,7 @@ await S3Client.write("data.bin", res, credentials);
|
||||
await S3Client.write("public.html", html, {
|
||||
...credentials,
|
||||
acl: "public-read",
|
||||
type: "text/html"
|
||||
type: "text/html",
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
@@ -61,10 +61,12 @@ When using a direct `ReadableStream`, all chunk queueing is handled by the desti
|
||||
Bun also supports async generator functions as a source for `Response` and `Request`. This is an easy way to create a `ReadableStream` that fetches data from an asynchronous source.
|
||||
|
||||
```ts
|
||||
const response = new Response(async function* () {
|
||||
yield "hello";
|
||||
yield "world";
|
||||
}());
|
||||
const response = new Response(
|
||||
(async function* () {
|
||||
yield "hello";
|
||||
yield "world";
|
||||
})(),
|
||||
);
|
||||
|
||||
await response.text(); // "helloworld"
|
||||
```
|
||||
|
||||
@@ -5,15 +5,16 @@ Use Bun's UDP API to implement services with advanced real-time requirements, su
|
||||
To create a new (bound) UDP socket:
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({})
|
||||
const socket = await Bun.udpSocket({});
|
||||
console.log(socket.port); // assigned by the operating system
|
||||
```
|
||||
|
||||
Specify a port:
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({
|
||||
port: 41234
|
||||
})
|
||||
port: 41234,
|
||||
});
|
||||
console.log(socket.port); // 41234
|
||||
```
|
||||
|
||||
@@ -28,7 +29,6 @@ socket.send("Hello, world!", 41234, "127.0.0.1");
|
||||
Note that the address must be a valid IP address - `send` does not perform
|
||||
DNS resolution, as it is intended for low-latency operations.
|
||||
|
||||
|
||||
### Receive datagrams
|
||||
|
||||
When creating your socket, add a callback to specify what should be done when packets are received:
|
||||
@@ -37,11 +37,11 @@ When creating your socket, add a callback to specify what should be done when pa
|
||||
const server = await Bun.udpSocket({
|
||||
socket: {
|
||||
data(socket, buf, port, addr) {
|
||||
console.log(`message from ${addr}:${port}:`)
|
||||
console.log(`message from ${addr}:${port}:`);
|
||||
console.log(buf.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const client = await Bun.udpSocket({});
|
||||
client.send("Hello!", server.port, "127.0.0.1");
|
||||
@@ -54,29 +54,26 @@ In such cases it can be beneficial to connect the socket to that peer, which spe
|
||||
and restricts incoming packets to that peer only.
|
||||
|
||||
```ts
|
||||
|
||||
const server = await Bun.udpSocket({
|
||||
socket: {
|
||||
data(socket, buf, port, addr) {
|
||||
console.log(`message from ${addr}:${port}:`)
|
||||
console.log(`message from ${addr}:${port}:`);
|
||||
console.log(buf.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
});
|
||||
const client = await Bun.udpSocket({
|
||||
connect: {
|
||||
port: server.port,
|
||||
hostname: '127.0.0.1',
|
||||
}
|
||||
hostname: "127.0.0.1",
|
||||
},
|
||||
});
|
||||
|
||||
client.send("Hello");
|
||||
|
||||
```
|
||||
|
||||
Because connections are implemented on the operating system level, you can potentially observe performance benefits, too.
|
||||
|
||||
|
||||
### Send many packets at once using `sendMany()`
|
||||
|
||||
If you want to send a large volume of packets at once, it can make sense to batch them all together to avoid the overhead
|
||||
@@ -86,9 +83,9 @@ For an unconnected socket, `sendMany` takes an array as its only argument. Each
|
||||
The first item is the data to be sent, the second is the target port, and the last is the target address.
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({})
|
||||
const socket = await Bun.udpSocket({});
|
||||
// sends 'Hello' to 127.0.0.1:41234, and 'foo' to 1.1.1.1:53 in a single operation
|
||||
socket.sendMany(['Hello', 41234, '127.0.0.1', 'foo', 53, '1.1.1.1'])
|
||||
socket.sendMany(["Hello", 41234, "127.0.0.1", "foo", 53, "1.1.1.1"]);
|
||||
```
|
||||
|
||||
With a connected socket, `sendMany` simply takes an array, where each element represents the data to be sent to the peer.
|
||||
@@ -97,10 +94,10 @@ With a connected socket, `sendMany` simply takes an array, where each element re
|
||||
const socket = await Bun.udpSocket({
|
||||
connect: {
|
||||
port: 41234,
|
||||
hostname: 'localhost',
|
||||
}
|
||||
hostname: "localhost",
|
||||
},
|
||||
});
|
||||
socket.sendMany(['foo', 'bar', 'baz']);
|
||||
socket.sendMany(["foo", "bar", "baz"]);
|
||||
```
|
||||
|
||||
`sendMany` returns the number of packets that were successfully sent. As with `send`, `sendMany` only takes valid IP addresses
|
||||
@@ -110,16 +107,17 @@ as destinations, as it does not perform DNS resolution.
|
||||
|
||||
It may happen that a packet that you're sending does not fit into the operating system's packet buffer. You can detect that this
|
||||
has happened when:
|
||||
- `send` returns `false`
|
||||
|
||||
- `send` returns `false`
|
||||
- `sendMany` returns a number smaller than the number of packets you specified
|
||||
In this case, the `drain` socket handler will be called once the socket becomes writable again:
|
||||
In this case, the `drain` socket handler will be called once the socket becomes writable again:
|
||||
|
||||
```ts
|
||||
const socket = await Bun.udpSocket({
|
||||
socket: {
|
||||
drain(socket) {
|
||||
// continue sending data
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
@@ -1630,4 +1630,4 @@ declare class ResolveMessage {
|
||||
}
|
||||
```
|
||||
|
||||
{% bunCLIUsage command="build" /%}
|
||||
{% bunCLIUsage command="build" /%}
|
||||
|
||||
@@ -71,7 +71,7 @@ node_modules/evil/index.js:3:1 50
|
||||
Your application code can still import macros from `node_modules` and invoke them.
|
||||
|
||||
```ts
|
||||
import {macro} from "some-package" with { type: "macro" };
|
||||
import { macro } from "some-package" with { type: "macro" };
|
||||
|
||||
macro();
|
||||
```
|
||||
@@ -95,8 +95,8 @@ When shipping a library containing a macro to `npm` or another package registry,
|
||||
With this configuration, users can consume your package at runtime or at bundle-time using the same import specifier:
|
||||
|
||||
```ts
|
||||
import pkg from "my-package"; // runtime import
|
||||
import {macro} from "my-package" with { type: "macro" }; // macro import
|
||||
import pkg from "my-package"; // runtime import
|
||||
import { macro } from "my-package" with { type: "macro" }; // macro import
|
||||
```
|
||||
|
||||
The first import will resolve to `./node_modules/my-package/index.js`, while the second will be resolved by Bun's bundler to `./node_modules/my-package/index.macro.js`.
|
||||
@@ -122,7 +122,7 @@ export function returnFalse() {
|
||||
...then bundling the following file will produce an empty bundle, provided that the minify syntax option is enabled.
|
||||
|
||||
```ts
|
||||
import {returnFalse} from './returnFalse.ts' with { type: 'macro' };
|
||||
import { returnFalse } from "./returnFalse.ts" with { type: "macro" };
|
||||
|
||||
if (returnFalse()) {
|
||||
console.log("This code is eliminated");
|
||||
@@ -179,7 +179,7 @@ export function getText(url: string) {
|
||||
Macros can accept inputs, but only in limited cases. The value must be statically known. For example, the following is not allowed:
|
||||
|
||||
```ts
|
||||
import {getText} from './getText.ts' with { type: 'macro' };
|
||||
import { getText } from "./getText.ts" with { type: "macro" };
|
||||
|
||||
export function howLong() {
|
||||
// the value of `foo` cannot be statically known
|
||||
@@ -193,8 +193,8 @@ export function howLong() {
|
||||
However, if the value of `foo` is known at bundle-time (say, if it's a constant or the result of another macro) then it's allowed:
|
||||
|
||||
```ts
|
||||
import {getText} from './getText.ts' with { type: 'macro' };
|
||||
import {getFoo} from './getFoo.ts' with { type: 'macro' };
|
||||
import { getText } from "./getText.ts" with { type: "macro" };
|
||||
import { getFoo } from "./getFoo.ts" with { type: "macro" };
|
||||
|
||||
export function howLong() {
|
||||
// this works because getFoo() is statically known
|
||||
@@ -271,7 +271,9 @@ export async function extractMetaTags(url: string) {
|
||||
.on("meta", {
|
||||
element(element) {
|
||||
const name =
|
||||
element.getAttribute("name") || element.getAttribute("property") || element.getAttribute("itemprop");
|
||||
element.getAttribute("name") ||
|
||||
element.getAttribute("property") ||
|
||||
element.getAttribute("itemprop");
|
||||
|
||||
if (name) meta[name] = element.getAttribute("content");
|
||||
},
|
||||
|
||||
@@ -63,8 +63,8 @@ This will add the following to your `package.json`:
|
||||
"react": "^18.2.0", // this matches >= 18.2.0 < 19.0.0
|
||||
|
||||
// with --exact
|
||||
"react": "18.2.0" // this matches only 18.2.0 exactly
|
||||
}
|
||||
"react": "18.2.0", // this matches only 18.2.0 exactly
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -170,4 +170,4 @@ This will add the following line to your `package.json`:
|
||||
}
|
||||
```
|
||||
|
||||
{% bunCLIUsage command="add" /%}
|
||||
{% bunCLIUsage command="add" /%}
|
||||
|
||||
@@ -37,4 +37,4 @@ In addition, the `--save` flag can be used to add `cool-pkg` to the `dependencie
|
||||
}
|
||||
```
|
||||
|
||||
{% bunCLIUsage command="link" /%}
|
||||
{% bunCLIUsage command="link" /%}
|
||||
|
||||
@@ -8,4 +8,4 @@ By default, `bun patch-commit` will use the `patches` directory in the temporary
|
||||
|
||||
You can specify a different directory with the `--patches-dir` flag.
|
||||
|
||||
{% bunCLIUsage command="patch-commit" /%}
|
||||
{% bunCLIUsage command="patch-commit" /%}
|
||||
|
||||
@@ -206,4 +206,4 @@ When there is a package.json script and a file with the same name, `bun run` pri
|
||||
3. Binaries from project packages, eg `bun add eslint && bun run eslint`
|
||||
4. (`bun run` only) System commands, eg `bun run ls`
|
||||
|
||||
{% bunCLIUsage command="run" /%}
|
||||
{% bunCLIUsage command="run" /%}
|
||||
|
||||
@@ -33,4 +33,4 @@ For example, with the following `package.json`:
|
||||
- `bun update` would update to a version that matches `17.x`.
|
||||
- `bun update --latest` would update to a version that matches `18.x` or later.
|
||||
|
||||
{% bunCLIUsage command="update" /%}
|
||||
{% bunCLIUsage command="update" /%}
|
||||
|
||||
@@ -9,7 +9,7 @@ export default new Router()
|
||||
.get('/', () => new Response('Hi'));
|
||||
```
|
||||
|
||||
Stric provides support for [ArrowJS](https://www.arrow-js.com), a library for building reactive interfaces.
|
||||
Stric provides support for [ArrowJS](https://www.arrow-js.com), a library for building reactive interfaces.
|
||||
|
||||
{% codetabs %}
|
||||
|
||||
@@ -25,6 +25,7 @@ export function render() {
|
||||
// Set the path to handle
|
||||
export const path = '/';
|
||||
```
|
||||
|
||||
```ts#index.ts
|
||||
import { PageRouter } from '@stricjs/arrow';
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
name: Use Neon Postgres through Drizzle ORM
|
||||
---
|
||||
|
||||
[Neon](https://neon.tech/) is a fully managed serverless Postgres, separating compute and storage to offer features like autoscaling, branching and bottomless storage. Neon can be used from Bun directly using the `@neondatabase/serverless` driver or through an ORM like `Drizzle`.
|
||||
[Neon](https://neon.tech/) is a fully managed serverless Postgres, separating compute and storage to offer features like autoscaling, branching and bottomless storage. Neon can be used from Bun directly using the `@neondatabase/serverless` driver or through an ORM like `Drizzle`.
|
||||
|
||||
Drizzle ORM supports both a SQL-like "query builder" API and an ORM-like [Queries API](https://orm.drizzle.team/docs/rqb). Get started by creating a project directory, initializing the directory using `bun init`, and installing Drizzle and the [Neon serverless driver](https://github.com/neondatabase/serverless/).
|
||||
Drizzle ORM supports both a SQL-like "query builder" API and an ORM-like [Queries API](https://orm.drizzle.team/docs/rqb). Get started by creating a project directory, initializing the directory using `bun init`, and installing Drizzle and the [Neon serverless driver](https://github.com/neondatabase/serverless/).
|
||||
|
||||
```sh
|
||||
$ mkdir bun-drizzle-neon
|
||||
@@ -52,7 +52,7 @@ console.log(result.rows);
|
||||
|
||||
---
|
||||
|
||||
Then run `index.ts` with Bun.
|
||||
Then run `index.ts` with Bun.
|
||||
|
||||
```sh
|
||||
$ bun run index.ts
|
||||
@@ -65,7 +65,7 @@ $ bun run index.ts
|
||||
|
||||
---
|
||||
|
||||
We can define a schema for our database using Drizzle ORM primitives. Create a `schema.ts` file and add this code.
|
||||
We can define a schema for our database using Drizzle ORM primitives. Create a `schema.ts` file and add this code.
|
||||
|
||||
```ts#schema.ts
|
||||
import { pgTable, integer, serial, text, timestamp } from "drizzle-orm/pg-core";
|
||||
@@ -215,6 +215,6 @@ $ bun run index.ts
|
||||
|
||||
---
|
||||
|
||||
This example used the Neon serverless driver's SQL-over-HTTP functionality. Neon's serverless driver also exposes `Client` and `Pool` constructors to enable sessions, interactive transactions, and node-postgres compatibility. Refer to [Neon's documentation](https://neon.tech/docs/serverless/serverless-driver) for a complete overview.
|
||||
This example used the Neon serverless driver's SQL-over-HTTP functionality. Neon's serverless driver also exposes `Client` and `Pool` constructors to enable sessions, interactive transactions, and node-postgres compatibility. Refer to [Neon's documentation](https://neon.tech/docs/serverless/serverless-driver) for a complete overview.
|
||||
|
||||
Refer to the [Drizzle website](https://orm.drizzle.team/docs/overview) for more documentation on using the Drizzle ORM.
|
||||
|
||||
@@ -40,7 +40,7 @@ module.exports = {
|
||||
interpreter: "bun", // Bun interpreter
|
||||
env: {
|
||||
PATH: `${process.env.HOME}/.bun/bin:${process.env.PATH}`, // Add "~/.bun/bin/bun" to PATH
|
||||
}
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
@@ -52,9 +52,9 @@ $ cd my-app
|
||||
$ bun --bun run dev
|
||||
$ vite dev
|
||||
Forced re-optimization of dependencies
|
||||
|
||||
|
||||
VITE v5.4.10 ready in 424 ms
|
||||
|
||||
|
||||
➜ Local: http://localhost:5173/
|
||||
➜ Network: use --host to expose
|
||||
➜ press h + enter to show help
|
||||
@@ -88,7 +88,7 @@ Now, make the following changes to your `svelte.config.js`.
|
||||
// Consult https://svelte.dev/docs/kit/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
||||
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
||||
@@ -96,7 +96,7 @@ Now, make the following changes to your `svelte.config.js`.
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export default config;
|
||||
```
|
||||
|
||||
@@ -116,9 +116,9 @@ $ bun --bun run build
|
||||
✓ built in 231ms
|
||||
...
|
||||
✓ built in 899ms
|
||||
|
||||
|
||||
Run npm run preview to preview your production build locally.
|
||||
|
||||
|
||||
> Using svelte-adapter-bun
|
||||
✔ Start server with: bun ./build/index.js
|
||||
✔ done
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
name: Add a peer dependency
|
||||
---
|
||||
|
||||
|
||||
To add an npm package as a peer dependency, use the `--peer` flag.
|
||||
|
||||
```sh
|
||||
|
||||
@@ -56,4 +56,3 @@ $ bun run cli.ts --flag1 --flag2 value
|
||||
}
|
||||
[ "/path/to/bun", "/path/to/cli.ts" ]
|
||||
```
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ $ set FOO=helloworld && bun run dev
|
||||
$ $env:FOO="helloworld"; bun run dev
|
||||
```
|
||||
|
||||
{% /codetabs %}
|
||||
---
|
||||
## {% /codetabs %}
|
||||
|
||||
See [Docs > Runtime > Environment variables](https://bun.sh/docs/runtime/env) for more information on using environment variables with Bun.
|
||||
|
||||
@@ -18,7 +18,7 @@ Below is the full set of recommended `compilerOptions` for a Bun project. With t
|
||||
// Environment setup & latest features
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
@@ -34,6 +34,7 @@ Below is the full set of recommended `compilerOptions` for a Bun project. With t
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedIndexedAccess": true,
|
||||
"noImplicitOverride": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
---
|
||||
name: Using Testing Library with Bun
|
||||
---
|
||||
|
||||
You can use [Testing Library](https://testing-library.com/) with Bun's test runner.
|
||||
|
||||
---
|
||||
|
||||
As a prerequisite to using Testing Library you will need to install [Happy Dom](https://github.com/capricorn86/happy-dom). ([see Bun's Happy DOM guide for more information](https://bun.sh/guides/test/happy-dom)).
|
||||
|
||||
```sh
|
||||
@@ -17,6 +19,7 @@ Next you should install the Testing Library packages you are planning on using.
|
||||
```sh
|
||||
bun add -D @testing-library/react @testing-library/dom @testing-library/jest-dom
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Next you will need to create a preload script for Happy DOM and for Testing Library. For more details about the Happy DOM setup script see [Bun's Happy DOM guide](https://bun.sh/guides/test/happy-dom).
|
||||
@@ -26,6 +29,7 @@ import { GlobalRegistrator } from '@happy-dom/global-registrator';
|
||||
|
||||
GlobalRegistrator.register();
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
For Testing Library, you will want to extend Bun's `expect` function with Testing Library's matchers. Optionally, to better match the behavior of test-runners like Jest, you may want to run cleanup after each test.
|
||||
@@ -51,6 +55,7 @@ Next, add these preload scripts to your `bunfig.toml` (you can also have everyth
|
||||
[test]
|
||||
preload = ["./happydom.ts", "./testing-library.ts"]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
If you are using TypeScript you will also need to make use of declaration merging in order to get the new matcher types to show up in your editor. To do this, create a type declaration file that extends `Matchers` like this.
|
||||
@@ -71,15 +76,15 @@ declare module 'bun:test' {
|
||||
You should now be able to use Testing Library in your tests
|
||||
|
||||
```ts
|
||||
import { test, expect } from 'bun:test';
|
||||
import { screen, render } from '@testing-library/react';
|
||||
import { MyComponent } from './myComponent';
|
||||
import { test, expect } from "bun:test";
|
||||
import { screen, render } from "@testing-library/react";
|
||||
import { MyComponent } from "./myComponent";
|
||||
|
||||
test('Can use Testing Library', () => {
|
||||
test("Can use Testing Library", () => {
|
||||
render(MyComponent);
|
||||
const myComponent = screen.getByTestId('my-component');
|
||||
const myComponent = screen.getByTestId("my-component");
|
||||
expect(myComponent).toBeInTheDocument();
|
||||
})
|
||||
});
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -56,4 +56,4 @@ $ bun patch --commit react --patches-dir=mypatches
|
||||
$ bun patch-commit react
|
||||
```
|
||||
|
||||
{% bunCLIUsage command="patch" /%}
|
||||
{% bunCLIUsage command="patch" /%}
|
||||
|
||||
@@ -58,7 +58,7 @@ Then add the following to your `compilerOptions` in `tsconfig.json`:
|
||||
"compilerOptions": {
|
||||
"lib": ["ESNext"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"module": "Preserve",
|
||||
"moduleDetection": "force",
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
|
||||
@@ -198,7 +198,6 @@ Set path where coverage reports will be saved. Please notice, that it works only
|
||||
coverageDir = "path/to/somewhere" # default "coverage"
|
||||
```
|
||||
|
||||
|
||||
## Package manager
|
||||
|
||||
Package management is a complex issue; to support a range of use cases, the behavior of `bun install` can be configured under the `[install]` section.
|
||||
|
||||
@@ -69,7 +69,6 @@ The **`--no-clear-screen`** flag is useful in scenarios where you don’t want t
|
||||
|
||||
{% /callout %}
|
||||
|
||||
|
||||
## `--hot` mode
|
||||
|
||||
Use `bun --hot` to enable hot reloading when executing code with Bun. This is distinct from `--watch` mode in that Bun does not hard-restart the entire process. Instead, it detects code changes and updates its internal module cache with the new code.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user