├── .devcontainer
├── devcontainer.json
├── limits.conf
├── scripts
│ ├── common-debian.sh
│ ├── getting-started.sh
│ ├── github.sh
│ ├── nice.sh
│ └── zig-env.sh
├── workspace.code-workspace
└── zls.json
├── .docker
├── build-base-images.sh
├── build-base.sh
├── chrome.json
├── chromium.pref
├── copy-bun-binary.sh
├── debian.list
├── dockerfile-common.sh
├── pull.sh
├── run-dockerfile.sh
├── run-test.sh
├── runner.sh
└── unit-tests.sh
├── .dockerignore
├── .gitattributes
├── .github
├── ISSUE_TEMPLATE
│ ├── 1-bug-report.yml
│ ├── 2-feature-request.yml
│ ├── 3-api-ref-docs-problem.yml
│ └── config.yml
└── workflows
│ ├── bun-framework-next.yml
│ ├── bun-landing.yml
│ └── bun.yml
├── .gitignore
├── .gitmodules
├── .scripts
└── write-versions.sh
├── .vscode
├── c_cpp_properties.json
├── extensions.json
├── launch.json
├── settings.json
└── tasks.json
├── Dockerfile
├── Dockerfile.base
├── Dockerfile.musl
├── Makefile
├── README.md
├── bench
├── .env
├── .gitignore
├── README.md
├── async
│ ├── .env
│ ├── bun.js
│ ├── deno.js
│ ├── node.mjs
│ └── package.json
├── cat
│ ├── bun.js
│ ├── cat.mjs
│ └── node.js
├── copyfile
│ ├── bun.js
│ ├── node-streams.js
│ └── node.mjs
├── ffi
│ ├── .env
│ ├── bun.js
│ ├── deno.js
│ ├── node.mjs
│ ├── package.json
│ └── src
│ │ ├── Cargo.lock
│ │ ├── Cargo.toml
│ │ ├── build.rs
│ │ ├── bun.lockb
│ │ ├── package.json
│ │ └── src
│ │ └── lib.rs
├── gzip
│ ├── .env
│ ├── bun.js
│ ├── deno.js
│ ├── node.mjs
│ └── package.json
├── hot-module-reloading
│ ├── css-stress-test
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── README.md
│ │ ├── browser.js
│ │ ├── bun.latest.16ms.txt
│ │ ├── bun.latest.24ms.txt
│ │ ├── bun.latest.32ms.txt
│ │ ├── bun.latest.8ms.txt
│ │ ├── color-looper.emotion.zig
│ │ ├── color-looper.zig
│ │ ├── index.html
│ │ ├── inject.js
│ │ ├── next-env.d.ts
│ │ ├── next.config.js
│ │ ├── next.latest.16ms.txt
│ │ ├── next.latest.24ms.txt
│ │ ├── next.latest.32ms.txt
│ │ ├── next.latest.8ms.txt
│ │ ├── package.json
│ │ ├── pages
│ │ │ ├── _app.tsx
│ │ │ └── index.tsx
│ │ ├── react-inject.js
│ │ ├── read-frames.js
│ │ ├── run.sh
│ │ ├── src
│ │ │ ├── colors.css
│ │ │ ├── colors.css.0
│ │ │ ├── css-in-js-styles.0
│ │ │ ├── css-in-js-styles.tsx
│ │ │ ├── index.css
│ │ │ ├── index.tsx
│ │ │ └── main.tsx
│ │ ├── timings
│ │ │ └── bun-cli@0.0.34.32ms.darwin-x64.json
│ │ ├── tsconfig.json
│ │ └── vite.config.js
│ └── readme.md
├── log
│ ├── bun.js
│ ├── deno.mjs
│ └── node.mjs
├── module-loader
│ ├── .gitignore
│ ├── create.js
│ └── stub.js
├── package-lock.json
├── package.json
├── react-hello-world
│ ├── react-hello-world.deno.jsx
│ ├── react-hello-world.jsx
│ ├── react-hello-world.node.js
│ └── react-hello-world.node.jsx
├── scanner
│ ├── bun.lockb
│ ├── package.json
│ ├── remix-route.ts
│ ├── scan-imports-only.js
│ ├── scan.bun.js
│ └── scan.node-esbuild.mjs
├── snippets
│ ├── _fixture.txt
│ ├── buffer-read.js
│ ├── buffer.js
│ ├── callbacks-overhead.mjs
│ ├── concat.js
│ ├── escapeHTML.js
│ ├── exists.js
│ ├── jsx-entity-decoding.jsx
│ ├── noop.js
│ ├── performance-now-overhead.js
│ ├── react-dom-render.bun.js
│ ├── realpath.mjs
│ ├── render.js
│ └── transpiler.mjs
└── sqlite
│ ├── .env
│ ├── bun.js
│ ├── deno.js
│ ├── node.mjs
│ ├── package-lock.json
│ ├── package.json
│ └── src
│ └── download.sh
├── build-id
├── build.zig
├── bun.lockb
├── completions
├── bun.bash
├── bun.fish
├── bun.zsh
└── spec.yaml
├── docs
├── bun-flavored-toml.md
└── upgrading-webkit.md
├── entitlements.debug.plist
├── entitlements.plist
├── examples
├── .gitignore
├── .is-examples-folder
├── add.rs
├── add.ts
├── add.zig
├── blank
│ ├── package.json
│ ├── src
│ │ └── index.js
│ └── tsconfig.json
├── bun-bakery
│ ├── .gitignore
│ ├── assets
│ │ └── bunbakery.png
│ ├── main.ts
│ ├── package.json
│ ├── routes
│ │ └── index.ts
│ └── tsconfig.json
├── cat.ts
├── change-array-by-copy.js
├── discord-interactions
│ ├── .env.example
│ ├── .gitignore
│ ├── README.md
│ ├── bun_shim
│ │ ├── index.js
│ │ ├── rest.js
│ │ └── server.js
│ ├── commands
│ │ ├── context_menu
│ │ │ └── avatar.js
│ │ ├── hello.js
│ │ └── modal.ts
│ ├── gitignore
│ ├── package.json
│ ├── polyfill.js
│ └── run.js
├── hashing.js
├── hono
│ ├── package.json
│ ├── readme.md
│ ├── src
│ │ └── index.ts
│ └── tsconfig.json
├── html-rewriter.ts
├── http-file.ts
├── http-stop.ts
├── http.ts
├── lambda.ts
├── macros
│ ├── components
│ │ ├── covid19.tsx
│ │ ├── example.jsx
│ │ └── index.tsx
│ ├── example.js
│ ├── fetchCSV.tsx
│ ├── matchInFile.tsx
│ ├── now.tsx
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── styles.css
│ └── tsconfig.json
├── mmap
│ ├── 1.js
│ ├── 2.js
│ └── mmap.txt
├── next
│ ├── .eslintrc.json
│ ├── .gitignore
│ ├── .npmignore
│ ├── README.md
│ ├── bunfig.toml
│ ├── components
│ │ ├── Title.tsx
│ │ └── subtitle.tsx
│ ├── gitignore
│ ├── next-env.d.ts
│ ├── next.config.js
│ ├── package.json
│ ├── pages
│ │ ├── _app.tsx
│ │ └── index.tsx
│ ├── public
│ │ ├── favicon.ico
│ │ └── vercel.svg
│ ├── styles
│ │ ├── Home.module.css
│ │ └── globals.css
│ └── tsconfig.json
├── openInEditor.js
├── react-fast-refresh-test
│ ├── package.json
│ ├── public
│ │ └── index.html
│ ├── src
│ │ ├── button.css
│ │ ├── colors.css
│ │ ├── components
│ │ │ ├── RenderCounter.tsx
│ │ │ ├── app.tsx
│ │ │ └── button.tsx
│ │ ├── font.css
│ │ ├── index.css
│ │ ├── index.tsx
│ │ └── main.tsx
│ └── tsconfig.json
├── react
│ ├── .gitignore
│ ├── .npmignore
│ ├── README.md
│ ├── gitignore
│ ├── package.json
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src
│ │ ├── App.css
│ │ ├── App.jsx
│ │ ├── images.d.ts
│ │ ├── index.css
│ │ ├── index.jsx
│ │ └── logo.svg
├── sha.js
├── ssl.ts
└── tsconfig.json
├── misctools
├── .gitignore
├── features.zig
├── fetch.zig
├── find-unused-zig.sh
├── gen-unicode-table.js
├── generate-tests-file.sh
├── headers-cleaner.js
├── http_bench.zig
├── mime.js
├── package.json
├── publish-examples.js
├── readlink-getfd.zig
├── readlink-realpath.zig
└── tgz.zig
├── package.json
├── packages
├── bun-darwin-aarch64
│ └── .npmignore
├── bun-error
│ ├── bun-error.css
│ ├── bun.lockb
│ ├── img
│ │ ├── close.png
│ │ ├── error.png
│ │ ├── powered-by.png
│ │ └── powered-by.webp
│ ├── index.tsx
│ ├── markdown.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── runtime-error.ts
│ ├── sourcemap.ts
│ └── stack-trace-parser.ts
├── bun-framework-next
│ ├── .npmignore
│ ├── README.md
│ ├── appInjector.js
│ ├── client.development.tsx
│ ├── empty.js
│ ├── fallback.development.tsx
│ ├── next-image-polyfill.tsx
│ ├── next_document.tsx
│ ├── package.json
│ ├── packageVersion.ts
│ ├── page-loader.ts
│ ├── renderDocument.tsx
│ ├── server-polyfills.tsx
│ ├── server.development.tsx
│ └── tsconfig.json
├── bun-landing
│ ├── build.tsx
│ ├── index.css
│ ├── package.json
│ ├── page.tsx
│ ├── public
│ │ ├── Bun.png
│ │ ├── Bun@2x.png
│ │ ├── favicon.ico
│ │ ├── index.css
│ │ ├── index.html
│ │ ├── logo-square.png
│ │ ├── logo-square@16px.png
│ │ ├── logo-square@32px.png
│ │ ├── logo.png
│ │ ├── logo.svg
│ │ ├── logo@2x.png
│ │ ├── manifest.json
│ │ ├── next.svg
│ │ ├── remix.svg
│ │ ├── share.png
│ │ └── ssr.tsx
│ ├── react-dom-server.bun.production.min.js
│ ├── ssr.tsx
│ └── tsconfig.json
├── bun-linux-x64
│ └── .npmignore
├── bun-macro-relay
│ ├── README.md
│ ├── __generated__
│ │ └── FooOperation.graphql.ts
│ ├── bun-macro-relay.tsx
│ ├── package.json
│ ├── test
│ │ └── foo.tsx
│ └── tsconfig.json
├── bun-types
│ ├── package.json
│ └── types.d.ts
└── bun-wasm
│ ├── bun.lockb
│ ├── index.ts
│ ├── package.json
│ ├── test
│ └── node.mjs
│ └── tsconfig.json
├── src
├── .prettierignore
├── CHANGELOG.md
├── __global.zig
├── allocators.zig
├── allocators
│ └── mimalloc.zig
├── analytics.zig
├── analytics
│ ├── analytics_schema.zig
│ ├── analytics_thread.zig
│ └── schema.peechy
├── api
│ ├── bun.lockb
│ ├── bundle_v2.peechy
│ ├── demo
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── api.js
│ │ ├── bun.lockb
│ │ ├── lib
│ │ │ ├── api.ts
│ │ │ ├── run.ts
│ │ │ └── scan.ts
│ │ ├── next-env.d.ts
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── pages
│ │ │ ├── _app.js
│ │ │ ├── api
│ │ │ │ └── hello.js
│ │ │ ├── index.tsx
│ │ │ ├── scan.tsx
│ │ │ └── two.tsx
│ │ ├── public
│ │ │ ├── favicon.ico
│ │ │ └── vercel.svg
│ │ ├── schema.d.ts
│ │ ├── schema.js
│ │ ├── schema.peechy
│ │ ├── schema.zig
│ │ ├── styles
│ │ │ ├── Home.module.css
│ │ │ └── globals.css
│ │ └── tsconfig.json
│ ├── package.json
│ ├── schema.d.ts
│ ├── schema.js
│ ├── schema.peechy
│ ├── schema.zig
│ └── tsconfig.json
├── ast
│ └── base.zig
├── baby_list.zig
├── base64
│ ├── README.md
│ ├── base64.zig
│ ├── bun-base64.c
│ ├── bun-base64.h
│ ├── chromiumbase64.c
│ ├── chromiumbase64.h
│ ├── fastavxbase64.c
│ ├── fastavxbase64.h
│ ├── neonbase64
│ └── neonbase64.cc
├── bench
│ └── string-handling.zig
├── bindgen.zig
├── blob.zig
├── boringssl.zig
├── builder.zig
├── bun.js
│ ├── api
│ │ ├── FFI.h
│ │ ├── bun.zig
│ │ ├── ffi.zig
│ │ ├── html_rewriter.zig
│ │ ├── libtcc1.a.macos-aarch64
│ │ ├── libtcc1.c
│ │ ├── router.zig
│ │ ├── server.zig
│ │ └── transpiler.zig
│ ├── base.zig
│ ├── bindings
│ │ ├── .clang-format
│ │ ├── ActiveDOMCallback.cpp
│ │ ├── ActiveDOMCallback.h
│ │ ├── Buffer.cpp
│ │ ├── Buffer.h
│ │ ├── BufferEncodingType.h
│ │ ├── BunClientData.cpp
│ │ ├── BunClientData.h
│ │ ├── BunGCOutputConstraint.cpp
│ │ ├── BunGCOutputConstraint.h
│ │ ├── BunJSCModule.cpp
│ │ ├── BunJSCModule.h
│ │ ├── CachedScript.h
│ │ ├── DOMException.cpp
│ │ ├── DOMException.h
│ │ ├── DOMURL.cpp
│ │ ├── DOMURL.h
│ │ ├── DOMWrapperWorld-class.h
│ │ ├── DOMWrapperWorld.cpp
│ │ ├── DOMWrapperWorld.h
│ │ ├── Exception.h
│ │ ├── ExceptionCode.h
│ │ ├── ExceptionOr.h
│ │ ├── FFI.zig
│ │ ├── GCDefferalContext.h
│ │ ├── IDLTypes.h
│ │ ├── ImportMetaObject.cpp
│ │ ├── ImportMetaObject.h
│ │ ├── JSBuffer.cpp
│ │ ├── JSBuffer.h
│ │ ├── JSBufferEncodingType.cpp
│ │ ├── JSBufferEncodingType.h
│ │ ├── JSCInlines.h
│ │ ├── JSDOMBinding.h
│ │ ├── JSDOMConvertBufferSource+JSBuffer.h
│ │ ├── JSDOMExceptionHandling.cpp
│ │ ├── JSDOMExceptionHandling.h
│ │ ├── JSDOMGlobalObject.cpp
│ │ ├── JSDOMGlobalObject.h
│ │ ├── JSDOMWrapper.cpp
│ │ ├── JSDOMWrapper.h
│ │ ├── JSDOMWrapperCache.cpp
│ │ ├── JSDOMWrapperCache.h
│ │ ├── JSFFIFunction.cpp
│ │ ├── JSFFIFunction.h
│ │ ├── JSSink+custom.h
│ │ ├── JSSink.cpp
│ │ ├── JSSink.h
│ │ ├── JSSinkLookupTable.h
│ │ ├── MarkingConstraint.cpp
│ │ ├── NodeConstants.h
│ │ ├── Path.cpp
│ │ ├── Path.h
│ │ ├── Process.cpp
│ │ ├── Process.h
│ │ ├── ScriptExecutionContext.cpp
│ │ ├── ScriptExecutionContext.h
│ │ ├── Sink.h
│ │ ├── StreamGlobals.h
│ │ ├── StringAdaptors.h
│ │ ├── URLDecomposition.cpp
│ │ ├── URLDecomposition.h
│ │ ├── URLSearchParams.cpp
│ │ ├── URLSearchParams.h
│ │ ├── ZigConsoleClient.cpp
│ │ ├── ZigConsoleClient.h
│ │ ├── ZigGlobalObject.cpp
│ │ ├── ZigGlobalObject.h
│ │ ├── ZigLazyStaticFunctions-inlines.h
│ │ ├── ZigLazyStaticFunctions.h
│ │ ├── ZigSourceProvider.cpp
│ │ ├── ZigSourceProvider.h
│ │ ├── bindings-generator.zig
│ │ ├── bindings.cpp
│ │ ├── bindings.zig
│ │ ├── bmalloc_heap_ref.h
│ │ ├── exports.zig
│ │ ├── header-gen.zig
│ │ ├── headers-cpp.h
│ │ ├── headers-handwritten.h
│ │ ├── headers-replacements.zig
│ │ ├── headers.h
│ │ ├── headers.zig
│ │ ├── helpers.h
│ │ ├── inlines.cpp
│ │ ├── napi.cpp
│ │ ├── napi.h
│ │ ├── napi_external.cpp
│ │ ├── napi_external.h
│ │ ├── objects.cpp
│ │ ├── objects.h
│ │ ├── process.d.ts
│ │ ├── root.h
│ │ ├── shimmer.zig
│ │ ├── sizes.zig
│ │ ├── sqlite
│ │ │ ├── JSSQLStatement.cpp
│ │ │ ├── JSSQLStatement.h
│ │ │ ├── lazy_sqlite3.h
│ │ │ ├── sqlite.exports.js
│ │ │ ├── sqlite3.c
│ │ │ └── sqlite3_local.h
│ │ ├── static_export.zig
│ │ ├── webcore
│ │ │ ├── AbortAlgorithm.h
│ │ │ ├── AbortAlgorithm.idl
│ │ │ ├── AbortController.cpp
│ │ │ ├── AbortController.h
│ │ │ ├── AbortController.idl
│ │ │ ├── AbortSignal.cpp
│ │ │ ├── AbortSignal.h
│ │ │ ├── AbortSignal.idl
│ │ │ ├── ActiveDOMObject.cpp
│ │ │ ├── ActiveDOMObject.h
│ │ │ ├── AddEventListenerOptions.h
│ │ │ ├── BufferSource.h
│ │ │ ├── CallbackResult.h
│ │ │ ├── CloseEvent.cpp
│ │ │ ├── CloseEvent.h
│ │ │ ├── CloseEvent.idl
│ │ │ ├── CommonAtomStrings.cpp
│ │ │ ├── CommonAtomStrings.h
│ │ │ ├── ContextDestructionObserver.h
│ │ │ ├── CustomEvent.cpp
│ │ │ ├── CustomEvent.h
│ │ │ ├── CustomEvent.idl
│ │ │ ├── CustomEventCustom.cpp
│ │ │ ├── DOMClientIsoSubspaces.h
│ │ │ ├── DOMConstructors.h
│ │ │ ├── DOMHighResTimeStamp.h
│ │ │ ├── DOMIsoSubspaces.h
│ │ │ ├── DOMPromiseProxy.h
│ │ │ ├── ErrorCallback.cpp
│ │ │ ├── ErrorCallback.h
│ │ │ ├── ErrorCallback.idl
│ │ │ ├── ErrorEvent.cpp
│ │ │ ├── ErrorEvent.h
│ │ │ ├── ErrorEvent.idl
│ │ │ ├── Event.cpp
│ │ │ ├── Event.h
│ │ │ ├── Event.idl
│ │ │ ├── EventContext.cpp
│ │ │ ├── EventContext.h
│ │ │ ├── EventDispatcher.cpp
│ │ │ ├── EventDispatcher.h
│ │ │ ├── EventFactory.cpp
│ │ │ ├── EventHeaders.h
│ │ │ ├── EventInit.h
│ │ │ ├── EventInit.idl
│ │ │ ├── EventInterfaces.h
│ │ │ ├── EventListener.h
│ │ │ ├── EventListener.idl
│ │ │ ├── EventListenerMap.cpp
│ │ │ ├── EventListenerMap.h
│ │ │ ├── EventListenerOptions.h
│ │ │ ├── EventListenerOptions.idl
│ │ │ ├── EventModifierInit.h
│ │ │ ├── EventNames.cpp
│ │ │ ├── EventNames.h
│ │ │ ├── EventNames.in
│ │ │ ├── EventOptions.h
│ │ │ ├── EventPath.cpp
│ │ │ ├── EventPath.h
│ │ │ ├── EventSender.h
│ │ │ ├── EventTarget.cpp
│ │ │ ├── EventTarget.h
│ │ │ ├── EventTarget.idl
│ │ │ ├── EventTargetConcrete.cpp
│ │ │ ├── EventTargetConcrete.h
│ │ │ ├── EventTargetFactory.cpp
│ │ │ ├── EventTargetHeaders.h
│ │ │ ├── EventTargetInterfaces.h
│ │ │ ├── ExceptionDetails.h
│ │ │ ├── ExtendedDOMClientIsoSubspaces.h
│ │ │ ├── ExtendedDOMIsoSubspaces.h
│ │ │ ├── FetchHeaders.cpp
│ │ │ ├── FetchHeaders.h
│ │ │ ├── FetchHeaders.idl
│ │ │ ├── HTTPHeaderField.cpp
│ │ │ ├── HTTPHeaderField.h
│ │ │ ├── HTTPHeaderMap.cpp
│ │ │ ├── HTTPHeaderMap.h
│ │ │ ├── HTTPHeaderNames.cpp
│ │ │ ├── HTTPHeaderNames.gperf
│ │ │ ├── HTTPHeaderNames.h
│ │ │ ├── HTTPHeaderNames.in
│ │ │ ├── HTTPHeaderValues.cpp
│ │ │ ├── HTTPHeaderValues.h
│ │ │ ├── HTTPParsers.cpp
│ │ │ ├── HTTPParsers.h
│ │ │ ├── InternalWritableStream.cpp
│ │ │ ├── InternalWritableStream.h
│ │ │ ├── JSAbortAlgorithm.cpp
│ │ │ ├── JSAbortAlgorithm.h
│ │ │ ├── JSAbortController.cpp
│ │ │ ├── JSAbortController.dep
│ │ │ ├── JSAbortController.h
│ │ │ ├── JSAbortSignal.cpp
│ │ │ ├── JSAbortSignal.dep
│ │ │ ├── JSAbortSignal.h
│ │ │ ├── JSAbortSignalCustom.cpp
│ │ │ ├── JSAddEventListenerOptions.cpp
│ │ │ ├── JSAddEventListenerOptions.dep
│ │ │ ├── JSAddEventListenerOptions.h
│ │ │ ├── JSByteLengthQueuingStrategy.cpp
│ │ │ ├── JSByteLengthQueuingStrategy.dep
│ │ │ ├── JSByteLengthQueuingStrategy.h
│ │ │ ├── JSCallbackData.cpp
│ │ │ ├── JSCallbackData.h
│ │ │ ├── JSCloseEvent.cpp
│ │ │ ├── JSCloseEvent.dep
│ │ │ ├── JSCloseEvent.h
│ │ │ ├── JSCountQueuingStrategy.cpp
│ │ │ ├── JSCountQueuingStrategy.dep
│ │ │ ├── JSCountQueuingStrategy.h
│ │ │ ├── JSCustomEvent.cpp
│ │ │ ├── JSCustomEvent.dep
│ │ │ ├── JSCustomEvent.h
│ │ │ ├── JSDOMAttribute.h
│ │ │ ├── JSDOMBinding.h
│ │ │ ├── JSDOMBindingInternalsBuiltins.cpp
│ │ │ ├── JSDOMBindingInternalsBuiltins.h
│ │ │ ├── JSDOMBuiltinConstructor.h
│ │ │ ├── JSDOMBuiltinConstructorBase.cpp
│ │ │ ├── JSDOMBuiltinConstructorBase.h
│ │ │ ├── JSDOMCastThisValue.h
│ │ │ ├── JSDOMConstructor.h
│ │ │ ├── JSDOMConstructorBase.cpp
│ │ │ ├── JSDOMConstructorBase.h
│ │ │ ├── JSDOMConstructorNotCallable.h
│ │ │ ├── JSDOMConstructorNotConstructable.h
│ │ │ ├── JSDOMConvert.h
│ │ │ ├── JSDOMConvertAny.h
│ │ │ ├── JSDOMConvertBase.h
│ │ │ ├── JSDOMConvertBoolean.h
│ │ │ ├── JSDOMConvertBufferSource.h
│ │ │ ├── JSDOMConvertCallbacks.h
│ │ │ ├── JSDOMConvertDate.cpp
│ │ │ ├── JSDOMConvertDate.h
│ │ │ ├── JSDOMConvertDictionary.h
│ │ │ ├── JSDOMConvertEnumeration.h
│ │ │ ├── JSDOMConvertEventListener.h
│ │ │ ├── JSDOMConvertInterface.h
│ │ │ ├── JSDOMConvertJSON.h
│ │ │ ├── JSDOMConvertNull.h
│ │ │ ├── JSDOMConvertNullable.h
│ │ │ ├── JSDOMConvertNumbers.cpp
│ │ │ ├── JSDOMConvertNumbers.h
│ │ │ ├── JSDOMConvertObject.h
│ │ │ ├── JSDOMConvertPromise.h
│ │ │ ├── JSDOMConvertRecord.h
│ │ │ ├── JSDOMConvertScheduledAction.h
│ │ │ ├── JSDOMConvertSequences.h
│ │ │ ├── JSDOMConvertSerializedScriptValue.h
│ │ │ ├── JSDOMConvertStrings.cpp
│ │ │ ├── JSDOMConvertStrings.h
│ │ │ ├── JSDOMConvertUnion.h
│ │ │ ├── JSDOMConvertVariadic.h
│ │ │ ├── JSDOMConvertWebGL.cpp
│ │ │ ├── JSDOMConvertWebGL.h
│ │ │ ├── JSDOMConvertXPathNSResolver.h
│ │ │ ├── JSDOMException.cpp
│ │ │ ├── JSDOMException.h
│ │ │ ├── JSDOMGlobalObjectInlines.h
│ │ │ ├── JSDOMGuardedObject.cpp
│ │ │ ├── JSDOMGuardedObject.h
│ │ │ ├── JSDOMIterator.cpp
│ │ │ ├── JSDOMIterator.h
│ │ │ ├── JSDOMOperation.h
│ │ │ ├── JSDOMOperationReturningPromise.h
│ │ │ ├── JSDOMPromise.cpp
│ │ │ ├── JSDOMPromise.h
│ │ │ ├── JSDOMPromiseDeferred.cpp
│ │ │ ├── JSDOMPromiseDeferred.h
│ │ │ ├── JSDOMURL.cpp
│ │ │ ├── JSDOMURL.h
│ │ │ ├── JSDOMWindow.h
│ │ │ ├── JSErrorCallback.cpp
│ │ │ ├── JSErrorCallback.h
│ │ │ ├── JSErrorEvent.cpp
│ │ │ ├── JSErrorEvent.dep
│ │ │ ├── JSErrorEvent.h
│ │ │ ├── JSErrorEventCustom.cpp
│ │ │ ├── JSErrorHandler.cpp
│ │ │ ├── JSErrorHandler.h
│ │ │ ├── JSEvent.cpp
│ │ │ ├── JSEvent.dep
│ │ │ ├── JSEvent.h
│ │ │ ├── JSEventCustom.cpp
│ │ │ ├── JSEventCustom.h
│ │ │ ├── JSEventInit.cpp
│ │ │ ├── JSEventInit.dep
│ │ │ ├── JSEventInit.h
│ │ │ ├── JSEventListener.cpp
│ │ │ ├── JSEventListener.h
│ │ │ ├── JSEventListenerOptions.cpp
│ │ │ ├── JSEventListenerOptions.dep
│ │ │ ├── JSEventListenerOptions.h
│ │ │ ├── JSEventModifierInit.cpp
│ │ │ ├── JSEventModifierInit.dep
│ │ │ ├── JSEventModifierInit.h
│ │ │ ├── JSEventTarget.cpp
│ │ │ ├── JSEventTarget.h
│ │ │ ├── JSEventTargetCustom.cpp
│ │ │ ├── JSEventTargetCustom.h
│ │ │ ├── JSFetchHeaders.cpp
│ │ │ ├── JSFetchHeaders.dep
│ │ │ ├── JSFetchHeaders.h
│ │ │ ├── JSMessageEvent.cpp
│ │ │ ├── JSMessageEvent.dep
│ │ │ ├── JSMessageEvent.h
│ │ │ ├── JSMessageEventCustom.cpp
│ │ │ ├── JSReadableByteStreamController.cpp
│ │ │ ├── JSReadableByteStreamController.dep
│ │ │ ├── JSReadableByteStreamController.h
│ │ │ ├── JSReadableStream.cpp
│ │ │ ├── JSReadableStream.dep
│ │ │ ├── JSReadableStream.h
│ │ │ ├── JSReadableStreamBYOBReader.cpp
│ │ │ ├── JSReadableStreamBYOBReader.dep
│ │ │ ├── JSReadableStreamBYOBReader.h
│ │ │ ├── JSReadableStreamBYOBRequest.cpp
│ │ │ ├── JSReadableStreamBYOBRequest.dep
│ │ │ ├── JSReadableStreamBYOBRequest.h
│ │ │ ├── JSReadableStreamDefaultController.cpp
│ │ │ ├── JSReadableStreamDefaultController.dep
│ │ │ ├── JSReadableStreamDefaultController.h
│ │ │ ├── JSReadableStreamDefaultReader.cpp
│ │ │ ├── JSReadableStreamDefaultReader.dep
│ │ │ ├── JSReadableStreamDefaultReader.h
│ │ │ ├── JSReadableStreamSink.cpp
│ │ │ ├── JSReadableStreamSink.dep
│ │ │ ├── JSReadableStreamSink.h
│ │ │ ├── JSReadableStreamSource.cpp
│ │ │ ├── JSReadableStreamSource.dep
│ │ │ ├── JSReadableStreamSource.h
│ │ │ ├── JSReadableStreamSourceCustom.cpp
│ │ │ ├── JSServiceWorker.h
│ │ │ ├── JSTextEncoder.cpp
│ │ │ ├── JSTextEncoder.dep
│ │ │ ├── JSTextEncoder.h
│ │ │ ├── JSTransformStream.cpp
│ │ │ ├── JSTransformStream.dep
│ │ │ ├── JSTransformStream.h
│ │ │ ├── JSTransformStreamDefaultController.cpp
│ │ │ ├── JSTransformStreamDefaultController.dep
│ │ │ ├── JSTransformStreamDefaultController.h
│ │ │ ├── JSURLSearchParams.cpp
│ │ │ ├── JSURLSearchParams.dep
│ │ │ ├── JSURLSearchParams.h
│ │ │ ├── JSValueInWrappedObject.h
│ │ │ ├── JSWebSocket.cpp
│ │ │ ├── JSWebSocket.dep
│ │ │ ├── JSWebSocket.h
│ │ │ ├── JSWindowProxy.h
│ │ │ ├── JSWritableStream.cpp
│ │ │ ├── JSWritableStream.dep
│ │ │ ├── JSWritableStream.h
│ │ │ ├── JSWritableStreamDefaultController.cpp
│ │ │ ├── JSWritableStreamDefaultController.dep
│ │ │ ├── JSWritableStreamDefaultController.h
│ │ │ ├── JSWritableStreamDefaultWriter.cpp
│ │ │ ├── JSWritableStreamDefaultWriter.dep
│ │ │ ├── JSWritableStreamDefaultWriter.h
│ │ │ ├── JSWritableStreamSink.cpp
│ │ │ ├── JSWritableStreamSink.dep
│ │ │ ├── JSWritableStreamSink.h
│ │ │ ├── MessageEvent.cpp
│ │ │ ├── MessageEvent.h
│ │ │ ├── MessageEvent.idl
│ │ │ ├── Node.h
│ │ │ ├── ParsedContentType.cpp
│ │ │ ├── ParsedContentType.h
│ │ │ ├── ReadableStream.cpp
│ │ │ ├── ReadableStream.h
│ │ │ ├── ReadableStreamDefaultController.cpp
│ │ │ ├── ReadableStreamDefaultController.h
│ │ │ ├── ReadableStreamSink.cpp
│ │ │ ├── ReadableStreamSink.h
│ │ │ ├── ReadableStreamSource.cpp
│ │ │ ├── ReadableStreamSource.h
│ │ │ ├── RegisteredEventListener.h
│ │ │ ├── ScriptWrappable.cpp
│ │ │ ├── ScriptWrappable.h
│ │ │ ├── ScriptWrappableInlines.h
│ │ │ ├── StructuredClone.cpp
│ │ │ ├── StructuredClone.h
│ │ │ ├── TaskSource.h
│ │ │ ├── TextEncoder.cpp
│ │ │ ├── TextEncoder.h
│ │ │ ├── UIEventInit.h
│ │ │ ├── WebCoreBuiltins.h
│ │ │ ├── WebCoreJSClientData.h
│ │ │ ├── WebCoreTypedArrayController.cpp
│ │ │ ├── WebCoreTypedArrayController.h
│ │ │ ├── WebSocket.cpp
│ │ │ ├── WebSocket.h
│ │ │ ├── WebSocket.idl
│ │ │ ├── WebSocketIdentifier.h
│ │ │ ├── WritableStream.cpp
│ │ │ ├── WritableStream.h
│ │ │ ├── WritableStream.idl
│ │ │ ├── WritableStreamSink.h
│ │ │ ├── config.h
│ │ │ ├── weak_handle.cpp
│ │ │ └── weak_handle.h
│ │ ├── wtf-bindings.cpp
│ │ └── wtf-bindings.h
│ ├── builtins
│ │ ├── BunBuiltinNames.h
│ │ ├── README.md
│ │ ├── WebCoreJSBuiltinInternals.cpp
│ │ ├── WebCoreJSBuiltins.cpp
│ │ ├── cpp
│ │ │ ├── ByteLengthQueuingStrategyBuiltins.cpp
│ │ │ ├── ByteLengthQueuingStrategyBuiltins.h
│ │ │ ├── CountQueuingStrategyBuiltins.cpp
│ │ │ ├── CountQueuingStrategyBuiltins.h
│ │ │ ├── ImportMetaObjectBuiltins.cpp
│ │ │ ├── ImportMetaObjectBuiltins.h
│ │ │ ├── JSBufferConstructorBuiltins.cpp
│ │ │ ├── JSBufferConstructorBuiltins.h
│ │ │ ├── JSBufferPrototypeBuiltins.cpp
│ │ │ ├── JSBufferPrototypeBuiltins.h
│ │ │ ├── ReadableByteStreamControllerBuiltins.cpp
│ │ │ ├── ReadableByteStreamControllerBuiltins.h
│ │ │ ├── ReadableByteStreamInternalsBuiltins.cpp
│ │ │ ├── ReadableByteStreamInternalsBuiltins.h
│ │ │ ├── ReadableStreamBYOBReaderBuiltins.cpp
│ │ │ ├── ReadableStreamBYOBReaderBuiltins.h
│ │ │ ├── ReadableStreamBYOBRequestBuiltins.cpp
│ │ │ ├── ReadableStreamBYOBRequestBuiltins.h
│ │ │ ├── ReadableStreamBuiltins.cpp
│ │ │ ├── ReadableStreamBuiltins.h
│ │ │ ├── ReadableStreamDefaultControllerBuiltins.cpp
│ │ │ ├── ReadableStreamDefaultControllerBuiltins.h
│ │ │ ├── ReadableStreamDefaultReaderBuiltins.cpp
│ │ │ ├── ReadableStreamDefaultReaderBuiltins.h
│ │ │ ├── ReadableStreamInternalsBuiltins.cpp
│ │ │ ├── ReadableStreamInternalsBuiltins.h
│ │ │ ├── StreamInternalsBuiltins.cpp
│ │ │ ├── StreamInternalsBuiltins.h
│ │ │ ├── TransformStreamBuiltins.cpp
│ │ │ ├── TransformStreamBuiltins.h
│ │ │ ├── TransformStreamDefaultControllerBuiltins.cpp
│ │ │ ├── TransformStreamDefaultControllerBuiltins.h
│ │ │ ├── TransformStreamInternalsBuiltins.cpp
│ │ │ ├── TransformStreamInternalsBuiltins.h
│ │ │ ├── WebCoreJSBuiltinInternals.h
│ │ │ ├── WebCoreJSBuiltins.h
│ │ │ ├── WritableStreamDefaultControllerBuiltins.cpp
│ │ │ ├── WritableStreamDefaultControllerBuiltins.h
│ │ │ ├── WritableStreamDefaultWriterBuiltins.cpp
│ │ │ ├── WritableStreamDefaultWriterBuiltins.h
│ │ │ ├── WritableStreamInternalsBuiltins.cpp
│ │ │ └── WritableStreamInternalsBuiltins.h
│ │ └── js
│ │ │ ├── ByteLengthQueuingStrategy.js
│ │ │ ├── CountQueuingStrategy.js
│ │ │ ├── ImportMetaObject.js
│ │ │ ├── JSBufferConstructor.js
│ │ │ ├── JSBufferPrototype.js
│ │ │ ├── ReadableByteStreamController.js
│ │ │ ├── ReadableByteStreamInternals.js
│ │ │ ├── ReadableStream.js
│ │ │ ├── ReadableStreamBYOBReader.js
│ │ │ ├── ReadableStreamBYOBRequest.js
│ │ │ ├── ReadableStreamDefaultController.js
│ │ │ ├── ReadableStreamDefaultReader.js
│ │ │ ├── ReadableStreamInternals.js
│ │ │ ├── StreamInternals.js
│ │ │ ├── TransformStream.js
│ │ │ ├── TransformStreamDefaultController.js
│ │ │ ├── TransformStreamInternals.js
│ │ │ ├── WritableStreamDefaultController.js
│ │ │ ├── WritableStreamDefaultWriter.js
│ │ │ └── WritableStreamInternals.js
│ ├── bun-jsc.exports.js
│ ├── child_process.exports.js
│ ├── config.zig
│ ├── depd.exports.js
│ ├── detect-libc.js
│ ├── detect-libc.linux.js
│ ├── event_loop.zig
│ ├── ffi.exports.js
│ ├── fs.exports.js
│ ├── fs_promises.exports.js
│ ├── generate-jssink.js
│ ├── headergen
│ │ └── sizegen.cpp
│ ├── http.exports.js
│ ├── javascript.zig
│ ├── javascript_core_c_api.zig
│ ├── module.exports.js
│ ├── node
│ │ ├── buffer.js
│ │ ├── buffer.zig
│ │ ├── dir_iterator.zig
│ │ ├── node_fs.zig
│ │ ├── node_fs_binding.zig
│ │ ├── node_fs_constant.zig
│ │ ├── nodejs_error_code.zig
│ │ ├── syscall.zig
│ │ └── types.zig
│ ├── node_streams_consumer.exports.js
│ ├── node_streams_web.exports.js
│ ├── node_timers.exports.js
│ ├── node_timers_promises.exports.js
│ ├── path-posix.exports.js
│ ├── path-win32.exports.js
│ ├── path.exports.js
│ ├── perf_hooks.exports.js
│ ├── process.exports.js
│ ├── rare_data.zig
│ ├── script_execution_context.zig
│ ├── test
│ │ └── jest.zig
│ ├── typescript.zig
│ ├── undici.exports.js
│ ├── url.exports.js
│ ├── uuid.zig
│ ├── webcore.zig
│ ├── webcore
│ │ ├── base64.zig
│ │ ├── encoding.zig
│ │ ├── response.zig
│ │ └── streams.zig
│ └── ws.exports.js
├── bun_js.zig
├── bundler.zig
├── bundler
│ ├── entry_points.zig
│ └── generate_node_modules_bundle.zig
├── bunfig.zig
├── c.zig
├── cache.zig
├── cli.zig
├── cli
│ ├── add_command.zig
│ ├── add_completions.txt
│ ├── add_completions.zig
│ ├── build_command.zig
│ ├── bun_command.zig
│ ├── colon_list_type.zig
│ ├── create_command.zig
│ ├── dev_command.zig
│ ├── discord_command.zig
│ ├── install.sh
│ ├── install_command.zig
│ ├── install_completions_command.zig
│ ├── list-of-yarn-commands.zig
│ ├── package_manager_command.zig
│ ├── remove_command.zig
│ ├── run_command.zig
│ ├── shell_completions.zig
│ ├── test_command.zig
│ └── upgrade_command.zig
├── comptime_string_map.zig
├── copy_file.zig
├── css_scanner.zig
├── darwin_c.zig
├── defines-table.zig
├── defines.zig
├── deps
│ ├── _libusockets.h
│ ├── backtrace.zig
│ ├── boringssl.translated.zig
│ ├── crash_reporter_linux.zig
│ ├── libuwsockets.cpp
│ ├── lol-html.zig
│ ├── picohttp.zig
│ ├── picohttpparser.c
│ ├── picohttpparser.h
│ ├── picohttpparser.h.gch
│ ├── picohttpparser.zig
│ ├── uws.zig
│ ├── zig-clap
│ │ ├── .gitignore
│ │ ├── LICENSE
│ │ ├── build.zig
│ │ ├── clap.zig
│ │ ├── clap
│ │ │ ├── args.zig
│ │ │ ├── comptime.zig
│ │ │ └── streaming.zig
│ │ ├── gyro.zzz
│ │ └── zig.mod
│ └── zig-datetime
│ │ ├── .gitignore
│ │ ├── .travis.yml
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── src
│ │ ├── datetime.zig
│ │ ├── main.zig
│ │ └── timezones.zig
├── emcc_main.c
├── env.zig
├── env_loader.zig
├── exact_size_matcher.zig
├── fallback-backend.html
├── fallback.html
├── fallback.ts
├── favicon.png
├── feature_flags.zig
├── fixtures_example.com.html
├── fs.zig
├── futex.zig
├── generated_versions_list.zig
├── global.zig
├── hash_map.zig
├── http.zig
├── http
│ ├── async_bio.zig
│ ├── async_message.zig
│ ├── async_socket.zig
│ ├── header_builder.zig
│ ├── headers.zig
│ ├── method.zig
│ ├── mime_type.zig
│ ├── url_path.zig
│ ├── websocket.zig
│ ├── websocket_http_client.zig
│ └── zlib.zig
├── http_client_async.zig
├── identity_context.zig
├── import_record.zig
├── install
│ ├── bin.zig
│ ├── bit_set.zig
│ ├── dependency.zig
│ ├── extract_tarball.zig
│ ├── install-scripts-allowlist.txt
│ ├── install.zig
│ ├── integrity.zig
│ ├── lockfile.zig
│ ├── npm.zig
│ ├── repository.zig
│ ├── resolution.zig
│ ├── resolvers
│ │ └── folder_resolver.zig
│ └── semver.zig
├── io
│ ├── fifo.zig
│ ├── io_darwin.zig
│ ├── io_linux.zig
│ ├── io_stub.zig
│ └── time.zig
├── js_ast.zig
├── js_lexer.zig
├── js_lexer
│ ├── identifier.zig
│ ├── identifier_cache.zig
│ └── identifier_data.zig
├── js_lexer_tables.zig
├── js_parser.zig
├── js_printer.zig
├── jsc.zig
├── jsc_stub.zig
├── json_parser.zig
├── libarchive
│ ├── libarchive-bindings.zig
│ └── libarchive.zig
├── linear_fifo.zig
├── linker.zig
├── linux_c.zig
├── lock.zig
├── logger.zig
├── main.zig
├── main_api.zig
├── main_wasm.zig
├── mdx
│ └── mdx_parser.zig
├── memory_allocator.zig
├── meta.zig
├── mimalloc_arena.zig
├── napi
│ ├── js_native_api.h
│ ├── js_native_api_types.h
│ ├── napi.zig
│ ├── node_api.h
│ └── node_api_types.h
├── network_thread.zig
├── node-fallbacks
│ ├── @vercel_fetch.js
│ ├── assert.js
│ ├── buffer.js
│ ├── bun.lockb
│ ├── console.js
│ ├── constants.js
│ ├── crypto.js
│ ├── domain.js
│ ├── events.js
│ ├── http.js
│ ├── https.js
│ ├── isomorphic-fetch.js
│ ├── net.js
│ ├── node-fetch.js
│ ├── os.js
│ ├── package-lock.json
│ ├── package.json
│ ├── path.js
│ ├── process.js
│ ├── punycode.js
│ ├── querystring.js
│ ├── stream.js
│ ├── string_decoder.js
│ ├── supports-color.js
│ ├── sys.js
│ ├── timers.js
│ ├── tsconfig.json
│ ├── tty.js
│ ├── url.js
│ ├── util.js
│ └── zlib.js
├── node_fallbacks.zig
├── node_module_bundle.zig
├── open.zig
├── options.zig
├── output.zig
├── panic_handler.zig
├── pool.zig
├── react-refresh.js
├── ref_count.zig
├── renamer.zig
├── report.zig
├── resolver
│ ├── data_url.zig
│ ├── dir_info.zig
│ ├── package_json.zig
│ ├── resolve_path.zig
│ ├── resolver.zig
│ └── tsconfig_json.zig
├── router.zig
├── runtime.footer.bun.js
├── runtime.footer.js
├── runtime.footer.node.js
├── runtime.footer.with-refresh.js
├── runtime.js
├── runtime.zig
├── runtime
│ ├── errors.ts
│ ├── hmr.ts
│ ├── index-with-refresh.ts
│ ├── index-without-hmr.ts
│ ├── index.ts
│ └── regenerator.ts
├── sha.zig
├── sourcemap
│ ├── sourcemap.zig
│ └── vlq_bench.zig
├── string_builder.zig
├── string_immutable.zig
├── string_joiner.zig
├── string_mutable.zig
├── string_types.zig
├── symbols.dyn
├── symbols.txt
├── sync.zig
├── system_timer.zig
├── tagged_pointer.zig
├── tcc.zig
├── test
│ ├── fixtures.zig
│ ├── fixtures
│ │ ├── array-binding-none.js
│ │ ├── await.ts
│ │ ├── browsermap-false.ts
│ │ ├── cannot-assign-to-import-bug.js
│ │ ├── class-with-property.ts
│ │ ├── compilation-prototype.js
│ │ ├── console.log.js
│ │ ├── default_export_hmr_identifier_ref.tsx
│ │ ├── defines.js
│ │ ├── disabled-import-bun.ts
│ │ ├── double-export-default-bug.jsx
│ │ ├── duplicate-exports-bug.js
│ │ ├── escape-chars.mjs
│ │ ├── export-check.mjs
│ │ ├── export-from.js
│ │ ├── exports-bug.js
│ │ ├── for-loop-bug.js
│ │ ├── fragment.jsx
│ │ ├── function-args-parse-bug.js
│ │ ├── function-scope-bug.jsx
│ │ ├── hello.js
│ │ ├── img-bug.js
│ │ ├── in-keyword.js
│ │ ├── json-parser-in-typescript.js
│ │ ├── json-parser-in-typescript.ts
│ │ ├── jsx-comment.tsx
│ │ ├── keyword-in-property-binding.tsx
│ │ ├── label-continue-break-bug.js
│ │ ├── main-field.ts
│ │ ├── maybe-rewrite-index-accessor.js
│ │ ├── me@2x.jpeg
│ │ ├── minifysyntax.js
│ │ ├── module_exports_with_default_values.js
│ │ ├── namespaced-validators.ts
│ │ ├── nested-destructuring-should-print-correctly.js
│ │ ├── noop.js
│ │ ├── nql-define.2.js
│ │ ├── nql-define.js
│ │ ├── nullish-coalesce.js
│ │ ├── object-newline.js
│ │ ├── optional-chain-polyfill.js
│ │ ├── quoted-escape.js
│ │ ├── react-context.tsx
│ │ ├── react-dev-crash.js
│ │ ├── regexp-validation.js
│ │ ├── require-detector.js
│ │ ├── simple-150x.jsx
│ │ ├── simple-component.js
│ │ ├── simple-component.tsx
│ │ ├── simple.css
│ │ ├── simple.jsx
│ │ ├── spread-bug.js
│ │ ├── symbols-bug.js
│ │ ├── tailwind.css
│ │ ├── test-import.css
│ │ ├── tsconfig.json
│ │ ├── tsx-bug.tsx
│ │ ├── type-only-import.ts
│ │ ├── typescript-is-turing-complete.ts
│ │ └── uescape.js
│ ├── project.zig
│ └── tester.zig
├── thread_pool.zig
├── toml
│ ├── toml_lexer.zig
│ └── toml_parser.zig
├── typegen.zig
├── url.zig
├── walker_skippable.zig
├── watcher.zig
├── which.zig
├── which_npm_client.zig
├── work_pool.zig
├── yield.zig
├── zlib.test.gz
├── zlib.test.txt
└── zlib.zig
├── test
├── README.md
├── apps
│ ├── bun-create-next.sh
│ ├── bun-create-react.sh
│ ├── bun-dev-index-html.sh
│ ├── bun-dev.sh
│ ├── bun-install-lockfile-status.sh
│ ├── bun-install-utf8.sh
│ ├── bun-install.sh
│ ├── bun-run-check-nameless-package.json
│ ├── bun-run-check-package.json
│ └── bun-run-check.sh
├── bun.js
│ ├── arraybuffersink.test.ts
│ ├── atob.test.js
│ ├── baz.js
│ ├── bigint.test.js
│ ├── buffer.test.js
│ ├── bun-jsc.test.js
│ ├── bun.lockb
│ ├── bundled
│ │ ├── always-bundled-module
│ │ │ ├── always-bundled-module
│ │ │ ├── cjs.js
│ │ │ ├── esm.js
│ │ │ └── package.json
│ │ ├── entrypoint.ts
│ │ ├── package.json
│ │ ├── to_bundle_node_modules
│ │ │ └── i-am-bundled
│ │ │ │ ├── cjs.js
│ │ │ │ ├── esm.js
│ │ │ │ └── package.json
│ │ └── tsconfig.json
│ ├── concat.test.js
│ ├── console-log.js
│ ├── crypto.test.js
│ ├── dirname.test.js
│ ├── escapeHTML.test.js
│ ├── esm
│ │ ├── first.mjs
│ │ ├── second-child.mjs
│ │ ├── second.mjs
│ │ ├── startEnd.mjs
│ │ └── third.mjs
│ ├── exit.js
│ ├── fetch.js.txt
│ ├── fetch.test.js
│ ├── ffi-test.c
│ ├── ffi.test.fixture.callback.c
│ ├── ffi.test.fixture.receiver.c
│ ├── ffi.test.js
│ ├── fs-stream.js
│ ├── fs.test.js
│ ├── gc.js
│ ├── globals.test.js
│ ├── hash.test.js
│ ├── html-rewriter.test.js
│ ├── import-meta.test.js
│ ├── import.live.decl.js
│ ├── import.live.rexport-require.js
│ ├── import.live.rexport.js
│ ├── inline.macro.js
│ ├── inspect.test.js
│ ├── macro-check.js
│ ├── microtask.test.js
│ ├── mmap.test.js
│ ├── node-builtins.test.js
│ ├── path.test.js
│ ├── performance.test.js
│ ├── process-nexttick.js
│ ├── process-nexttick.test.js
│ ├── process.test.js
│ ├── react-dom.test.tsx
│ ├── reactdom-bun.js
│ ├── readFileSync.txt
│ ├── readdir.js
│ ├── reportError.test.js
│ ├── require-js-top-level-await.js
│ ├── require-js.js
│ ├── require-js2.js
│ ├── require-json.json
│ ├── resolve-typescript-file.tsx
│ ├── resolve.test.js
│ ├── response.file.test.js
│ ├── serve.test.ts
│ ├── setInterval.test.js
│ ├── setTimeout.test.js
│ ├── shadow.test.js
│ ├── sleep.js
│ ├── solid-dom-fixtures
│ │ ├── SVG
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── attributeExpressions
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── components
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── conditionalExpressions
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── customElements
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── eventExpressions
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── fragments
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ ├── insertChildren
│ │ │ ├── code.js
│ │ │ └── output.js
│ │ ├── namespaceElements
│ │ │ ├── code.js
│ │ │ └── output.js
│ │ ├── simpleElements
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ │ └── textInterpolation
│ │ │ ├── code.js
│ │ │ ├── output.bun.js
│ │ │ └── output.js
│ ├── some-fs.js
│ ├── sql-raw.test.js
│ ├── sqlite.test.js
│ ├── streams.test.js
│ ├── text-encoder.test.js
│ ├── toml-fixture.toml
│ ├── toml.test.js
│ ├── transpiler.test.js
│ ├── tsconfig.json
│ ├── unsafe.test.js
│ ├── url.test.ts
│ ├── wasm-return-1-test.zig
│ ├── wasm.js
│ ├── wasm.test.js
│ ├── web-globals.test.js
│ ├── websocket.test.js
│ ├── writeFileSync.txt
│ └── zlib.test.js
├── macro
│ ├── assert.tsx
│ ├── fetchSync.tsx
│ ├── hello-fetch-macro.tsx
│ └── loadMocks.tsx
├── scripts
│ ├── browser.js
│ ├── bun.js
│ ├── bun.lockb
│ ├── package-lock.json
│ ├── package.json
│ └── snippets.json
├── snapshots
│ ├── .prettierignore
│ ├── array-args-with-default-values.debug.js
│ ├── array-args-with-default-values.hmr.debug.js
│ ├── array-args-with-default-values.hmr.js
│ ├── array-args-with-default-values.js
│ ├── bundled-entry-point.debug.js
│ ├── bundled-entry-point.hmr.debug.js
│ ├── bundled-entry-point.hmr.js
│ ├── bundled-entry-point.js
│ ├── caught-require.debug.js
│ ├── caught-require.hmr.debug.js
│ ├── caught-require.hmr.js
│ ├── caught-require.js
│ ├── cjs-transform-shouldnt-have-static-imports-in-cjs-function.debug.js
│ ├── cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.debug.js
│ ├── cjs-transform-shouldnt-have-static-imports-in-cjs-function.hmr.js
│ ├── cjs-transform-shouldnt-have-static-imports-in-cjs-function.js
│ ├── code-simplification-neql-define.debug.js
│ ├── code-simplification-neql-define.hmr.debug.js
│ ├── code-simplification-neql-define.hmr.js
│ ├── code-simplification-neql-define.js
│ ├── custom-emotion-jsx
│ │ ├── file.debug.jsx
│ │ ├── file.hmr.debug.jsx
│ │ ├── file.hmr.jsx
│ │ └── file.jsx
│ ├── export-default-module-hot.debug.js
│ ├── export-default-module-hot.hmr.debug.js
│ ├── export-default-module-hot.hmr.js
│ ├── export-default-module-hot.js
│ ├── export.debug.js
│ ├── export.hmr.debug.js
│ ├── export.hmr.js
│ ├── export.js
│ ├── forbid-in-is-correct.debug.js
│ ├── forbid-in-is-correct.hmr.debug.js
│ ├── forbid-in-is-correct.hmr.js
│ ├── forbid-in-is-correct.js
│ ├── global-is-remapped-to-globalThis.debug.js
│ ├── global-is-remapped-to-globalThis.hmr.debug.js
│ ├── global-is-remapped-to-globalThis.hmr.js
│ ├── global-is-remapped-to-globalThis.js
│ ├── jsx-entities.debug.jsx
│ ├── jsx-entities.hmr.debug.jsx
│ ├── jsx-entities.hmr.jsx
│ ├── jsx-entities.jsx
│ ├── jsx-spacing.debug.jsx
│ ├── jsx-spacing.hmr.debug.jsx
│ ├── jsx-spacing.hmr.jsx
│ ├── jsx-spacing.jsx
│ ├── latin1-chars-in-regexp.debug.js
│ ├── latin1-chars-in-regexp.hmr.debug.js
│ ├── latin1-chars-in-regexp.hmr.js
│ ├── latin1-chars-in-regexp.js
│ ├── lodash-regexp.debug.js
│ ├── lodash-regexp.hmr.debug.js
│ ├── lodash-regexp.hmr.js
│ ├── lodash-regexp.js
│ ├── multiple-imports.debug.js
│ ├── multiple-imports.hmr.debug.js
│ ├── multiple-imports.hmr.js
│ ├── multiple-imports.js
│ ├── multiple-var.debug.js
│ ├── multiple-var.hmr.debug.js
│ ├── multiple-var.hmr.js
│ ├── multiple-var.js
│ ├── number-literal-bug.debug.js
│ ├── number-literal-bug.hmr.debug.js
│ ├── number-literal-bug.hmr.js
│ ├── number-literal-bug.js
│ ├── optional-chain-with-function.debug.js
│ ├── optional-chain-with-function.hmr.debug.js
│ ├── optional-chain-with-function.hmr.js
│ ├── optional-chain-with-function.js
│ ├── package-json-exports
│ │ ├── index.debug.js
│ │ ├── index.hmr.debug.js
│ │ ├── index.hmr.js
│ │ └── index.js
│ ├── package-json-utf8.debug.js
│ ├── package-json-utf8.hmr.debug.js
│ ├── package-json-utf8.hmr.js
│ ├── package-json-utf8.js
│ ├── react-context-value-func.debug.tsx
│ ├── react-context-value-func.hmr.debug.tsx
│ ├── react-context-value-func.hmr.tsx
│ ├── react-context-value-func.tsx
│ ├── spread_with_key.debug.tsx
│ ├── spread_with_key.hmr.debug.tsx
│ ├── spread_with_key.hmr.tsx
│ ├── spread_with_key.tsx
│ ├── string-escapes.debug.js
│ ├── string-escapes.hmr.debug.js
│ ├── string-escapes.hmr.js
│ ├── string-escapes.js
│ ├── styled-components-output.hmr.js
│ ├── styledcomponents-output.debug.js
│ ├── styledcomponents-output.hmr.debug.js
│ ├── styledcomponents-output.hmr.js
│ ├── styledcomponents-output.js
│ ├── template-literal.debug.js
│ ├── template-literal.hmr.debug.js
│ ├── template-literal.hmr.js
│ ├── template-literal.js
│ ├── ts-fallback-rewrite-works.debug.js
│ ├── ts-fallback-rewrite-works.hmr.debug.js
│ ├── ts-fallback-rewrite-works.hmr.js
│ ├── ts-fallback-rewrite-works.js
│ ├── tsx-fallback-rewrite-works.debug.js
│ ├── tsx-fallback-rewrite-works.hmr.debug.js
│ ├── tsx-fallback-rewrite-works.hmr.js
│ ├── tsx-fallback-rewrite-works.js
│ ├── type-only-imports.debug.ts
│ ├── type-only-imports.hmr.debug.ts
│ ├── type-only-imports.hmr.ts
│ ├── type-only-imports.ts
│ ├── unicode-identifiers.debug.js
│ ├── unicode-identifiers.hmr.debug.js
│ ├── unicode-identifiers.hmr.js
│ ├── unicode-identifiers.js
│ ├── void-shouldnt-delete-call-expressions.debug.js
│ ├── void-shouldnt-delete-call-expressions.hmr.debug.js
│ ├── void-shouldnt-delete-call-expressions.hmr.js
│ └── void-shouldnt-delete-call-expressions.js
└── snippets
│ ├── _auth.js
│ ├── _bacon.js
│ ├── _login.js
│ ├── array-args-with-default-values.js
│ ├── bun.lockb
│ ├── bundled-entry-point.js
│ ├── caught-require.js
│ ├── cjs-transform-shouldnt-have-static-imports-in-cjs-function.js
│ ├── code-simplification-neql-define.js
│ ├── custom-emotion-jsx
│ ├── file.jsx
│ └── tsconfig.json
│ ├── export-default-module-hot.js
│ ├── export.js
│ ├── forbid-in-is-correct.js
│ ├── global-is-remapped-to-globalThis.js
│ ├── jsx-entities.jsx
│ ├── jsx-spacing.js
│ ├── jsx-spacing.jsx
│ ├── jsx-top-level.tsx
│ ├── latin1-chars-in-regexp.js
│ ├── lodash-regexp.js
│ ├── multiple-imports.js
│ ├── multiple-var.js
│ ├── number-literal-bug.js
│ ├── optional-chain-with-function.js
│ ├── package-json-exports
│ ├── _node_modules_copy
│ │ ├── exact
│ │ │ ├── im-exact.js
│ │ │ └── package.json
│ │ ├── inexact
│ │ │ ├── browser
│ │ │ │ ├── dir
│ │ │ │ │ ├── file.js
│ │ │ │ │ └── foo.js
│ │ │ │ ├── foo.js
│ │ │ │ └── index.js
│ │ │ ├── default
│ │ │ │ ├── dir
│ │ │ │ │ ├── file.js
│ │ │ │ │ └── foo.js
│ │ │ │ ├── foo.js
│ │ │ │ └── index.js
│ │ │ ├── node
│ │ │ │ ├── dir
│ │ │ │ │ ├── file.js
│ │ │ │ │ └── foo.js
│ │ │ │ ├── foo.js
│ │ │ │ └── index.js
│ │ │ └── package.json
│ │ └── js-only-exports
│ │ │ ├── browser
│ │ │ ├── dir
│ │ │ │ ├── file.js
│ │ │ │ └── foo.js
│ │ │ ├── foo.js
│ │ │ ├── index.js
│ │ │ ├── js-file.js
│ │ │ └── js-file.ts
│ │ │ ├── default
│ │ │ ├── dir
│ │ │ │ ├── file.js
│ │ │ │ └── foo.js
│ │ │ ├── foo.js
│ │ │ └── index.js
│ │ │ ├── node
│ │ │ ├── dir
│ │ │ │ ├── file.js
│ │ │ │ └── foo.js
│ │ │ ├── foo.js
│ │ │ └── index.js
│ │ │ └── package.json
│ ├── index.js
│ └── package.json
│ ├── package-json-utf8.js
│ ├── package.json
│ ├── public
│ └── index.html
│ ├── react-context-value-func.tsx
│ ├── segfault.js
│ ├── spread_with_key.tsx
│ ├── string-escapes.js
│ ├── styledcomponents-output.js
│ ├── template-literal.js
│ ├── ts-fallback-rewrite-works.ts
│ ├── tsx-fallback-rewrite-works.tsx
│ ├── type-only-imports.ts
│ ├── unicode-identifiers.js
│ ├── utf8-package-json.json
│ ├── void-shouldnt-delete-call-expressions.js
│ └── zero.js
├── tsconfig.json
├── types
└── bun
│ ├── README.md
│ ├── assert.d.ts
│ ├── buffer.d.ts
│ ├── bun-test.d.ts
│ ├── bun.d.ts
│ ├── bundle.ts
│ ├── constants.d.ts
│ ├── crypto.d.ts
│ ├── domain.d.ts
│ ├── events.d.ts
│ ├── ffi.d.ts
│ ├── fs.d.ts
│ ├── globals.d.ts
│ ├── header.txt
│ ├── html-rewriter.d.ts
│ ├── http.d.ts
│ ├── index.d.ts
│ ├── index.js
│ ├── jsc.d.ts
│ ├── os.d.ts
│ ├── package.json
│ ├── path.d.ts
│ ├── paths.txt
│ ├── punycode.d.ts
│ ├── querystring.d.ts
│ ├── sqlite.d.ts
│ ├── stream.d.ts
│ ├── string_decoder.d.ts
│ ├── supports-color.d.ts
│ ├── timers.d.ts
│ ├── tsconfig.json
│ ├── tty.d.ts
│ ├── url.d.ts
│ ├── util.d.ts
│ └── zlib.d.ts
├── workspace.code-workspace
└── zig-build
├── .dockerignore
├── Dockerfile
├── Dockerfile.musl
└── release.sh
/.devcontainer/scripts/getting-started.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "To get started, login to GitHub and clone bun's GitHub repo into /workspaces/bun"
4 | echo "Make sure to login with a Personal Access Token"
5 | echo "# First time setup"
6 | echo "gh auth login"
7 | echo "gh repo clone oven-sh/bun . -- --depth=1 --progress -j8"
8 | echo ""
9 | echo "# Compile bun dependencies (zig is already compiled)"
10 | echo "make devcontainer"
11 | echo ""
12 | echo "# Build bun for development"
13 | echo "make dev"
14 | echo ""
15 | echo "# Run bun"
16 | echo "bun-debug"
17 |
--------------------------------------------------------------------------------
/.devcontainer/scripts/nice.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | chsh -s $(which zsh)
4 | sh -c "$(curl -fsSL https://starship.rs/install.sh) -- --platform linux_musl" -- --yes
5 | echo "eval \"$(starship init zsh)\"" >>~/.zshrc
6 |
7 | curl https://github.com/Jarred-Sumner/vscode-zig/releases/download/fork-v1/zig-0.2.5.vsix >/home/ubuntu/vscode-zig.vsix
8 |
--------------------------------------------------------------------------------
/.devcontainer/scripts/zig-env.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | curl -L https://github.com/Jarred-Sumner/vscode-zig/releases/download/fork-v1/zig-0.2.5.vsix >/home/ubuntu/vscode-zig.vsix
4 | git clone https://github.com/zigtools/zls /home/ubuntu/zls
5 | cd /home/ubuntu/zls
6 | git submodule update --init --recursive --progress --depth=1
7 | zig build -Drelease-fast
8 |
--------------------------------------------------------------------------------
/.devcontainer/workspace.code-workspace:
--------------------------------------------------------------------------------
1 | {
2 | "folders": [
3 | {
4 | // Source code
5 | "name": "bun",
6 | "path": "bun"
7 | },
8 | ]
9 | }
--------------------------------------------------------------------------------
/.devcontainer/zls.json:
--------------------------------------------------------------------------------
1 | {
2 | "zig_exe_path": "/build/zig/zig",
3 | "enable_snippets": true,
4 | "warn_style": false,
5 | "enable_semantic_tokens": true,
6 | "operator_completions": true,
7 | "include_at_in_builtins": false,
8 | "max_detail_length": 1048576
9 | }
10 |
--------------------------------------------------------------------------------
/.docker/chromium.pref:
--------------------------------------------------------------------------------
1 | # Note: 2 blank lines are required between entries
2 | Package: *
3 | Pin: release a=eoan
4 | Pin-Priority: 500
5 |
6 | Package: *
7 | Pin: origin "ftp.debian.org"
8 | Pin-Priority: 300
9 |
10 | # Pattern includes 'chromium', 'chromium-browser' and similarly
11 | # named dependencies:
12 | Package: chromium*
13 | Pin: origin "ftp.debian.org"
14 | Pin-Priority: 700
--------------------------------------------------------------------------------
/.docker/copy-bun-binary.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euxo pipefail
4 |
5 | name=$(openssl rand -hex 12)
6 | id=$(docker create --name=bun-binary-$name $CONTAINER_TAG)
7 | docker container cp bun-binary-$name:$BUN_RELEASE_DIR bun-binary
8 | echo -e "bun-binary-$name"
9 |
--------------------------------------------------------------------------------
/.docker/debian.list:
--------------------------------------------------------------------------------
1 | deb http://deb.debian.org/debian buster main
2 | deb http://deb.debian.org/debian buster-updates main
3 | deb http://deb.debian.org/debian-security buster/updates main
--------------------------------------------------------------------------------
/.docker/pull.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euxo pipefail
4 |
5 | docker pull bunbunbunbun/bun-test-base:latest --platform=linux/amd64
6 | docker pull bunbunbunbun/bun-base:latest --platform=linux/amd64
7 | docker pull bunbunbunbun/bun-base-with-zig-and-webkit:latest --platform=linux/amd64
8 |
9 | docker tag bunbunbunbun/bun-test-base:latest bun-base:latest
10 | docker tag bunbunbunbun/bun-base:latest bun-base:latest
11 | docker tag bunbunbunbun/bun-base-with-zig-and-webkit:latest bun-base-with-zig-and-webkit:latest
12 |
--------------------------------------------------------------------------------
/.docker/run-test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euxo pipefail
4 |
5 | bun install
6 | bun install --cwd ./test/snippets
7 | bun install --cwd ./test/scripts
8 |
9 | make $BUN_TEST_NAME
10 |
--------------------------------------------------------------------------------
/.docker/runner.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euxo pipefail
4 |
5 | docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --env BUN_TEST_NAME=$BUN_TEST_NAME --ulimit memlock=-1:-1 --init --rm bun-test:latest
6 |
--------------------------------------------------------------------------------
/.docker/unit-tests.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | set -euxo pipefail
4 |
5 | docker container run --security-opt seccomp=.docker/chrome.json --env GITHUB_WORKSPACE=$GITHUB_WORKSPACE --ulimit memlock=-1:-1 --init --rm bun-unit-tests:latest
6 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | **/node_modules
3 | src/bun.js/WebKit/LayoutTests
4 | zig-out
5 | zig-build
6 | **/*.o
7 | **/*.a
8 |
9 | examples
10 |
11 | **/.next
12 | .git
13 | src/bun.js/WebKit
14 | **/CMakeCache.txt
15 | packages/**/bun
16 | packages/**/bun-profile
17 | zig-cache
18 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | .vscode/launch.json linguist-generated
2 | src/api/schema.d.ts linguist-generated
3 | fixture.*.c linguist-generated
4 | src/api/schema.js linguist-generated
5 | src/bun.js/bindings/sqlite/sqlite3.c linguist-vendored
6 | src/bun.js/bindings/sqlite/sqlite3_local.h linguist-vendored
7 | *.lockb binary diff=lockb
8 | *.zig text eol=lf
9 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/3-api-ref-docs-problem.yml:
--------------------------------------------------------------------------------
1 | name: 📗 Open an issue regarding the bun docs
2 | description: Let us know about any problematic documentations
3 | labels: [documentation]
4 | body:
5 | - type: markdown
6 | attributes:
7 | value: |
8 | Thank you for wanting to make bun better!
9 |
10 | Please fill in as much of the following form as you're able.
11 | - type: input
12 | attributes:
13 | label: Affected URL(s)
14 | - type: textarea
15 | attributes:
16 | label: Description of the problem
17 | validations:
18 | required: true
19 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Discord server
4 | url: https://discord.com/invite/CXdq2DP29u
5 | about: Please visit our Discord server for questions and support requests.
6 |
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "AugusteRame.zls-vscode",
4 | "esbenp.prettier-vscode",
5 | "xaver.clang-format",
6 | "vadimcn.vscode-lldb"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/bench/.env:
--------------------------------------------------------------------------------
1 | BUN=bun
2 | DENO=deno
3 | NODE=node
--------------------------------------------------------------------------------
/bench/.gitignore:
--------------------------------------------------------------------------------
1 | ffi/src/target
2 | ffi/src/*.node
--------------------------------------------------------------------------------
/bench/README.md:
--------------------------------------------------------------------------------
1 | ```bash
2 | npm install
3 |
4 | bun run ffi
5 | bun run gzip
6 | bun run async
7 | bun run sqlite
8 |
9 | # to use custom version of bun/deno/node binary
10 | BUN=path/to/bun bun run ffi
11 | # or edit .env file
12 | ```
13 |
--------------------------------------------------------------------------------
/bench/async/.env:
--------------------------------------------------------------------------------
1 | BUN=bun
2 | DENO=deno
3 | NODE=node
--------------------------------------------------------------------------------
/bench/async/bun.js:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 |
3 | bench("sync", () => {});
4 | bench("async", async () => {});
5 | bench("await 1", async () => await 1);
6 |
7 | await run();
8 |
--------------------------------------------------------------------------------
/bench/async/deno.js:
--------------------------------------------------------------------------------
1 | import { run, bench } from "../node_modules/mitata/src/cli.mjs";
2 |
3 | bench("sync", () => {});
4 | bench("async", async () => {});
5 | bench("await 1", async () => await 1);
6 |
7 | await run();
8 |
--------------------------------------------------------------------------------
/bench/async/node.mjs:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 |
3 | bench("sync", () => {});
4 | bench("async", async () => {});
5 | bench("await 1", async () => await 1);
6 |
7 | await run();
8 |
--------------------------------------------------------------------------------
/bench/async/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "scripts": {
4 | "deps": "exit 0",
5 | "build": "exit 0",
6 | "bench:bun": "$BUN bun.js",
7 | "bench:node": "$NODE node.mjs",
8 | "bench:deno": "$DENO run -A --unstable deno.js",
9 | "bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/bench/cat/bun.js:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 | const { write, stdout, file } = Bun;
3 | const input = resolve(process.argv[process.argv.length - 1]);
4 |
5 | await write(stdout, file(input));
6 |
--------------------------------------------------------------------------------
/bench/cat/cat.mjs:
--------------------------------------------------------------------------------
1 | // works in both bun & node
2 | import { readFileSync } from "node:fs";
3 | const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;
4 |
5 | const arg = process.argv.slice(1);
6 |
7 | // TODO: remove Buffer.from() when readFileSync() returns Buffer
8 |
9 | for (let i = 0; i < count; i++)
10 | console.log(
11 | arg.map((file) => Buffer.from(readFileSync(file, "utf8"))).join("")
12 | );
13 |
--------------------------------------------------------------------------------
/bench/cat/node.js:
--------------------------------------------------------------------------------
1 | const fs = require("fs");
2 | const path = require("path");
3 |
4 | const input = path.resolve(process.argv[process.argv.length - 1]);
5 |
6 | fs.createReadStream(input).pipe(process.stdout);
7 |
--------------------------------------------------------------------------------
/bench/copyfile/bun.js:
--------------------------------------------------------------------------------
1 | import path from "path";
2 | const input = path.resolve(process.argv[process.argv.length - 2]);
3 | const output = path.resolve(process.argv[process.argv.length - 1]);
4 |
5 | await Bun.write(Bun.file(output), Bun.file(input));
6 |
--------------------------------------------------------------------------------
/bench/copyfile/node-streams.js:
--------------------------------------------------------------------------------
1 | import { createReadStream, createWriteStream } from "node:fs";
2 |
3 | const arg = process.argv.slice(2);
4 | createReadStream(arg[0]).pipe(createWriteStream(arg[1]));
5 |
--------------------------------------------------------------------------------
/bench/copyfile/node.mjs:
--------------------------------------------------------------------------------
1 | import { copyFileSync } from "node:fs";
2 |
3 | const arg = process.argv.slice(2);
4 |
5 | copyFileSync(arg[0], arg[1]);
6 |
--------------------------------------------------------------------------------
/bench/ffi/.env:
--------------------------------------------------------------------------------
1 | BUN=bun
2 | DENO=deno
3 | NODE=node
--------------------------------------------------------------------------------
/bench/ffi/node.mjs:
--------------------------------------------------------------------------------
1 | import { run, bench, group } from "mitata";
2 | import { createRequire } from "node:module";
3 |
4 | const require = createRequire(import.meta.url);
5 | const { napiNoop, napiHash, napiString } = require("./src/ffi_napi_bench.node");
6 |
7 | const bytes = new Uint8Array(64);
8 |
9 | group("napi", () => {
10 | bench("noop", () => napiNoop());
11 | bench("hash", () => napiHash(bytes));
12 |
13 | bench("string", () => napiString());
14 | });
15 |
16 | await run();
17 |
--------------------------------------------------------------------------------
/bench/ffi/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "scripts": {
4 | "bench:bun": "$BUN bun.js",
5 | "bench:node": "$NODE node.mjs",
6 | "deps": "cd src && bun run deps",
7 | "build": "cd src && bun run build",
8 | "bench:deno": "$DENO run -A --unstable deno.js",
9 | "bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/bench/ffi/src/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | edition = "2021"
3 | version = "0.1.0"
4 | name = "ffi_napi_bench"
5 |
6 | [lib]
7 | crate-type = ["cdylib"]
8 |
9 | [features]
10 | default = []
11 | enable-napi = []
12 |
13 | [dependencies]
14 | napi = "2"
15 | napi-derive = "2"
16 |
17 | [build-dependencies]
18 | napi-build = "2.0.1"
--------------------------------------------------------------------------------
/bench/ffi/src/build.rs:
--------------------------------------------------------------------------------
1 | #[cfg(feature="enable-napi")] extern crate napi_build;
2 |
3 | fn main() {
4 | #[cfg(feature="enable-napi")] napi_build::setup();
5 | }
--------------------------------------------------------------------------------
/bench/ffi/src/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/bench/ffi/src/bun.lockb
--------------------------------------------------------------------------------
/bench/ffi/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "napi": {
4 | "name": "napi"
5 | },
6 | "dependencies": {
7 | "@napi-rs/cli": "^2.10.1",
8 | "@node-rs/helper": "^1.3.3"
9 | },
10 | "scripts": {
11 | "deps": "bun install",
12 | "build:ffi": "cargo build --release",
13 | "build": "bun run build:napi && bun run build:ffi",
14 | "cleanup": "rm -f index.js index.d.ts && mv napi.*.node ffi_napi_bench.node",
15 | "build:napi": "napi build --release --platform --no-dts-header --features enable-napi && bun run cleanup"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/bench/gzip/.env:
--------------------------------------------------------------------------------
1 | BUN=bun
2 | DENO=deno
3 | NODE=node
--------------------------------------------------------------------------------
/bench/gzip/bun.js:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 | import { gzipSync, gunzipSync } from "bun";
3 |
4 | const data = new TextEncoder().encode("Hello World!".repeat(9999));
5 |
6 | const compressed = gzipSync(data);
7 |
8 | bench(`roundtrip - "Hello World!".repeat(9999))`, () => {
9 | gunzipSync(gzipSync(data));
10 | });
11 |
12 | bench(`gzipSync("Hello World!".repeat(9999)))`, () => {
13 | gzipSync(data);
14 | });
15 |
16 | bench(`gunzipSync("Hello World!".repeat(9999)))`, () => {
17 | gunzipSync(compressed);
18 | });
19 |
20 | await run();
21 |
--------------------------------------------------------------------------------
/bench/gzip/node.mjs:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 | import { gzipSync, gunzipSync } from "zlib";
3 |
4 | const data = new TextEncoder().encode("Hello World!".repeat(9999));
5 |
6 | const compressed = gzipSync(data);
7 |
8 | bench(`roundtrip - "Hello World!".repeat(9999))`, () => {
9 | gunzipSync(gzipSync(data));
10 | });
11 |
12 | bench(`gzipSync("Hello World!".repeat(9999)))`, () => {
13 | gzipSync(data);
14 | });
15 |
16 | bench(`gunzipSync("Hello World!".repeat(9999)))`, () => {
17 | gunzipSync(compressed);
18 | });
19 |
20 | await run();
21 |
--------------------------------------------------------------------------------
/bench/gzip/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "scripts": {
4 | "deps": "exit 0",
5 | "build": "exit 0",
6 | "bench:bun": "$BUN bun.js",
7 | "bench:node": "$NODE node.mjs",
8 | "bench:deno": "$DENO run -A --unstable deno.js",
9 | "bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/.gitignore:
--------------------------------------------------------------------------------
1 | bun
2 | next
3 | src/*.mov
4 | src/*.blob
5 |
6 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/bun.latest.16ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=16 PROJECT=bun node read-frames.js
2 | bun
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 22.2ms
7 | 75th percentile: 23.9ms
8 | 90th percentile: 25.3ms
9 | 95th percentile: 43.6ms
10 | 99th percentile: 49.1ms
11 | Rendered frames: 922 / 1024 (90%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/bun.latest.24ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=24 PROJECT=bun node read-frames.js
2 | bun
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 33.4ms
7 | 75th percentile: 34.5ms
8 | 90th percentile: 35.8ms
9 | 95th percentile: 65.5ms
10 | 99th percentile: 87.9ms
11 | Rendered frames: 937 / 1024 (92%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/bun.latest.32ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=32 PROJECT=bun node read-frames.js
2 | bun
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 40.7ms
7 | 75th percentile: 42.3ms
8 | 90th percentile: 43.5ms
9 | 95th percentile: 76.4ms
10 | 99th percentile: 118.8ms
11 | Rendered frames: 958 / 1024 (94%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/bun.latest.8ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=8 PROJECT=bun node read-frames.js
2 | bun
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 20ms
7 | 75th percentile: 24.4ms
8 | 90th percentile: 41ms
9 | 95th percentile: 53.9ms
10 | 99th percentile: 90.4ms
11 | Rendered frames: 475 / 1024 (46%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/inject.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | export { React };
3 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
5 | // NOTE: This file should not be edited
6 | // see https://nextjs.org/docs/basic-features/typescript for more information.
7 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | experimental: {
3 | swcLoader: true,
4 | },
5 | };
6 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next.latest.16ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=16 PROJECT=next node read-frames.js
2 | next
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 312ms
7 | 75th percentile: 337.6ms
8 | 90th percentile: 387.7ms
9 | 95th percentile: 446.9ms
10 | 99th percentile: 591.7ms
11 | Rendered frames: 64 / 1024 (6%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next.latest.24ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=24 PROJECT=next node read-frames.js
2 | next
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 310.1ms
7 | 75th percentile: 360.3ms
8 | 90th percentile: 461.6ms
9 | 95th percentile: 660.4ms
10 | 99th percentile: 1009.9ms
11 | Rendered frames: 78 / 1024 (8%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next.latest.32ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=32 PROJECT=next node read-frames.js
2 | next
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 306.7ms
7 | 75th percentile: 324.7ms
8 | 90th percentile: 380ms
9 | 95th percentile: 483.6ms
10 | 99th percentile: 933.6ms
11 | Rendered frames: 116 / 1024 (11%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/next.latest.8ms.txt:
--------------------------------------------------------------------------------
1 | SLEEP_INTERVAL=8 PROJECT=next node read-frames.js
2 | next
3 | --------------------------------------------------
4 | CSS HMR FRAME TIME
5 |
6 | 50th percentile: 320.4ms
7 | 75th percentile: 368.8ms
8 | 90th percentile: 527.2ms
9 | 95th percentile: 532.4ms
10 | 99th percentile: 532.4ms
11 | Rendered frames: 32 / 1024 (3%)
12 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import "../src/index.css";
2 |
3 | import App from "next/app";
4 |
5 | class MyApp extends App {
6 | render() {
7 | const { Component, pageProps } = this.props;
8 | return ;
9 | }
10 | }
11 |
12 | export default MyApp;
13 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/pages/index.tsx:
--------------------------------------------------------------------------------
1 | import { Main } from "src/main";
2 | export function IndexPage() {
3 | return (
4 |
9 | );
10 | }
11 |
12 | export default IndexPage;
13 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/react-inject.js:
--------------------------------------------------------------------------------
1 | export { default as React } from "react";
2 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/src/colors.css:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/bench/hot-module-reloading/css-stress-test/src/colors.css
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/src/colors.css.0:
--------------------------------------------------------------------------------
1 | :root {
2 | --timestamp: "0";
3 | --interval: "8";
4 | --progress-bar: 0%;
5 | --spinner-1-muted: rgb(179, 6, 202);
6 | --spinner-1-primary: rgb(224, 8, 253);
7 | --spinner-2-muted: rgb(22, 188, 124);
8 | --spinner-2-primary: rgb(27, 235, 155);
9 | --spinner-3-muted: rgb(89, 72, 0);
10 | --spinner-3-primary: rgb(111, 90, 0);
11 | --spinner-4-muted: rgb(18, 84, 202);
12 | --spinner-4-primary: rgb(23, 105, 253);
13 | --spinner-rotate: 304deg;
14 | }
15 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/src/css-in-js-styles.tsx:
--------------------------------------------------------------------------------
1 | import { Global } from "@emotion/react";
2 | export function CSSInJSStyles() {
3 | return (
4 |
21 | );
22 | }
23 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/src/index.tsx:
--------------------------------------------------------------------------------
1 | import { Main } from "./main";
2 | import classNames from "classnames";
3 | import ReactDOM from "react-dom";
4 |
5 | const Base = ({}) => {
6 | const name =
7 | typeof location !== "undefined"
8 | ? decodeURIComponent(location.search.substring(1))
9 | : null;
10 | return ;
11 | };
12 |
13 | function startReact() {
14 | ReactDOM.hydrate(, document.querySelector("#reactroot"));
15 | }
16 |
17 | if (typeof window !== "undefined") {
18 | globalThis.addEventListener("DOMContentLoaded", () => {
19 | startReact();
20 | });
21 |
22 | startReact();
23 | }
24 |
25 | export { Base };
26 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "paths": {}
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/bench/hot-module-reloading/css-stress-test/vite.config.js:
--------------------------------------------------------------------------------
1 | import reactRefresh from "@vitejs/plugin-react-refresh";
2 |
3 | export default {
4 | plugins: [reactRefresh()],
5 | };
6 |
--------------------------------------------------------------------------------
/bench/log/bun.js:
--------------------------------------------------------------------------------
1 | import { bench, run } from "mitata";
2 |
3 | bench("console.log", () => console.log("hello"));
4 | await run();
5 |
--------------------------------------------------------------------------------
/bench/log/deno.mjs:
--------------------------------------------------------------------------------
1 | import { bench, run } from "../../node_modules/mitata/src/cli.mjs";
2 |
3 | bench("console.log", () => console.log("hello"));
4 | await run();
5 |
--------------------------------------------------------------------------------
/bench/log/node.mjs:
--------------------------------------------------------------------------------
1 | import { bench, run } from "mitata";
2 |
3 | bench("console.log", () => console.log("hello"));
4 | await run();
5 |
--------------------------------------------------------------------------------
/bench/module-loader/.gitignore:
--------------------------------------------------------------------------------
1 | output
2 | import.mjs
3 | require.js
4 | meta.*
5 | *.mjs
6 |
--------------------------------------------------------------------------------
/bench/module-loader/stub.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/bench/module-loader/stub.js
--------------------------------------------------------------------------------
/bench/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "dependencies": {
4 | "mitata": "^0.1.6",
5 | "esbuild": "^0.14.12",
6 | "@swc/core": "^1.2.133",
7 | "@babel/core": "^7.16.10",
8 | "@babel/preset-react": "^7.16.7"
9 | },
10 | "scripts": {
11 | "ffi": "cd ffi && bun run deps && bun run build && bun run bench",
12 | "gzip": "cd gzip && bun run deps && bun run build && bun run bench",
13 | "async": "cd async && bun run deps && bun run build && bun run bench",
14 | "sqlite": "cd sqlite && bun run deps && bun run build && bun run bench"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/bench/react-hello-world/react-hello-world.jsx:
--------------------------------------------------------------------------------
1 | // import { renderToReadableStream } from "react-dom/server.browser";
2 | var { renderToReadableStream } = import.meta.require(
3 | "../../test/bun.js/reactdom-bun.js"
4 | );
5 |
6 | const headers = {
7 | headers: {
8 | "Content-Type": "text/html",
9 | "Cache-Control": "no-transform", // set to match the Deno benchmark, which requires this for an apples to apples comparison
10 | },
11 | };
12 |
13 | const App = () => (
14 |
15 |
16 | Hello World
17 |
18 |
19 | );
20 |
21 | export default {
22 | async fetch(req) {
23 | return new Response(await renderToReadableStream(), headers);
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/bench/scanner/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/bench/scanner/bun.lockb
--------------------------------------------------------------------------------
/bench/scanner/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "scan",
3 | "dependencies": {
4 | "esbuild": "^0.14.11"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/bench/scanner/remix-route.ts:
--------------------------------------------------------------------------------
1 | import { useParams } from "remix";
2 | import type { LoaderFunction, ActionFunction } from "remix";
3 |
4 | export const loader: LoaderFunction = async ({ params }) => {
5 | console.log(params.postId);
6 | };
7 |
8 | export const action: ActionFunction = async ({ params }) => {
9 | console.log(params.postId);
10 | };
11 |
12 | export default function PostRoute() {
13 | const params = useParams();
14 | console.log(params.postId);
15 | }
16 |
--------------------------------------------------------------------------------
/bench/scanner/scan-imports-only.js:
--------------------------------------------------------------------------------
1 | import { readFileSync } from "fs";
2 | const fixture = ["action", "default", "loader"];
3 |
4 | const transpiler = new Bun.Transpiler({
5 | loader: "ts",
6 | });
7 |
8 | console.time("Get exports");
9 | const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1;
10 | for (let i = 0; i < ITERATIONS; i++) {
11 | const imports = transpiler.scanImports(
12 | readFileSync("remix-route.ts", "utf8")
13 | );
14 | }
15 | console.timeEnd("Get exports");
16 |
--------------------------------------------------------------------------------
/bench/scanner/scan.bun.js:
--------------------------------------------------------------------------------
1 | import { readFileSync } from "fs";
2 | const fixture = ["action", "default", "loader"];
3 | const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1;
4 |
5 | const transpiler = new Bun.Transpiler({
6 | loader: "ts",
7 | });
8 |
9 | console.time("Get exports");
10 | const file = readFileSync("remix-route.ts", "utf8");
11 | for (let i = 0; i < ITERATIONS; i++) {
12 | const { imports, exports } = transpiler.scan(file);
13 |
14 | for (let j = 0; j < fixture.length; j++) {
15 | if (fixture[j] !== exports[j]) {
16 | throw new Error("Mismatch");
17 | }
18 | }
19 | }
20 |
21 | console.timeEnd("Get exports");
22 |
--------------------------------------------------------------------------------
/bench/snippets/exists.js:
--------------------------------------------------------------------------------
1 | const { existsSync } = require("fs");
2 | const cwd = process.cwd();
3 |
4 | const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;
5 |
6 | for (let i = 0; i < count; i++) existsSync(cwd);
7 |
--------------------------------------------------------------------------------
/bench/snippets/noop.js:
--------------------------------------------------------------------------------
1 | import { bench, run } from "mitata";
2 |
3 | var noop = globalThis[Symbol.for("Bun.lazy")]("noop");
4 |
5 | bench("function", function () {
6 | noop.function();
7 | });
8 |
9 | bench("setter", function () {
10 | noop.getterSetter = 1;
11 | });
12 |
13 | bench("getter", function () {
14 | noop.getterSetter;
15 | });
16 |
17 | run();
18 |
--------------------------------------------------------------------------------
/bench/snippets/performance-now-overhead.js:
--------------------------------------------------------------------------------
1 | import { group } from "mitata";
2 | import { bench, run } from "mitata";
3 | bench("performance.now x 1000", () => {
4 | for (let i = 0; i < 1000; i++) {
5 | performance.now();
6 | }
7 | });
8 |
9 | if ("Bun" in globalThis) {
10 | var nanoseconds = Bun.nanoseconds;
11 | bench("Bun.nanoseconds x 1000", () => {
12 | for (let i = 0; i < 1000; i++) {
13 | nanoseconds();
14 | }
15 | });
16 | }
17 | await run();
18 |
--------------------------------------------------------------------------------
/bench/snippets/realpath.mjs:
--------------------------------------------------------------------------------
1 | import { realpathSync } from "node:fs";
2 | const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;
3 | const arg = process.argv[process.argv.length - 1];
4 | for (let i = 0; i < count; i++) realpathSync(arg);
5 |
--------------------------------------------------------------------------------
/bench/snippets/render.js:
--------------------------------------------------------------------------------
1 | import decoding from "./jsx-entity-decoding";
2 | import ReactDOMServer from "react-dom/server.browser";
3 |
4 | console.log(ReactDOMServer.renderToString(decoding));
5 |
--------------------------------------------------------------------------------
/bench/sqlite/.env:
--------------------------------------------------------------------------------
1 | BUN=bun
2 | DENO=deno
3 | NODE=node
--------------------------------------------------------------------------------
/bench/sqlite/bun.js:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 | import { Database } from "bun:sqlite";
3 |
4 | const db = Database.open("./src/northwind.sqlite");
5 |
6 | {
7 | const sql = db.prepare(`SELECT * FROM "Order"`);
8 | bench('SELECT * FROM "Order"', () => {
9 | sql.all();
10 | });
11 | }
12 |
13 | {
14 | const sql = db.prepare(`SELECT * FROM "Product"`);
15 | bench('SELECT * FROM "Product"', () => {
16 | sql.all();
17 | });
18 | }
19 |
20 | {
21 | const sql = db.prepare(`SELECT * FROM "OrderDetail"`);
22 | bench('SELECT * FROM "OrderDetail"', () => {
23 | sql.all();
24 | });
25 | }
26 |
27 | await run();
28 |
--------------------------------------------------------------------------------
/bench/sqlite/deno.js:
--------------------------------------------------------------------------------
1 | import { DB } from "https://deno.land/x/sqlite/mod.ts";
2 | import { run, bench } from "../node_modules/mitata/src/cli.mjs";
3 |
4 | const db = new DB("./src/northwind.sqlite");
5 |
6 | {
7 | const sql = db.prepareQuery(`SELECT * FROM "Order"`);
8 | bench('SELECT * FROM "Order"', () => {
9 | sql.allEntries();
10 | });
11 | }
12 |
13 | {
14 | const sql = db.prepareQuery(`SELECT * FROM "Product"`);
15 | bench('SELECT * FROM "Product"', () => {
16 | sql.allEntries();
17 | });
18 | }
19 |
20 | {
21 | const sql = db.prepareQuery(`SELECT * FROM "OrderDetail"`);
22 | bench('SELECT * FROM "OrderDetail"', () => {
23 | sql.allEntries();
24 | });
25 | }
26 |
27 | await run();
28 |
--------------------------------------------------------------------------------
/bench/sqlite/node.mjs:
--------------------------------------------------------------------------------
1 | import { run, bench } from "mitata";
2 | import { createRequire } from "module";
3 |
4 | const require = createRequire(import.meta.url);
5 | const db = require("better-sqlite3")("./src/northwind.sqlite");
6 |
7 | {
8 | const sql = db.prepare(`SELECT * FROM "Order"`);
9 |
10 | bench('SELECT * FROM "Order"', () => {
11 | sql.all();
12 | });
13 | }
14 |
15 | {
16 | const sql = db.prepare(`SELECT * FROM "Product"`);
17 |
18 | bench('SELECT * FROM "Product"', () => {
19 | sql.all();
20 | });
21 | }
22 |
23 | {
24 | const sql = db.prepare(`SELECT * FROM "OrderDetail"`);
25 |
26 | bench('SELECT * FROM "OrderDetail"', () => {
27 | sql.all();
28 | });
29 | }
30 |
31 | await run();
32 |
--------------------------------------------------------------------------------
/bench/sqlite/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bench",
3 | "dependencies": {
4 | "better-sqlite3": "^7.6.0"
5 | },
6 | "scripts": {
7 | "build": "exit 0",
8 | "bench:bun": "$BUN bun.js",
9 | "bench:node": "$NODE node.mjs",
10 | "deps": "npm install && sh src/download.sh",
11 | "bench:deno": "$DENO run -A --unstable deno.js",
12 | "bench": "bun run bench:bun && bun run bench:node && bun run bench:deno"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/bench/sqlite/src/download.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -euo pipefail
3 |
4 | if [ -f src/northwind.sqlite ]; then
5 | exit 0
6 | fi
7 |
8 | curl -LJO https://raw.githubusercontent.com/jpwhite3/northwind-SQLite3/master/Northwind_large.sqlite.zip
9 |
10 | unzip Northwind_large.sqlite.zip
11 |
12 | rm Northwind_large.sqlite.zip
13 | mv Northwind_large.sqlite src/northwind.sqlite
14 |
15 | rm -rf __MACOSX
16 | rm -rf Northwind* || echo ""
--------------------------------------------------------------------------------
/build-id:
--------------------------------------------------------------------------------
1 | 4
2 |
--------------------------------------------------------------------------------
/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/bun.lockb
--------------------------------------------------------------------------------
/completions/bun.bash:
--------------------------------------------------------------------------------
1 | #/usr/bin/env bash
2 |
3 | # This is not implemented yet.
4 | # But a PR implementing it would be very welcome!
5 | _bun_completions() {
6 | }
7 |
8 | complete -F _bun_completions bun
9 |
--------------------------------------------------------------------------------
/entitlements.debug.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.cs.allow-jit
6 |
7 | com.apple.security.cs.allow-unsigned-executable-memory
8 |
9 | com.apple.security.cs.disable-executable-page-protection
10 |
11 | com.apple.security.cs.allow-dyld-environment-variables
12 |
13 | com.apple.security.cs.disable-library-validation
14 |
15 | com.apple.security.get-task-allow
16 |
17 |
18 |
--------------------------------------------------------------------------------
/entitlements.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.cs.allow-jit
6 |
7 | com.apple.security.cs.allow-unsigned-executable-memory
8 |
9 | com.apple.security.cs.disable-executable-page-protection
10 |
11 | com.apple.security.cs.allow-dyld-environment-variables
12 |
13 | com.apple.security.cs.disable-library-validation
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/.gitignore:
--------------------------------------------------------------------------------
1 | bun-examples-all
--------------------------------------------------------------------------------
/examples/.is-examples-folder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/.is-examples-folder
--------------------------------------------------------------------------------
/examples/add.rs:
--------------------------------------------------------------------------------
1 | #[no_mangle]
2 | pub extern "C" fn add(a: i32, b: i32) -> i32 {
3 | a + b
4 | }
5 |
6 | // to compile:
7 | // rustc --crate-type cdylib add.rs
8 |
--------------------------------------------------------------------------------
/examples/add.ts:
--------------------------------------------------------------------------------
1 | import { dlopen, suffix } from "bun:ffi";
2 |
3 | const {
4 | symbols: { add },
5 | } = dlopen(`./libadd.${suffix}`, {
6 | add: {
7 | args: ["i32", "i32"],
8 | returns: "i32",
9 | },
10 | });
11 |
12 | console.log(add(1, 2));
13 |
--------------------------------------------------------------------------------
/examples/add.zig:
--------------------------------------------------------------------------------
1 | pub export fn add(a: i32, b: i32) i32 {
2 | return a + b;
3 | }
4 |
5 | // to compile:
6 | // zig build-lib -OReleaseFast ./add.zig -dynamic --name add
7 |
--------------------------------------------------------------------------------
/examples/blank/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "@bun-examples/blank",
4 | "main": "src/index.js",
5 | "devDependencies": {
6 | "bun-types": "^0.0.83"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/examples/blank/src/index.js:
--------------------------------------------------------------------------------
1 | console.log('Hello, World!');
2 |
--------------------------------------------------------------------------------
/examples/blank/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | // "bun-types" is the important part
7 | "types": ["bun-types"]
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/examples/bun-bakery/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | **/*.trace
37 | **/*.zip
38 | **/*.tar.gz
39 | **/*.tgz
40 | **/*.log
41 | package-lock.json
42 | **/*.bun
--------------------------------------------------------------------------------
/examples/bun-bakery/assets/bunbakery.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/bun-bakery/assets/bunbakery.png
--------------------------------------------------------------------------------
/examples/bun-bakery/main.ts:
--------------------------------------------------------------------------------
1 | import {Router} from "@kapsonfire/bun-bakery"
2 |
3 |
4 | new Router({
5 | port: 3000,
6 | assetsPath: import.meta.dir + '/assets/',
7 | routesPath: import.meta.dir + '/routes/'
8 | })
--------------------------------------------------------------------------------
/examples/bun-bakery/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "@bun-examples/bun-bakery",
4 | "dependencies": {
5 | "@kapsonfire/bun-bakery": "^0.2.0"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/bun-bakery/routes/index.ts:
--------------------------------------------------------------------------------
1 | import {Context} from "@kapsonfire/bun-bakery"
2 |
3 | export async function GET(ctx: Context) {
4 | ctx.sendHTML('
Hello World!
');
5 | }
--------------------------------------------------------------------------------
/examples/bun-bakery/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "types": ["bun-types"],
4 | "module": "esnext",
5 | "moduleResolution": "Node"
6 | }
7 | }
--------------------------------------------------------------------------------
/examples/cat.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 | const { write, stdout, file } = Bun;
3 | const { argv } = process;
4 |
5 | const path = resolve(argv.at(-1));
6 | await write(stdout, file(path));
7 |
--------------------------------------------------------------------------------
/examples/change-array-by-copy.js:
--------------------------------------------------------------------------------
1 | const sequence = [1, 2, 3];
2 | sequence.toReversed(); // => [3, 2, 1]
3 | sequence; // => [1, 2, 3]
4 |
5 | const outOfOrder = new Uint8Array([3, 1, 2]);
6 | outOfOrder.toSorted(); // => Uint8Array [1, 2, 3]
7 | outOfOrder; // => Uint8Array [3, 1, 2]
8 |
9 | const correctionNeeded = [1, 1, 3];
10 | correctionNeeded.with(1, 2); // => [1, 2, 3]
11 | correctionNeeded; // => [1, 1, 3]
12 |
--------------------------------------------------------------------------------
/examples/discord-interactions/.env.example:
--------------------------------------------------------------------------------
1 | DISCORD_APP_ID=
2 | DISCORD_BOT_TOKEN=
3 | DISCORD_PUBLIC_KEY=
--------------------------------------------------------------------------------
/examples/discord-interactions/README.md:
--------------------------------------------------------------------------------
1 | # /create with Bun runtime
2 |
3 | A [slash-create](https://npm.im/slash-create) template, using [Bun runtime](https://bun.sh).
4 |
5 | ## Getting Started
6 |
7 | ### Cloning the repo
8 |
9 | ```sh
10 | bun create discord-interactions interactions-bot
11 | ```
12 |
13 | ### Development
14 |
15 | To run this locally, rename `.env.example` to `.env` and fill in the variables, then run `bun run.js` to start a local dev environment and use something similar to [ngrok](https://ngrok.com/) or [cloudflare](https://www.cloudflare.com/) to tunnel it to a URL.
16 |
--------------------------------------------------------------------------------
/examples/discord-interactions/commands/hello.js:
--------------------------------------------------------------------------------
1 | import { SlashCommand, CommandOptionType } from 'slash-create';
2 |
3 | export default class HelloCommand extends SlashCommand {
4 | constructor(creator) {
5 | super(creator, {
6 | name: 'hello',
7 | description: 'Says hello to you.',
8 | options: [{
9 | type: CommandOptionType.STRING,
10 | name: 'food',
11 | description: 'What food do you like?'
12 | }]
13 | });
14 |
15 | this.filePath = __filename;
16 | }
17 |
18 | async run(ctx) {
19 | return ctx.options.food ? `You like ${ctx.options.food}? Nice!` : `Hello, ${ctx.user.username}!`;
20 | }
21 | }
--------------------------------------------------------------------------------
/examples/discord-interactions/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.0.5",
3 | "name": "@bun-examples/discord-interactions",
4 | "dependencies": {
5 | "slash-create": "^5.7.0"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/discord-interactions/polyfill.js:
--------------------------------------------------------------------------------
1 | Error.captureStackTrace = () => {};
2 | Buffer.isBuffer = Buffer.isBuffer.bind(Buffer);
--------------------------------------------------------------------------------
/examples/discord-interactions/run.js:
--------------------------------------------------------------------------------
1 | // polyfill v8 and node (TODO: fix in bun)
2 | import './polyfill.js';
3 |
4 | import path from 'node:path';
5 | import { BunServer, BunSlashCreator } from './bun_shim/index.js';
6 |
7 | const client = new BunSlashCreator({
8 | token: process.env.DISCORD_BOT_TOKEN,
9 | publicKey: process.env.DISCORD_PUBLIC_KEY,
10 | applicationID: process.env.DISCORD_APP_ID,
11 | });
12 |
13 | // client.on('debug', console.log);
14 | client.on('error', console.error);
15 |
16 | client.withServer(new BunServer());
17 | await client.registerCommandsIn(path.join(__dirname, 'commands'));
18 |
19 | client.syncCommands();
20 | await client.server.listen(1337);
21 |
22 | // client.server.stop(); // stop server
--------------------------------------------------------------------------------
/examples/hashing.js:
--------------------------------------------------------------------------------
1 | // Accepts a string, TypedArray, or Blob (file blob supported is not implemented but planned)
2 | const input = "hello world".repeat(400);
3 |
4 | // Bun.hash() defaults to Wyhash because it's fast
5 | console.log(Bun.hash(input));
6 |
7 | console.log(Bun.hash.wyhash(input));
8 | // and returns a number
9 | // all of these hashing functions return numbers, not typed arrays.
10 | console.log(Bun.hash.adler32(input));
11 | console.log(Bun.hash.crc32(input));
12 | console.log(Bun.hash.cityHash32(input));
13 | console.log(Bun.hash.cityHash64(input));
14 | console.log(Bun.hash.murmur32v3(input));
15 | console.log(Bun.hash.murmur64v2(input));
16 |
17 | // Second argument accepts a seed where relevant
18 | console.log(Bun.hash(input, 12345));
19 |
--------------------------------------------------------------------------------
/examples/hono/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "name": "@bun-examples/hono",
4 | "main": "src/index.js",
5 | "devDependencies": {
6 | "bun-types": "^0.0.83"
7 | },
8 | "dependencies": {
9 | "hono": "^1.6.4"
10 | },
11 | "scripts": {
12 | "start": "bun run src/index.ts"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/examples/hono/readme.md:
--------------------------------------------------------------------------------
1 | # Hono with Bun runtime
2 |
3 | ## Getting Started
4 |
5 | ### Cloning the repo
6 |
7 | ```sh
8 | bun create hono ./NAME_HERE
9 | ```
10 |
11 | ### Development
12 | ```
13 | bun run start
14 | ```
15 |
16 | Open http://localhost:3000 with your browser to see the result.
17 |
18 |
--------------------------------------------------------------------------------
/examples/hono/src/index.ts:
--------------------------------------------------------------------------------
1 | import { Hono } from "hono";
2 |
3 | const app = new Hono();
4 |
5 | const port = process.env.PORT || 3000;
6 |
7 | const home = app.get("/", (c) => {
8 | return c.json({ message: "Hello World!" });
9 | });
10 |
11 | console.log(`Running at http://localhost:${port}`);
12 |
13 | export default {
14 | port: process.env.PORT || 3000,
15 | fetch: home.fetch,
16 | };
17 |
--------------------------------------------------------------------------------
/examples/hono/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "moduleResolution": "node",
7 | // "bun-types" is the important part
8 | "types": ["bun-types"]
9 | }
10 | }
--------------------------------------------------------------------------------
/examples/http-stop.ts:
--------------------------------------------------------------------------------
1 | import { serve } from "bun";
2 |
3 | const server = serve({
4 | fetch(req) {
5 | return new Response(`Pending requests count: ${this.pendingRequests}`);
6 | },
7 | });
8 |
9 | // Stop the server after 5 seconds
10 | setTimeout(() => {
11 | server.stop();
12 | }, 5000);
13 |
--------------------------------------------------------------------------------
/examples/macros/components/example.jsx:
--------------------------------------------------------------------------------
1 | // source code
2 | import { matchInFile } from "macro:matchInFile";
3 |
4 | export const IPAddresses = () => (
5 |
6 |
recent ip addresses
7 |
8 | {matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map(
9 | (ipAddress, index) => (
10 |
11 | {ipAddress}
12 |
13 | )
14 | )}
15 |
16 |
17 | );
18 |
--------------------------------------------------------------------------------
/examples/macros/components/index.tsx:
--------------------------------------------------------------------------------
1 | import * as ReactDOM from "react-dom";
2 | import * as React from "react";
3 | import { IPAddresses } from "./example";
4 | import { Covid19 } from "./covid19";
5 |
6 | const Start = function () {
7 | const root = document.createElement("div");
8 | document.body.appendChild(root);
9 |
10 | // comment out to switch between examples
11 | // ReactDOM.render(, root);
12 | ReactDOM.render(, root);
13 | };
14 |
15 | Start();
16 |
--------------------------------------------------------------------------------
/examples/macros/example.js:
--------------------------------------------------------------------------------
1 | // source code
2 | import { mysteryBox } from "macro:./mystery-box";
3 |
4 | export default "You roll! " + mysteryBox(123);
5 |
--------------------------------------------------------------------------------
/examples/macros/matchInFile.tsx:
--------------------------------------------------------------------------------
1 | // macro code
2 | export function matchInFile(callExpression: BunAST.CallExpression) {
3 | const [filePathNode, matcherNode] = callExpression.arguments;
4 | let filePath: string;
5 | filePath = filePathNode.get();
6 |
7 | let matcher: RegExp;
8 | matcher = matcherNode.get();
9 | const file: string = Bun.readFile(Bun.cwd + filePath);
10 |
11 | return (
12 |
13 | {file
14 | .split("\n")
15 | .map((line) => line.match(matcher))
16 | .filter(Boolean)
17 | .reverse()
18 | .map((line) => (
19 |
20 | ))}
21 |
22 | );
23 | }
24 |
--------------------------------------------------------------------------------
/examples/macros/now.tsx:
--------------------------------------------------------------------------------
1 | import moment from "moment";
2 | export function now(node) {
3 | var fmt = "HH:mm:ss";
4 | const args = node.arguments;
5 | if (args[0] instanceof ) {
6 | fmt = args[0].get();
7 | }
8 | const time = moment().format(fmt);
9 | return ;
10 | }
11 |
--------------------------------------------------------------------------------
/examples/macros/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "macros",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "dependencies": {
7 | "moment": "^2.29.1",
8 | "papaparse": "^5.3.1",
9 | "react": "^17.0.2",
10 | "react-dom": "^17.0.2",
11 | "react-refresh": "^0.10.0"
12 | },
13 | "devDependencies": {
14 | "@types/react": "^17.0.24",
15 | "@types/react-dom": "^17.0.9"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/examples/macros/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Macro test
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/examples/macros/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "paths": {},
5 | "jsx": "preserve"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/examples/mmap/1.js:
--------------------------------------------------------------------------------
1 | const map = Bun.mmap("./mmap.txt", { shared: true });
2 | const utf8decoder = new TextDecoder("utf-8");
3 |
4 | let old = new TextEncoder().encode("12345");
5 |
6 | setInterval(() => {
7 | old = old.sort((a, b) => (Math.random() > 0.5 ? -1 : 1));
8 | console.log(`changing mmap to ~> ${utf8decoder.decode(old)}`);
9 |
10 | map.set(old);
11 | }, 4);
12 |
--------------------------------------------------------------------------------
/examples/mmap/2.js:
--------------------------------------------------------------------------------
1 | const map = Bun.mmap("./mmap.txt");
2 |
3 | function buffer_hash(buffer) {
4 | let hash = 0;
5 | for (let i = 0; i < buffer.length; i++) {
6 | hash = (hash << 5) - hash + buffer[i];
7 | hash |= 0; // Convert to 32bit integer
8 | }
9 | return hash;
10 | }
11 |
12 | const decoder = new TextDecoder();
13 |
14 | let hash = buffer_hash(map);
15 | console.log(decoder.decode(map));
16 |
17 | while (true) {
18 | if (buffer_hash(map) !== hash) {
19 | hash = buffer_hash(map);
20 | console.log(`mmap changed to ~> ${decoder.decode(map)}`);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/examples/mmap/mmap.txt:
--------------------------------------------------------------------------------
1 | 43521
--------------------------------------------------------------------------------
/examples/next/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next/core-web-vitals"
3 | }
4 |
--------------------------------------------------------------------------------
/examples/next/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | **/*.trace
37 | **/*.zip
38 | **/*.tar.gz
39 | **/*.tgz
40 | **/*.log
41 | package-lock.json
42 | **/*.bun
--------------------------------------------------------------------------------
/examples/next/.npmignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | **/*.trace
37 | **/*.zip
38 | **/*.tar.gz
39 | **/*.tgz
40 | **/*.log
41 | package-lock.json
42 | **/*.bun
43 |
--------------------------------------------------------------------------------
/examples/next/bunfig.toml:
--------------------------------------------------------------------------------
1 | framework = "next"
2 |
--------------------------------------------------------------------------------
/examples/next/components/Title.tsx:
--------------------------------------------------------------------------------
1 | import Hey from "./subtitle";
2 |
3 | export default function Title() {
4 | return (
5 |
6 | Hello
7 |
8 | );
9 | }
10 |
11 | export enum TitleEnum {
12 | wow = 1,
13 | }
14 |
--------------------------------------------------------------------------------
/examples/next/components/subtitle.tsx:
--------------------------------------------------------------------------------
1 |
2 | export default function Hey() {
3 | return !!yep
;
4 | }
5 |
--------------------------------------------------------------------------------
/examples/next/gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
36 | **/*.trace
37 | **/*.zip
38 | **/*.tar.gz
39 | **/*.tgz
40 | **/*.log
41 | package-lock.json
42 | **/*.bun
--------------------------------------------------------------------------------
/examples/next/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 | ///
4 |
5 | // NOTE: This file should not be edited
6 | // see https://nextjs.org/docs/basic-features/typescript for more information.
7 |
--------------------------------------------------------------------------------
/examples/next/next.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | reactStrictMode: true,
3 | typescript: {
4 | // !! WARN !!
5 | // Dangerously allow production builds to successfully complete even if
6 | // your project has type errors.
7 | // !! WARN !!
8 | ignoreBuildErrors: true,
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/examples/next/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@bun-examples/next",
3 | "version": "0.0.53",
4 | "main": "index.js",
5 | "dependencies": {
6 | "next": "^12.1.0",
7 | "react": "^18",
8 | "react-dom": "^18",
9 | "react-is": "^17.0.2"
10 | },
11 | "devDependencies": {
12 | "@types/react": "^18",
13 | "bun-framework-next": "^12",
14 | "typescript": "latest"
15 | },
16 | "bun-create": {
17 | "postinstall": [
18 | "bun bun --use next"
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/examples/next/pages/_app.tsx:
--------------------------------------------------------------------------------
1 | import "../styles/globals.css";
2 |
3 | function MyApp({ Component, pageProps }) {
4 | return ;
5 | }
6 |
7 | export default MyApp;
8 |
--------------------------------------------------------------------------------
/examples/next/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/next/public/favicon.ico
--------------------------------------------------------------------------------
/examples/next/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/examples/next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": false,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "baseUrl": ".",
17 | "paths": {}
18 | },
19 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
20 | "exclude": ["node_modules"]
21 | }
22 |
--------------------------------------------------------------------------------
/examples/openInEditor.js:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 | import { parse } from "querystring";
3 |
4 | export default {
5 | fetch(req) {
6 | if (req.url === "/favicon.ico")
7 | return new Response("nooo dont open favicon in editor", { status: 404 });
8 |
9 | var pathname = req.url.substring(1);
10 | const q = pathname.indexOf("?");
11 | var { editor } = parse(pathname.substring(q + 1)) || {};
12 |
13 | if (q > 0) {
14 | pathname = pathname.substring(0, q);
15 | }
16 |
17 | Bun.openInEditor(resolve(pathname), {
18 | editor,
19 | });
20 |
21 | return new Response(`Opened ${req.url}`);
22 | },
23 | };
24 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/src/colors.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --timestamp: "0";
3 | --interval: "8";
4 | --progress-bar: 11.83299999999997%;
5 | --spinner-1-muted: rgb(142, 6, 182);
6 | --spinner-1-primary: rgb(177, 8, 227);
7 | --spinner-2-muted: rgb(110, 148, 190);
8 | --spinner-2-primary: rgb(138, 185, 238);
9 | --spinner-3-muted: rgb(75, 45, 64);
10 | --spinner-3-primary: rgb(94, 56, 80);
11 | --spinner-4-muted: rgb(155, 129, 108);
12 | --spinner-4-primary: rgb(194, 161, 135);
13 | --spinner-rotate: 213deg;
14 | }
15 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/src/components/app.tsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import { Button } from "./Button";
3 | import { RenderCounter } from "./RenderCounter";
4 | export function App() {
5 | return (
6 |
7 |
8 |
This is the root element
9 |
10 |
11 |
12 |
13 | );
14 | }
15 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/src/components/button.tsx:
--------------------------------------------------------------------------------
1 | import { RenderCounter } from "./RenderCounter";
2 |
3 | export const Button = ({ children }) => {
4 | return (
5 |
6 | {children}
7 |
8 | );
9 | };
10 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/src/font.css:
--------------------------------------------------------------------------------
1 | @import "https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;700&family=Space+Mono:wght@400;700&display=swap";
2 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/src/index.tsx:
--------------------------------------------------------------------------------
1 | import ReactDOM from "react-dom";
2 | import React from "react";
3 | import { App } from "./components/app";
4 | import classNames from "classnames";
5 |
6 | function startReact() {
7 | ReactDOM.render(, document.querySelector("#reactroot"));
8 | }
9 |
10 | globalThis.addEventListener("DOMContentLoaded", () => {
11 | startReact();
12 | });
13 | startReact();
14 |
15 | export { App };
16 |
--------------------------------------------------------------------------------
/examples/react-fast-refresh-test/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": false,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve"
16 | },
17 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
18 | "exclude": ["node_modules"]
19 | }
20 |
--------------------------------------------------------------------------------
/examples/react/.gitignore:
--------------------------------------------------------------------------------
1 | **/*.trace
2 | **/*.zip
3 | **/*.tar.gz
4 | **/*.tgz
5 | **/*.log
6 |
7 | package-lock.json
8 | **/*.bun
9 |
10 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
11 |
12 | # dependencies
13 | /node_modules
14 | /.pnp
15 | .pnp.js
16 |
17 | # testing
18 | /coverage
19 |
20 | # production
21 | /build
22 |
23 | # misc
24 | .DS_Store
25 | .env.local
26 | .env.development.local
27 | .env.test.local
28 | .env.production.local
29 |
30 | npm-debug.log*
31 | yarn-debug.log*
32 | yarn-error.log*
33 |
--------------------------------------------------------------------------------
/examples/react/.npmignore:
--------------------------------------------------------------------------------
1 | **/*.trace
2 | **/*.zip
3 | **/*.tar.gz
4 | **/*.tgz
5 | **/*.log
6 | package-lock.json
7 | **/*.bun
8 |
9 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
10 |
11 | # dependencies
12 | /node_modules
13 | /.pnp
14 | .pnp.js
15 |
16 | # testing
17 | /coverage
18 |
19 | # production
20 | /build
21 |
22 | # misc
23 | .DS_Store
24 | .env.local
25 | .env.development.local
26 | .env.test.local
27 | .env.production.local
28 |
29 | npm-debug.log*
30 | yarn-debug.log*
31 | yarn-error.log*
32 |
--------------------------------------------------------------------------------
/examples/react/README.md:
--------------------------------------------------------------------------------
1 | # React with Bun runtime
2 |
3 | This is a React project bootstrapped with [bun](https://bun.sh/).
4 |
5 | ## Getting Started
6 |
7 | ### Cloning the repo
8 |
9 | ```sh
10 | bun create react ./react-bun-app
11 | ```
12 |
13 | ### Development
14 |
15 | First, run the development server.
16 |
17 | ```
18 | bun dev
19 | ```
20 |
21 | Open http://localhost:3000 with your browser to see the result.
22 |
23 | You can start editing the page by modifying src/App.jsx. The page auto-updates as you edit the file.
24 |
25 |
--------------------------------------------------------------------------------
/examples/react/gitignore:
--------------------------------------------------------------------------------
1 | **/*.trace
2 | **/*.zip
3 | **/*.tar.gz
4 | **/*.tgz
5 | **/*.log
6 |
7 | package-lock.json
8 | **/*.bun
9 |
10 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
11 |
12 | # dependencies
13 | /node_modules
14 | /.pnp
15 | .pnp.js
16 |
17 | # testing
18 | /coverage
19 |
20 | # production
21 | /build
22 |
23 | # misc
24 | .DS_Store
25 | .env.local
26 | .env.development.local
27 | .env.test.local
28 | .env.production.local
29 |
30 | npm-debug.log*
31 | yarn-debug.log*
32 | yarn-error.log*
33 |
--------------------------------------------------------------------------------
/examples/react/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@bun-examples/react",
3 | "version": "0.0.47",
4 | "dependencies": {
5 | "react": "^17.0.2",
6 | "react-dom": "^17.0.2",
7 | "web-vitals": "^1.0.1"
8 | },
9 | "scripts": {},
10 | "eslintConfig": {
11 | "extends": [
12 | "react-app",
13 | "react-app/jest"
14 | ]
15 | },
16 | "devDependencies": {
17 | "typescript": "latest"
18 | },
19 | "bun-create": {
20 | "postinstall": [
21 | "bun bun ./src/index.jsx"
22 | ]
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/examples/react/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/react/public/favicon.ico
--------------------------------------------------------------------------------
/examples/react/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/react/public/logo192.png
--------------------------------------------------------------------------------
/examples/react/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/examples/react/public/logo512.png
--------------------------------------------------------------------------------
/examples/react/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/examples/react/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/examples/react/src/App.jsx:
--------------------------------------------------------------------------------
1 | import logo from "./logo.svg";
2 | import * as React from "react";
3 | import "./App.css";
4 |
5 | function App() {
6 | return (
7 |
21 | );
22 | }
23 |
24 | export default App;
25 |
--------------------------------------------------------------------------------
/examples/react/src/images.d.ts:
--------------------------------------------------------------------------------
1 | declare module '*.svg' {
2 | const content: any;
3 | export default content;
4 | }
5 |
--------------------------------------------------------------------------------
/examples/react/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/examples/react/src/index.jsx:
--------------------------------------------------------------------------------
1 | import * as React from "react";
2 | import ReactDOM from "react-dom";
3 | import "./index.css";
4 | import App from "./App";
5 |
6 | ReactDOM.render(
7 |
8 |
9 | ,
10 | document.getElementById("root")
11 | );
12 |
--------------------------------------------------------------------------------
/examples/ssl.ts:
--------------------------------------------------------------------------------
1 | import { resolve } from "path";
2 |
3 | const development = process.env.NODE_ENV !== "production";
4 | export default {
5 | fetch(req: Request) {
6 | return new Response(Bun.file(resolve(req.url.substring(1))));
7 | },
8 |
9 | // hostname: "0.0.0.0",
10 | port: process.env.PORT || "443",
11 | keyFile: process.env.SSL_KEY_FILE || "./key.pem",
12 | certFile: process.env.SSL_CERTIFICATE_FILE || "./cert.pem",
13 | development,
14 | } as Bun.Serve;
15 |
--------------------------------------------------------------------------------
/examples/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "typeRoots": ["../types"]
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/misctools/.gitignore:
--------------------------------------------------------------------------------
1 | *.tgz
2 | tgz
3 | readlink-getfd
4 | readlink-realpath
5 | http_bench
6 | httpbench
7 | fetch
8 | tgz2hop
9 | hop
10 | bun.lockb
11 |
--------------------------------------------------------------------------------
/misctools/find-unused-zig.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | rg "@import\(\"(.*\.zig)\"\)" src -r "\$1" --only-matching -I | xargs basename | sort | uniq > /tmp/imported-names.txt
4 | find src -iname "*.zig" | xargs basename | sort | uniq > /tmp/all-names.txt
5 | comm -1 -3 /tmp/imported-names.txt /tmp/all-names.txt
--------------------------------------------------------------------------------
/misctools/generate-tests-file.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | cd src
4 | rg -l "^test " --type zig | sed -e 's/\(.*\)/@import\(\".\/\1"\);/' | sed '/schema/d' | sed '/deps/d' > /tmp/tests.zig
5 | awk '{printf "const Test%d = %s\ntest { const Foo = Test%d; }\n", NR, $0, NR}' < /tmp/tests.zig > tests.zig
6 | zig fmt tests.zig
--------------------------------------------------------------------------------
/misctools/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "misctools",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "devDependencies": {
7 | "@unicode/unicode-13.0.0": "^1.2.1",
8 | "@unicode/unicode-3.0.0": "^1.2.1"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "mitata": "^0.1.3",
4 | "peechy": "0.4.32",
5 | "react": "^18.2.0",
6 | "react-dom": "^18.2.0"
7 | },
8 | "private": true,
9 | "scripts": {
10 | "build-runtime": "esbuild --target=esnext --bundle src/runtime/index.ts --format=iife --platform=browser --global-name=BUN_RUNTIME > src/runtime.out.js; cat src/runtime.footer.js >> src/runtime.out.js",
11 | "build-fallback": "esbuild --target=esnext --bundle src/fallback.ts --format=iife --platform=browser --minify > src/fallback.out.js"
12 | },
13 | "devDependencies": {
14 | "he": "^1.2.0",
15 | "html-entities": "^2.3.3",
16 | "prettier": "^2.4.1",
17 | "typescript": "4.6.3"
18 | },
19 | "version": "0.0.0"
20 | }
--------------------------------------------------------------------------------
/packages/bun-darwin-aarch64/.npmignore:
--------------------------------------------------------------------------------
1 | bin/bun-profile
2 | bin/*.o
3 | *.o
4 | *.a
--------------------------------------------------------------------------------
/packages/bun-error/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-error/bun.lockb
--------------------------------------------------------------------------------
/packages/bun-error/img/close.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-error/img/close.png
--------------------------------------------------------------------------------
/packages/bun-error/img/error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-error/img/error.png
--------------------------------------------------------------------------------
/packages/bun-error/img/powered-by.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-error/img/powered-by.png
--------------------------------------------------------------------------------
/packages/bun-error/img/powered-by.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-error/img/powered-by.webp
--------------------------------------------------------------------------------
/packages/bun-error/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun-error",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "license": "MIT",
6 | "private": true,
7 | "scripts": {
8 | "build": "esbuild --define:process.env.NODE_ENV=\"'production'\" --minify index.tsx bun-error.css --bundle --outdir=dist --platform=browser --format=esm"
9 | },
10 | "dependencies": {
11 | "esbuild": "latest",
12 | "react": "^17.0.2",
13 | "react-dom": "^17.0.2"
14 | },
15 | "devDependencies": {
16 | "@types/react": "^17.0.39"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/packages/bun-framework-next/.npmignore:
--------------------------------------------------------------------------------
1 | *.bun
2 | node_modules
3 | pnpm-log.yaml
4 | yarn-error.log
5 | yarn.lock
--------------------------------------------------------------------------------
/packages/bun-framework-next/README.md:
--------------------------------------------------------------------------------
1 | # bun-framework-next
2 |
3 | This package lets you use Next.js 12 with bun. This readme assumes you already installed bun.
4 |
5 | To start a new project:
6 |
7 | ```bash
8 | bun create next --open
9 | ```
10 |
11 | To use Next.js 12 with an existing project:
12 |
13 | ```bash
14 | npm install bun-framework-next
15 | bun bun --use next
16 | ```
17 |
18 | Launch the development server:
19 |
20 | ```bash
21 | bun dev
22 | ```
23 |
24 | Open http://localhost:3000 with your browser to see the result.
--------------------------------------------------------------------------------
/packages/bun-framework-next/appInjector.js:
--------------------------------------------------------------------------------
1 | export function maybeInjectApp(expr) {
2 | var app;
3 | try {
4 | const path = Bun.routesDir + "/_app";
5 | app = Bun.resolveSync(path, Bun.cwd + "/");
6 | } catch (exception) {
7 | return undefined;
8 | }
9 |
10 | return (
11 | <>
12 |
13 | >
14 | );
15 | }
16 |
--------------------------------------------------------------------------------
/packages/bun-framework-next/empty.js:
--------------------------------------------------------------------------------
1 | // Keep this file here so that main resolves correctly
2 |
--------------------------------------------------------------------------------
/packages/bun-framework-next/next_document.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-framework-next/next_document.tsx
--------------------------------------------------------------------------------
/packages/bun-framework-next/server-polyfills.tsx:
--------------------------------------------------------------------------------
1 | import { Buffer } from "buffer";
2 |
3 | globalThis.Buffer ||= Buffer;
4 |
5 | if (!("URL" in globalThis)) {
6 | class Outdated extends Error {
7 | constructor(message) {
8 | super(message);
9 | this.name = "Outdated";
10 | }
11 | }
12 |
13 | throw new Outdated(
14 | "Missing \"URL\", please run 'bun upgrade' to update to the latest version of Bun (added in v0.0.74)"
15 | );
16 | }
17 |
--------------------------------------------------------------------------------
/packages/bun-framework-next/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "esnext",
4 | "lib": ["dom", "dom.iterable", "esnext", "WebWorker"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": false,
8 | "forceConsistentCasingInFileNames": true,
9 | "noEmit": true,
10 | "esModuleInterop": true,
11 | "module": "esnext",
12 | "moduleResolution": "Node",
13 | "resolveJsonModule": true,
14 | "isolatedModules": true,
15 | "jsx": "preserve",
16 | "baseUrl": ".",
17 | "paths": {}
18 | },
19 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "empty.js"],
20 | "exclude": ["node_modules"]
21 | }
22 |
--------------------------------------------------------------------------------
/packages/bun-landing/build.tsx:
--------------------------------------------------------------------------------
1 | import { file, serve } from "bun";
2 | import "shiki";
3 | import { renderToReadableStream } from "../../test/bun.js/reactdom-bun";
4 |
5 | import liveReload from "bun-livereload";
6 | import { join } from "path";
7 |
8 | const { default: Page } = await import("./page.tsx");
9 | const build = await new Response(
10 | await renderToReadableStream()
11 | ).text();
12 |
13 | await Bun.write(import.meta.dir + "/public/index.html", build);
14 | await Bun.write(
15 | import.meta.dir + "/public/index.css",
16 | Bun.file(import.meta.dir + "/index.css")
17 | );
18 |
--------------------------------------------------------------------------------
/packages/bun-landing/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "bun-livereload": "1.0.2",
4 | "bun-types": "latest",
5 | "react": "^18.2.0",
6 | "react-dom": "^18.2.0",
7 | "shiki": "^0.10.1"
8 | }
9 | }
--------------------------------------------------------------------------------
/packages/bun-landing/public/Bun.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/Bun.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/Bun@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/Bun@2x.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/favicon.ico
--------------------------------------------------------------------------------
/packages/bun-landing/public/logo-square.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/logo-square.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/logo-square@16px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/logo-square@16px.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/logo-square@32px.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/logo-square@32px.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/logo.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/logo@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/logo@2x.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Bun",
3 | "icons": [
4 | {
5 | "src": "/logo-square.png",
6 | "sizes": "256x256",
7 | "type": "image/png"
8 | }
9 | ],
10 | "theme_color": "#fbf0df",
11 | "background_color": "#fbf0df",
12 | "start_url": "/",
13 | "display": "minimal-ui"
14 | }
15 |
--------------------------------------------------------------------------------
/packages/bun-landing/public/share.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/share.png
--------------------------------------------------------------------------------
/packages/bun-landing/public/ssr.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-landing/public/ssr.tsx
--------------------------------------------------------------------------------
/packages/bun-landing/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "jsx": "react",
4 | "lib": ["ESNext"],
5 | "module": "esnext",
6 | "target": "esnext",
7 | "moduleResolution": "node",
8 | "types": ["bun-types"]
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/bun-linux-x64/.npmignore:
--------------------------------------------------------------------------------
1 | bin/bun-profile
2 | bin/*.o
3 | *.o
4 | *.a
--------------------------------------------------------------------------------
/packages/bun-macro-relay/__generated__/FooOperation.graphql.ts:
--------------------------------------------------------------------------------
1 | export class FooOperation {}
2 |
3 | export default FooOperation;
4 |
--------------------------------------------------------------------------------
/packages/bun-macro-relay/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun-macro-relay",
3 | "version": "0.1.2",
4 | "module": "bun-macro-relay.tsx",
5 | "license": "MIT",
6 | "peerDependencies": {
7 | "graphql": "^15.0.0"
8 | },
9 | "devDependencies": {
10 | "graphql": "^15.6.0"
11 | },
12 | "files": [
13 | "bun-macro-relay.tsx"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/packages/bun-macro-relay/test/foo.tsx:
--------------------------------------------------------------------------------
1 | import { graphql } from "react-relay";
2 |
3 | export const Foo = () => {
4 | const definition = graphql`
5 | query FooOperation {
6 | foo
7 | }
8 | `;
9 |
10 | return {definition.operation.name}
;
11 | };
12 |
--------------------------------------------------------------------------------
/packages/bun-macro-relay/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": ".",
4 | "paths": {}
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/packages/bun-types/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun-types",
3 | "version": "0.1.4",
4 | "description": "Type definitions for bun.js",
5 | "types": "types.d.ts",
6 | "files": [
7 | "types.d.ts"
8 | ],
9 | "private": false,
10 | "keywords": [
11 | "bun",
12 | "bun.js",
13 | "types"
14 | ],
15 | "repository": "https://github.com/oven-sh/bun",
16 | "homepage": "https://bun.sh"
17 | }
18 |
--------------------------------------------------------------------------------
/packages/bun-wasm/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/packages/bun-wasm/bun.lockb
--------------------------------------------------------------------------------
/packages/bun-wasm/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun-wasm",
3 | "version": "0.0.79",
4 | "devDependencies": {
5 | "peechy": "0.4.32",
6 | "typescript": "latest"
7 | },
8 | "files": [
9 | "bun.wasm",
10 | "schema.d.ts",
11 | "index.mjs",
12 | "index.cjs",
13 | "index.mjs.map",
14 | "index.cjs.map",
15 | "index.d.ts",
16 | "schema.js"
17 | ],
18 | "type": "module",
19 | "types": "index.d.ts",
20 | "exports": {
21 | ".": {
22 | "import": "./index.mjs",
23 | "require": "./index.cjs",
24 | "default": "./index.mjs"
25 | },
26 | "./schema": "./schema.js",
27 | "./wasm": "./bun.wasm",
28 | "./bun.wasm": "./bun.wasm"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/packages/bun-wasm/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "moduleResolution": "node",
4 | "target": "esnext",
5 | "module": "esnext",
6 | "declaration": true,
7 | "esModuleInterop": true,
8 | "isolatedModules": false,
9 | "skipLibCheck": true,
10 | "emitDeclarationOnly": true,
11 | "outDir": ".",
12 | "baseUrl": "."
13 | },
14 | "include": [
15 | "./node_modules/peechy",
16 | "./schema.d.ts",
17 | "./index.ts",
18 | "./schema.js"
19 | ],
20 | "exclude": []
21 | }
22 |
--------------------------------------------------------------------------------
/src/.prettierignore:
--------------------------------------------------------------------------------
1 | fallback.html
--------------------------------------------------------------------------------
/src/analytics.zig:
--------------------------------------------------------------------------------
1 | pub usingnamespace @import("./analytics/analytics_thread.zig");
2 |
--------------------------------------------------------------------------------
/src/api/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/api/bun.lockb
--------------------------------------------------------------------------------
/src/api/demo/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
--------------------------------------------------------------------------------
/src/api/demo/api.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/api/demo/api.js
--------------------------------------------------------------------------------
/src/api/demo/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/api/demo/bun.lockb
--------------------------------------------------------------------------------
/src/api/demo/next-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/src/api/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start"
9 | },
10 | "dependencies": {
11 | "@swc/wasm-web": "^1.2.146",
12 | "bun-framework-next": "^12.1.0",
13 | "es-module-loader": "^2.3.0",
14 | "esbuild": "^0.14.23",
15 | "esbuild-wasm": "^0.14.23",
16 | "next": "12",
17 | "peechy": "latest",
18 | "react": "17.0.2",
19 | "react-dom": "17.0.2",
20 | "sucrase": "^3.18.1"
21 | },
22 | "devDependencies": {
23 | "@types/react": "^17.0.8",
24 | "typescript": "^4.3.2",
25 | "webpack": "^5.38.1",
26 | "webpack-cli": "^4.7.0"
27 | }
28 | }
--------------------------------------------------------------------------------
/src/api/demo/pages/_app.js:
--------------------------------------------------------------------------------
1 | import '../styles/globals.css'
2 |
3 | function MyApp({ Component, pageProps }) {
4 | return
5 | }
6 |
7 | export default MyApp
8 |
--------------------------------------------------------------------------------
/src/api/demo/pages/api/hello.js:
--------------------------------------------------------------------------------
1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction
2 |
3 | export default (req, res) => {
4 | res.status(200).json({ name: 'John Doe' })
5 | }
6 |
--------------------------------------------------------------------------------
/src/api/demo/pages/two.tsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/api/demo/pages/two.tsx
--------------------------------------------------------------------------------
/src/api/demo/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/api/demo/public/favicon.ico
--------------------------------------------------------------------------------
/src/api/demo/styles/globals.css:
--------------------------------------------------------------------------------
1 | html,
2 | body {
3 | padding: 0;
4 | margin: 0;
5 | font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
6 | Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
7 | }
8 |
9 | a {
10 | color: inherit;
11 | text-decoration: none;
12 | }
13 |
14 | * {
15 | box-sizing: border-box;
16 | }
17 |
--------------------------------------------------------------------------------
/src/api/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "strict": false,
12 | "forceConsistentCasingInFileNames": true,
13 | "noEmit": true,
14 | "esModuleInterop": true,
15 | "module": "esnext",
16 | "moduleResolution": "node",
17 | "resolveJsonModule": true,
18 | "isolatedModules": true,
19 | "jsx": "preserve"
20 | },
21 | "include": [
22 | "next-env.d.ts",
23 | "**/*.ts",
24 | "**/*.tsx"
25 | ],
26 | "exclude": [
27 | "node_modules"
28 | ]
29 | }
30 |
--------------------------------------------------------------------------------
/src/api/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun-api",
3 | "private": true,
4 | "dependencies": {
5 | "peechy": "latest"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/api/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "moduleResolution": "node"
4 | },
5 | "include": ["./node_modules/peechy", "./schema.d.ts"]
6 | }
7 |
--------------------------------------------------------------------------------
/src/base64/README.md:
--------------------------------------------------------------------------------
1 | # Base64
2 |
3 | This uses https://github.com/lemire/fastbase64
4 |
5 | Changes:
6 |
7 | - chromiumbase64 doesn't add a null byte
8 | - chromiumbase64 handles some whitespace characters more loosely
9 |
--------------------------------------------------------------------------------
/src/base64/bun-base64.h:
--------------------------------------------------------------------------------
1 |
2 | #include "chromiumbase64.h"
3 | #include "fastavxbase64.h"
4 |
5 | size_t bun_base64_decode(char *dest, const char *src, size_t len,
6 | size_t *outlen);
7 | size_t bun_base64_encode(char *dest, const char *str, size_t len);
--------------------------------------------------------------------------------
/src/base64/neonbase64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/base64/neonbase64
--------------------------------------------------------------------------------
/src/bindgen.zig:
--------------------------------------------------------------------------------
1 | pub const bindgen = true;
2 |
3 | pub const main = @import("./bun.js/bindings/bindings-generator.zig").main;
4 | pub export fn PLCrashReportHandler(_: ?*anyopaque) void {}
5 | pub export fn mkdirp(_: ?*anyopaque) void {}
6 |
--------------------------------------------------------------------------------
/src/bun.js/api/libtcc1.a.macos-aarch64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/api/libtcc1.a.macos-aarch64
--------------------------------------------------------------------------------
/src/bun.js/bindings/BufferEncodingType.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace WebCore {
4 |
5 | enum class BufferEncodingType {
6 | utf8 = 0,
7 | ucs2 = 1,
8 | utf16le = 2,
9 | latin1 = 3,
10 | ascii = 4,
11 | base64 = 5,
12 | base64url = 6,
13 | hex = 7,
14 |
15 | /// Refer to the buffer's encoding
16 | buffer = 8,
17 |
18 | };
19 |
20 | }
--------------------------------------------------------------------------------
/src/bun.js/bindings/BunJSCModule.h:
--------------------------------------------------------------------------------
1 | #include "root.h"
2 | #include "JavaScriptCore/JSObject.h"
3 |
4 | JSC::JSObject* createJSCModule(JSC::JSGlobalObject* globalObject);
--------------------------------------------------------------------------------
/src/bun.js/bindings/CachedScript.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "root.h"
4 |
5 | namespace WebCore {
6 |
7 | class CachedScript {
8 | };
9 | }
--------------------------------------------------------------------------------
/src/bun.js/bindings/GCDefferalContext.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "helpers.h"
4 |
5 | namespace JSC {
6 |
7 | ALWAYS_INLINE GCDeferralContext::GCDeferralContext(VM& vm)
8 | : m_vm(vm)
9 | {
10 | }
11 |
12 | ALWAYS_INLINE GCDeferralContext::~GCDeferralContext()
13 | {
14 | if constexpr (validateDFGDoesGC)
15 | m_vm.verifyCanGC();
16 |
17 | if (UNLIKELY(m_shouldGC))
18 | m_vm.heap.collectIfNecessaryOrDefer();
19 | }
20 |
21 | } // namespace JSC
--------------------------------------------------------------------------------
/src/bun.js/bindings/JSBufferEncodingType.h:
--------------------------------------------------------------------------------
1 | #include "root.h"
2 | #include "BufferEncodingType.h"
3 | #include "JSDOMConvertEnumeration.h"
4 |
5 | namespace WebCore {
6 |
7 | String convertEnumerationToString(BufferEncodingType);
8 | template<> JSC::JSString* convertEnumerationToJS(JSC::JSGlobalObject&, BufferEncodingType);
9 |
10 | template<> std::optional parseEnumeration(JSC::JSGlobalObject&, JSC::JSValue);
11 | template<> const char* expectedEnumerationValues();
12 |
13 | } // namespace WebCore
--------------------------------------------------------------------------------
/src/bun.js/bindings/JSDOMBinding.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "root.h"
4 |
5 | #include "ExceptionOr.h"
6 | #include "JavaScriptCore/AuxiliaryBarrierInlines.h"
7 | #include "JavaScriptCore/HeapInlines.h"
8 | #include "JavaScriptCore/JSArray.h"
9 | #include "JavaScriptCore/JSCJSValueInlines.h"
10 | #include "JavaScriptCore/JSCellInlines.h"
11 | #include "JavaScriptCore/JSObjectInlines.h"
12 | #include "JavaScriptCore/Lookup.h"
13 | #include "JavaScriptCore/ObjectConstructor.h"
14 | #include "JavaScriptCore/SlotVisitorInlines.h"
15 | #include "JavaScriptCore/StructureInlines.h"
16 | #include "JavaScriptCore/WriteBarrier.h"
17 | #include "wtf/Forward.h"
18 | #include "wtf/GetPtr.h"
19 | #include "wtf/Vector.h"
20 | #include
21 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/JSSink+custom.h:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/MarkingConstraint.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/MarkingConstraint.cpp
--------------------------------------------------------------------------------
/src/bun.js/bindings/Path.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/Path.h
--------------------------------------------------------------------------------
/src/bun.js/bindings/Sink.h:
--------------------------------------------------------------------------------
1 | #include "root.h"
2 |
3 | namespace WebCore {
4 |
5 | enum SinkID : uint8_t {
6 | ArrayBufferSink = 0,
7 | TextSink = 1,
8 | FileSink = 2,
9 | HTMLRewriterSink = 3,
10 | HTTPResponseSink = 4,
11 | HTTPSResponseSink = 5,
12 |
13 | };
14 | static constexpr unsigned numberOfSinkIDs
15 | = 6;
16 |
17 | }
--------------------------------------------------------------------------------
/src/bun.js/bindings/StreamGlobals.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/StreamGlobals.h
--------------------------------------------------------------------------------
/src/bun.js/bindings/inlines.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/inlines.cpp
--------------------------------------------------------------------------------
/src/bun.js/bindings/objects.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/objects.cpp
--------------------------------------------------------------------------------
/src/bun.js/bindings/process.d.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * The process object provides information about, and control over, the
3 | * current Bun.js process. While it is available as a global, it is
4 | * recommended to explicitly access it via require or import
5 | */
6 | export interface Process {
7 | //
8 | }
9 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/static_export.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 | Type: type,
3 | symbol_name: []const u8,
4 | local_name: []const u8,
5 |
6 | Parent: type,
7 |
8 | pub fn Decl(comptime this: *const @This()) std.builtin.TypeInfo.Declaration {
9 | return comptime std.meta.declarationInfo(this.Parent, this.local_name);
10 | }
11 |
12 | pub fn wrappedName(comptime this: *const @This()) []const u8 {
13 | return comptime "wrap" ++ this.symbol_name;
14 | }
15 |
16 | pub const c_char = enum(u8) { _ };
17 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSAbortController.dep:
--------------------------------------------------------------------------------
1 | JSAbortController.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSAbortSignal.dep:
--------------------------------------------------------------------------------
1 | JSAbortSignal.h : EventTarget.idl
2 | EventTarget.idl :
3 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSAddEventListenerOptions.dep:
--------------------------------------------------------------------------------
1 | AddEventListenerOptions.h : EventListenerOptions.idl
2 | EventListenerOptions.idl :
3 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSByteLengthQueuingStrategy.dep:
--------------------------------------------------------------------------------
1 | JSByteLengthQueuingStrategy.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSCloseEvent.dep:
--------------------------------------------------------------------------------
1 | JSCloseEvent.h : Event.idl EventInit.idl
2 | Event.idl :
3 | EventInit.idl :
4 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSCountQueuingStrategy.dep:
--------------------------------------------------------------------------------
1 | JSCountQueuingStrategy.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSCustomEvent.dep:
--------------------------------------------------------------------------------
1 | JSCustomEvent.h : Event.idl EventInit.idl
2 | Event.idl :
3 | EventInit.idl :
4 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSDOMWindow.h:
--------------------------------------------------------------------------------
1 | // this is a stub header file
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSErrorEvent.dep:
--------------------------------------------------------------------------------
1 | JSErrorEvent.h : Event.idl EventInit.idl
2 | Event.idl :
3 | EventInit.idl :
4 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSEvent.dep:
--------------------------------------------------------------------------------
1 | JSEvent.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSEventInit.dep:
--------------------------------------------------------------------------------
1 | EventInit.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSEventListenerOptions.dep:
--------------------------------------------------------------------------------
1 | EventListenerOptions.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSEventModifierInit.dep:
--------------------------------------------------------------------------------
1 | EventModifierInit.h : UIEventInit.idl EventInit.idl
2 | UIEventInit.idl :
3 | EventInit.idl :
4 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSFetchHeaders.dep:
--------------------------------------------------------------------------------
1 | JSFetchHeaders.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSMessageEvent.dep:
--------------------------------------------------------------------------------
1 | JSMessageEvent.h : Event.idl EventInit.idl
2 | Event.idl :
3 | EventInit.idl :
4 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableByteStreamController.dep:
--------------------------------------------------------------------------------
1 | JSReadableByteStreamController.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStream.dep:
--------------------------------------------------------------------------------
1 | JSReadableStream.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamBYOBReader.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamBYOBReader.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamBYOBRequest.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamBYOBRequest.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamDefaultController.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamDefaultController.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamDefaultReader.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamDefaultReader.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamSink.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamSink.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSReadableStreamSource.dep:
--------------------------------------------------------------------------------
1 | JSReadableStreamSource.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSServiceWorker.h:
--------------------------------------------------------------------------------
1 | // stub
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSTextEncoder.dep:
--------------------------------------------------------------------------------
1 | JSTextEncoder.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSTransformStream.dep:
--------------------------------------------------------------------------------
1 | JSTransformStream.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSTransformStreamDefaultController.dep:
--------------------------------------------------------------------------------
1 | JSTransformStreamDefaultController.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSURLSearchParams.dep:
--------------------------------------------------------------------------------
1 | JSURLSearchParams.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWebSocket.dep:
--------------------------------------------------------------------------------
1 | JSWebSocket.h : EventTarget.idl
2 | EventTarget.idl :
3 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWindowProxy.h:
--------------------------------------------------------------------------------
1 | // stub
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWritableStream.dep:
--------------------------------------------------------------------------------
1 | JSWritableStream.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWritableStreamDefaultController.dep:
--------------------------------------------------------------------------------
1 | JSWritableStreamDefaultController.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWritableStreamDefaultWriter.dep:
--------------------------------------------------------------------------------
1 | JSWritableStreamDefaultWriter.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/JSWritableStreamSink.dep:
--------------------------------------------------------------------------------
1 | JSWritableStreamSink.h :
2 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/TaskSource.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | namespace WebCore {
4 |
5 | enum class TaskSource : uint8_t {
6 | DOMManipulation,
7 | DatabaseAccess,
8 | FileReading,
9 | FontLoading,
10 | Geolocation,
11 | IdleTask,
12 | IndexedDB,
13 | MediaElement,
14 | Microtask,
15 | Networking,
16 | PerformanceTimeline,
17 | Permission,
18 | PostedMessageQueue,
19 | Speech,
20 | UserInteraction,
21 | WebGL,
22 | WebXR,
23 | WebSocket,
24 |
25 | // Internal to WebCore
26 | InternalAsyncTask, // Safe to re-order or delay.
27 | };
28 |
29 | } // namespace WebCore
30 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/WebCoreBuiltins.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/bindings/webcore/WebCoreBuiltins.h
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/WebCoreJSClientData.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "BunClientData.h"
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/config.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifndef WEBCORE_CONFIG
4 | #define WEBCORE_CONFIG
5 | #include "root.h"
6 | #endif
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/weak_handle.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "weak_handle.h"
3 | #include "JavaScriptCore/WeakHandleOwner.h"
4 |
5 | namespace JSC {
6 | class SlotVisitor;
7 | template class Handle;
8 |
9 | // WeakHandleOwner::~WeakHandleOwner()
10 | // {
11 | // }
12 |
13 | // bool WeakHandleOwner::isReachableFromOpaqueRoots(Handle, void*, AbstractSlotVisitor&, const char**)
14 | // {
15 | // return false;
16 | // }
17 |
18 | // void WeakHandleOwner::finalize(Handle, void*)
19 | // {
20 | // }
21 | }
--------------------------------------------------------------------------------
/src/bun.js/bindings/webcore/weak_handle.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "config.h"
4 |
5 | namespace JSC {
6 |
7 | } // namespace JSC
8 |
--------------------------------------------------------------------------------
/src/bun.js/bindings/wtf-bindings.cpp:
--------------------------------------------------------------------------------
1 | #include "wtf-bindings.h"
2 | #include "wtf/text/Base64.h"
3 |
4 | extern "C" void WTF__copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length)
5 | {
6 | WTF::copyLCharsFromUCharSource(destination, source, length);
7 | }
8 |
9 | extern "C" JSC::EncodedJSValue WTF__toBase64URLStringValue(const uint8_t* bytes, size_t length, JSC::JSGlobalObject* globalObject)
10 | {
11 | WTF::String string = WTF::base64URLEncodeToString(reinterpret_cast(bytes), static_cast(length));
12 | string.impl()->ref();
13 | return JSC::JSValue::encode(JSC::jsString(globalObject->vm(), string));
14 | }
--------------------------------------------------------------------------------
/src/bun.js/bindings/wtf-bindings.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "root.h"
4 | #include "wtf/text/ASCIIFastPath.h"
5 |
6 | extern "C" void WTF__copyLCharsFromUCharSource(LChar* destination, const UChar* source, size_t length);
7 | extern "C" JSC::EncodedJSValue WTF__toBase64URLStringValue(const uint8_t* bytes, size_t length, JSC::JSGlobalObject* globalObject);
--------------------------------------------------------------------------------
/src/bun.js/child_process.exports.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/bun.js/child_process.exports.js
--------------------------------------------------------------------------------
/src/bun.js/detect-libc.js:
--------------------------------------------------------------------------------
1 | export function family() {
2 | return Promise.resolve(null);
3 | }
4 |
5 | export function familySync() {
6 | return null;
7 | }
8 |
9 | export const GLIBC = "glibc";
10 | export const MUSL = "musl";
11 |
12 | export function versionAsync() {
13 | return Promise.resolve(version());
14 | }
15 |
16 | export function version() {
17 | return null;
18 | }
19 |
20 | export function isNonGlibcLinuxSync() {
21 | return false;
22 | }
23 |
24 | export function isNonGlibcLinux() {
25 | return Promise.resolve(isNonGlibcLinuxSync());
26 | }
27 |
--------------------------------------------------------------------------------
/src/bun.js/detect-libc.linux.js:
--------------------------------------------------------------------------------
1 | // bun only supports glibc at the time of writing
2 | export function family() {
3 | return Promise.resolve(GLIBC);
4 | }
5 |
6 | export function familySync() {
7 | return GLIBC;
8 | }
9 |
10 | export const GLIBC = "glibc";
11 | export const MUSL = "musl";
12 |
13 | export function versionAsync() {
14 | return Promise.resolve(version());
15 | }
16 |
17 | export function version() {
18 | return "2.29";
19 | }
20 |
21 | export function isNonGlibcLinuxSync() {
22 | return false;
23 | }
24 |
25 | export function isNonGlibcLinux() {
26 | return Promise.resolve(isNonGlibcLinuxSync());
27 | }
28 |
--------------------------------------------------------------------------------
/src/bun.js/node_streams_consumer.exports.js:
--------------------------------------------------------------------------------
1 | export const arrayBuffer = Bun.readableStreamToArrayBuffer;
2 | export const text = Bun.readableStreamToText;
3 | export const json = (stream) =>
4 | Bun.readableStreamToText(stream).then(JSON.parse);
5 |
6 | export const buffer = async (readableStream) => {
7 | return new Buffer(await arrayBuffer(readableStream));
8 | };
9 |
10 | export const blob = Bun.readableStreamToBlob;
11 |
--------------------------------------------------------------------------------
/src/bun.js/node_timers.exports.js:
--------------------------------------------------------------------------------
1 | export const setInterval = globalThis.setInterval;
2 | export const setImmediate = globalThis.queueMicrotask;
3 | export const setTimeout = globalThis.setTimeout;
4 | export const clearInterval = globalThis.clearInterval;
5 |
6 | // not implemented
7 | export const clearImmediate = () => {};
8 |
9 | export const clearTimeout = globalThis.clearTimeout;
10 | export const queueMicrotask = globalThis.queueMicrotask;
11 |
12 | export default {
13 | setInterval,
14 | queueMicrotask,
15 | setImmediate,
16 | setTimeout,
17 | clearInterval,
18 | clearImmediate,
19 | clearTimeout,
20 | };
21 |
--------------------------------------------------------------------------------
/src/bun.js/perf_hooks.exports.js:
--------------------------------------------------------------------------------
1 | export var performance = globalThis.performance;
2 |
3 | export class PerformanceObserver {
4 | constructor() {
5 | throw new Error("PerformanceEntry is not implemented yet");
6 | }
7 | }
8 |
9 | export class PerformanceEntry {
10 | constructor() {
11 | throw new Error("PerformanceEntry is not implemented yet");
12 | }
13 | }
14 | export class PerformanceNodeTiming {
15 | constructor() {
16 | throw new Error(
17 | "PerformanceNodeTiming is not supported in this environment."
18 | );
19 | }
20 | }
21 |
22 | export default {
23 | performance,
24 | PerformanceEntry,
25 | PerformanceEntry,
26 | PerformanceNodeTiming,
27 | };
28 |
--------------------------------------------------------------------------------
/src/bun.js/process.exports.js:
--------------------------------------------------------------------------------
1 | export const chdir = process.chdir.bind(process);
2 | export const cwd = process.cwd.bind(process);
3 | export const nextTick = process.nextTick.bind(process);
4 | export const browser = false;
5 | export var exitCode = process.exitCode;
6 | export const exit = process.exit.bind(process);
7 | export const pid = process.pid;
8 | export const ppid = process.ppid;
9 | export const release = process.release;
10 | export const version = process.version;
11 | export const versions = process.versions;
12 | export const arch = process.arch;
13 | export const platform = process.platform;
14 |
--------------------------------------------------------------------------------
/src/bun.js/script_execution_context.zig:
--------------------------------------------------------------------------------
1 | const JSC = @import("../jsc.zig");
2 |
3 | pub const ScriptExecutionContext = extern struct {
4 | main_file_path: JSC.ZigString,
5 | is_macro: bool = false,
6 | js_global_object: bool = false,
7 | };
8 |
--------------------------------------------------------------------------------
/src/cli/add_command.zig:
--------------------------------------------------------------------------------
1 | const Command = @import("../cli.zig").Command;
2 | const PackageManager = @import("../install/install.zig").PackageManager;
3 |
4 | pub const AddCommand = struct {
5 | pub fn exec(ctx: Command.Context) !void {
6 | try PackageManager.add(ctx);
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/src/cli/dev_command.zig:
--------------------------------------------------------------------------------
1 | const Server = @import("../http.zig").Server;
2 | const Command = @import("../cli.zig").Command;
3 | const Global = @import("../global.zig").Global;
4 | pub const DevCommand = struct {
5 | pub fn exec(ctx: Command.Context) !void {
6 | Global.configureAllocator(.{ .long_running = true });
7 | try Server.start(ctx.allocator, ctx.args, @TypeOf(ctx.debug), ctx.debug);
8 | }
9 | };
10 |
--------------------------------------------------------------------------------
/src/cli/discord_command.zig:
--------------------------------------------------------------------------------
1 | const bun = @import("../global.zig");
2 | const string = bun.string;
3 | const Output = bun.Output;
4 | const Global = bun.Global;
5 | const Environment = bun.Environment;
6 | const strings = bun.strings;
7 | const MutableString = bun.MutableString;
8 | const stringZ = bun.stringZ;
9 | const default_allocator = bun.default_allocator;
10 | const C = bun.C;
11 | const std = @import("std");
12 | const open = @import("../open.zig");
13 |
14 | pub const DiscordCommand = struct {
15 | const discord_url: string = "https://bun.sh/discord";
16 | pub fn exec(_: std.mem.Allocator) !void {
17 | try open.openURL(discord_url);
18 | }
19 | };
20 |
--------------------------------------------------------------------------------
/src/cli/install_command.zig:
--------------------------------------------------------------------------------
1 | const Command = @import("../cli.zig").Command;
2 | const PackageManager = @import("../install/install.zig").PackageManager;
3 |
4 | pub const InstallCommand = struct {
5 | pub fn exec(ctx: Command.Context) !void {
6 | try PackageManager.install(ctx);
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/src/cli/remove_command.zig:
--------------------------------------------------------------------------------
1 | const Command = @import("../cli.zig").Command;
2 | const PackageManager = @import("../install/install.zig").PackageManager;
3 |
4 | pub const RemoveCommand = struct {
5 | pub fn exec(ctx: Command.Context) !void {
6 | try PackageManager.remove(ctx);
7 | }
8 | };
9 |
--------------------------------------------------------------------------------
/src/deps/crash_reporter_linux.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 |
3 | pub fn start(_: anytype) bool {
4 | std.debug.attachSegfaultHandler();
5 | return true;
6 | }
7 |
8 | pub fn generate() void {}
9 |
10 | pub fn crashReportPath(_: *[1024]u8) []const u8 {
11 | return "";
12 | }
13 |
--------------------------------------------------------------------------------
/src/deps/picohttpparser.h.gch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/deps/picohttpparser.h.gch
--------------------------------------------------------------------------------
/src/deps/zig-clap/.gitignore:
--------------------------------------------------------------------------------
1 | zig-cache
2 |
--------------------------------------------------------------------------------
/src/deps/zig-clap/gyro.zzz:
--------------------------------------------------------------------------------
1 | pkgs:
2 | clap:
3 | version: 0.3.0
4 | license: Unlicense
5 | description: Simple command line argument parsing library
6 | source_url: "https://github.com/Hejsil/zig-clap"
7 | root: clap.zig
8 | files:
9 | README.md
10 | LICENSE
11 | build.zig
12 | clap/*.zig
13 | example/*.zig
14 |
15 |
--------------------------------------------------------------------------------
/src/deps/zig-clap/zig.mod:
--------------------------------------------------------------------------------
1 | id: aoe2l16htluewam6bfwvv0khsbbno8g8jd7suonifg74u7kd
2 | name: clap
3 | main: clap.zig
4 | license: Unlicense
5 | dependencies:
6 |
--------------------------------------------------------------------------------
/src/deps/zig-datetime/.gitignore:
--------------------------------------------------------------------------------
1 | zig-cache/
2 |
3 | .kdev4/
4 | *.kate-swp
5 |
6 |
--------------------------------------------------------------------------------
/src/deps/zig-datetime/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 | dist: bionic
3 | services:
4 | - docker
5 |
6 | before_install:
7 | # Install zig
8 | - sudo snap install zig --classic --edge
9 |
10 | script:
11 | # Run tests
12 | - zig build test
13 |
14 | after_success:
15 | - docker run --rm --security-opt seccomp=unconfined -v $(pwd):$(pwd) -w $(pwd) kcov/kcov kcov kcov-out ./zig-cache/o/*/test
16 | - bash <(curl -s https://codecov.io/bash) -s kcov-out
17 |
--------------------------------------------------------------------------------
/src/deps/zig-datetime/src/main.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 |
3 | pub const datetime = @import("datetime.zig");
4 | pub const timezones = @import("timezones.zig");
5 |
6 | comptime {
7 | std.testing.refAllDecls(@This());
8 | }
9 |
--------------------------------------------------------------------------------
/src/emcc_main.c:
--------------------------------------------------------------------------------
1 | #define STBI_ASSERT(x)
2 | #include
3 |
4 | #include
5 |
6 | extern void console_error(uint64_t slice);
7 | extern void console_log(uint64_t slice);
8 | extern void console_warn(uint64_t slice);
9 | extern void console_info(uint64_t slice);
10 |
11 | // Zig compiles C code with -fstack-protector-strong which requires the
12 | // following two symbols which don't seem to be provided by the emscripten
13 | // toolchain(?)
14 | uintptr_t __stack_chk_guard = 0xABBABABA;
15 | _Noreturn void __stack_chk_fail(void) { abort(); };
16 |
17 | // emsc_main() is the Zig entry function in pacman.zig
18 | extern void emsc_main(void);
19 | int main() {
20 | emsc_main();
21 | return 0;
22 | }
--------------------------------------------------------------------------------
/src/fallback-backend.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
11 |
12 |
15 |
16 |
19 |
20 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/favicon.png
--------------------------------------------------------------------------------
/src/generated_versions_list.zig:
--------------------------------------------------------------------------------
1 | // AUTO-GENERATED FILE. Created via .scripts/write-versions.sh
2 |
3 | pub const webkit = "9a039f4901c48680700174c28dd4693873f7593a";
4 | pub const mimalloc = "817569dfad79732233fb86649c89e04387ce02e9";
5 | pub const libarchive = "dc321febde83dd0f31158e1be61a7aedda65e7a2";
6 | pub const picohttpparser = "066d2b1e9ab820703db0837a7255d92d30f0c9f5";
7 | pub const boringssl = "b3ed071ecc4efb77afd0a025ea1078da19578bfd";
8 | pub const zlib = "959b4ea305821e753385e873ec4edfaa9a5d49b7";
9 | pub const zig = @import("std").fmt.comptimePrint("{}", .{@import("builtin").zig_version});
10 |
--------------------------------------------------------------------------------
/src/http/headers.zig:
--------------------------------------------------------------------------------
1 | const Api = @import("../api/schema.zig").Api;
2 | const std = @import("std");
3 |
4 | pub const Kv = struct {
5 | name: Api.StringPointer,
6 | value: Api.StringPointer,
7 | };
8 | pub const Entries = std.MultiArrayList(Kv);
9 |
--------------------------------------------------------------------------------
/src/install/install-scripts-allowlist.txt:
--------------------------------------------------------------------------------
1 | static-ffmpeg
2 | canvas
3 | better-sqlite3
4 | node-sass
--------------------------------------------------------------------------------
/src/io/io_stub.zig:
--------------------------------------------------------------------------------
1 | const std = @import("std");
2 | const IO = struct {
3 | buffer: i32 = 0,
4 | };
5 |
6 | pub fn init(_: anytype, _: anytype) anyerror!void {}
7 |
8 | pub var global: IO = undefined;
9 | pub var global_loaded: bool = false;
10 |
11 | fn buffer_limit(_: usize) usize {}
12 |
--------------------------------------------------------------------------------
/src/jsc_stub.zig:
--------------------------------------------------------------------------------
1 | // For WASM builds
2 | pub const is_bindgen = true;
3 | pub const C = struct {};
4 | pub const WebCore = struct {};
5 | pub const Jest = struct {};
6 | pub const API = struct {
7 | pub const Transpiler = struct {};
8 | };
9 | pub const Node = struct {};
10 |
11 | pub const VirtualMachine = struct {};
12 |
--------------------------------------------------------------------------------
/src/main_api.zig:
--------------------------------------------------------------------------------
1 | const Api = @import("./api/schema.zig").Api;
2 | const Options = @import("./options.zig");
3 | var options: Options.BundleOptions = undefined;
4 |
5 | export fn init() void {
6 | if (!alloc.needs_setup) {
7 | return;
8 | }
9 | }
10 |
11 | export fn setOptions(options_ptr: [*c]u8, options_len: c_int) void {}
12 |
--------------------------------------------------------------------------------
/src/node-fallbacks/assert.js:
--------------------------------------------------------------------------------
1 | export * from 'assert';
--------------------------------------------------------------------------------
/src/node-fallbacks/buffer.js:
--------------------------------------------------------------------------------
1 | export * from "buffer";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/node-fallbacks/bun.lockb
--------------------------------------------------------------------------------
/src/node-fallbacks/console.js:
--------------------------------------------------------------------------------
1 | module.exports = console;
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/constants.js:
--------------------------------------------------------------------------------
1 | export * from "constants-browserify";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/crypto.js:
--------------------------------------------------------------------------------
1 | export * from "crypto-browserify";
2 |
3 | const { randomUUID } = crypto;
4 | export { randomUUID };
5 |
--------------------------------------------------------------------------------
/src/node-fallbacks/domain.js:
--------------------------------------------------------------------------------
1 | export * from "domain-browser";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/http.js:
--------------------------------------------------------------------------------
1 | export * from "stream-http";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/https.js:
--------------------------------------------------------------------------------
1 | export * from "https-browserify";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/isomorphic-fetch.js:
--------------------------------------------------------------------------------
1 | var fetchHandler = globalThis.fetch;
2 |
3 | if ("Bun" in globalThis) {
4 | fetchHandler = Bun.fetch;
5 | }
6 |
7 | export default fetchHandler;
8 | export { fetchHandler as fetch };
9 |
--------------------------------------------------------------------------------
/src/node-fallbacks/node-fetch.js:
--------------------------------------------------------------------------------
1 | var fetchHandler = globalThis.fetch;
2 |
3 | if ("Bun" in globalThis) {
4 | fetchHandler = Bun.fetch;
5 | }
6 |
7 | export default fetchHandler;
8 | export { fetchHandler as fetch };
9 |
--------------------------------------------------------------------------------
/src/node-fallbacks/os.js:
--------------------------------------------------------------------------------
1 | export * from "os-browserify/browser";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/path.js:
--------------------------------------------------------------------------------
1 | export * from "path-browserify";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/process.js:
--------------------------------------------------------------------------------
1 | export * from "process/browser";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/punycode.js:
--------------------------------------------------------------------------------
1 | export * from "punycode";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/querystring.js:
--------------------------------------------------------------------------------
1 | export * from "querystring-es3";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/stream.js:
--------------------------------------------------------------------------------
1 | export * from "readable-stream";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/string_decoder.js:
--------------------------------------------------------------------------------
1 | export * from "string_decoder";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/sys.js:
--------------------------------------------------------------------------------
1 | export * from "util";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/timers.js:
--------------------------------------------------------------------------------
1 | export * from "timers-browserify";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/tty.js:
--------------------------------------------------------------------------------
1 | export * from "tty-browserify";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/util.js:
--------------------------------------------------------------------------------
1 | export * from "util";
2 |
--------------------------------------------------------------------------------
/src/node-fallbacks/zlib.js:
--------------------------------------------------------------------------------
1 | export * from "browserify-zlib";
2 |
--------------------------------------------------------------------------------
/src/runtime/index-with-refresh.ts:
--------------------------------------------------------------------------------
1 | export * from "./hmr";
2 | export * from "./errors";
3 | export * from "./index-without-hmr";
4 | export * as __FastRefreshRuntime from "../react-refresh";
5 |
6 | globalThis.process ||= {
7 | env: {},
8 | cwd() {
9 | return "/bun-fake-dir/";
10 | },
11 | };
12 |
--------------------------------------------------------------------------------
/src/runtime/index-without-hmr.ts:
--------------------------------------------------------------------------------
1 | export * from "../runtime.js";
2 | export { default as regeneratorRuntime } from "./regenerator";
3 |
--------------------------------------------------------------------------------
/src/runtime/index.ts:
--------------------------------------------------------------------------------
1 | export * from "./hmr";
2 | export * from "./errors";
3 | export * from "./index-without-hmr";
4 |
5 | globalThis.process ||= {
6 | env: {},
7 | cwd() {
8 | return "/bun-fake-dir/";
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/src/test/fixtures/array-binding-none.js:
--------------------------------------------------------------------------------
1 | var ho = true;
2 | console.log(([, len]) => true);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/await.ts:
--------------------------------------------------------------------------------
1 | function hey() {
2 | const foo = process.env.node_eNV;
3 | }
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/browsermap-false.ts:
--------------------------------------------------------------------------------
1 | import { Foo } from "browsermap";
2 |
3 | console.log(Foo);
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/class-with-property.ts:
--------------------------------------------------------------------------------
1 | class Foo {
2 | prop: string;
3 | }
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/compilation-prototype.js:
--------------------------------------------------------------------------------
1 | // The bug is:
2 | // when there are even number of scopes which have property accesses that themselves declare scopes,
3 |
4 | // the scope counter is wrong, causing an invariant check to fail.
5 | class f {}
6 | prop[class {}];
7 | class a {}
8 |
9 | // prop[class {}];
10 |
11 | // prop[
12 | // function (match) {
13 | // return 0;
14 | // }
15 | // ];
16 |
--------------------------------------------------------------------------------
/src/test/fixtures/console.log.js:
--------------------------------------------------------------------------------
1 | import hello from "./hello";
2 | console.log(hello);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/default_export_hmr_identifier_ref.tsx:
--------------------------------------------------------------------------------
1 | const Button = forwardRef(({}, ref) => {});
2 |
3 | Button.displayName = "Button";
4 |
5 | export default React.memo(Button);
6 |
--------------------------------------------------------------------------------
/src/test/fixtures/defines.js:
--------------------------------------------------------------------------------
1 | if (process.env.NODE_ENV === "production") {
2 | var foo;
3 | var bar = 1;
4 | } else {
5 | console.log("hi");
6 | }
7 |
8 | const wasm_imports_sym =
9 | process.env.NODE_ENV === "development"
10 | ? "wasm_imports"
11 | : Symbol("wasm_imports");
12 |
13 | console.log(foo);
14 |
15 | require("react").createElement();
16 |
17 | module.exports.bacon = true;
18 |
--------------------------------------------------------------------------------
/src/test/fixtures/disabled-import-bun.ts:
--------------------------------------------------------------------------------
1 | import * as Hello from "object-inspect";
2 |
3 | Hello.default();
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/duplicate-exports-bug.js:
--------------------------------------------------------------------------------
1 | export function boop() {}
2 |
3 | var UniformsUtils;
4 |
5 | export { UniformsUtils };
6 |
--------------------------------------------------------------------------------
/src/test/fixtures/escape-chars.mjs:
--------------------------------------------------------------------------------
1 | console.log("\u2028");
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/export-check.mjs:
--------------------------------------------------------------------------------
1 | export const isJavaScriptCore =
2 | !("process" in globalThis) && !("location" in globalThis);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/export-from.js:
--------------------------------------------------------------------------------
1 | export { foo } from "export-from-target";
2 | export { foo as bar } from "export-from-target";
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/for-loop-bug.js:
--------------------------------------------------------------------------------
1 | // For loop was missing initializer
2 | for (let i = 0; i < 100; i++) {
3 | console.log("hi");
4 | console.log("hey");
5 | }
6 |
--------------------------------------------------------------------------------
/src/test/fixtures/fragment.jsx:
--------------------------------------------------------------------------------
1 | const Foo = <>hi>;
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/hello.js:
--------------------------------------------------------------------------------
1 | export default "hello";
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/in-keyword.js:
--------------------------------------------------------------------------------
1 | const foo = "name" in Function.prototype === false;
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/json-parser-in-typescript.js:
--------------------------------------------------------------------------------
1 | // {
2 | // "name": "Jamie Kyle",
3 | // } & {
4 | // "twitter": "https://twitter.com/buildsghost"
5 | // }
6 | export default class Foo {
7 | }
8 |
--------------------------------------------------------------------------------
/src/test/fixtures/jsx-comment.tsx:
--------------------------------------------------------------------------------
1 | const foo = (
2 |
6 | );
7 |
8 | const bar = (
9 |
19 | );
20 |
--------------------------------------------------------------------------------
/src/test/fixtures/keyword-in-property-binding.tsx:
--------------------------------------------------------------------------------
1 | const FooBar = {};
2 | const ImportNamespace = {
3 | default: FooBar,
4 | };
5 |
6 | const { default: App } = ImportNamespace;
7 |
8 | console.log(FooBar || App);
9 |
--------------------------------------------------------------------------------
/src/test/fixtures/label-continue-break-bug.js:
--------------------------------------------------------------------------------
1 | label_name: {
2 | break label_name;
3 | }
4 |
5 | while_label: while (true) {
6 | for_label: for (let i = 0; i < 100; i++) {
7 | continue while_label;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/test/fixtures/main-field.ts:
--------------------------------------------------------------------------------
1 | import Algolia from "algoliasearch/lite";
2 |
3 | console.log(Algolia);
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/maybe-rewrite-index-accessor.js:
--------------------------------------------------------------------------------
1 | const isProd = process.env["NODE_ENV"] === "production";
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/me@2x.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/test/fixtures/me@2x.jpeg
--------------------------------------------------------------------------------
/src/test/fixtures/minifysyntax.js:
--------------------------------------------------------------------------------
1 | hi;
2 | console.log(process.env() ? true : false);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/module_exports_with_default_values.js:
--------------------------------------------------------------------------------
1 | module.exports = ({ level = "info", debug = false, console }) => {};
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/nested-destructuring-should-print-correctly.js:
--------------------------------------------------------------------------------
1 | function hey({
2 | config: {
3 | options: { ignore: e, only: t },
4 | },
5 | }) {
6 | return shouldIgnore(a, e, t, u);
7 | }
8 |
--------------------------------------------------------------------------------
/src/test/fixtures/noop.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/test/fixtures/noop.js
--------------------------------------------------------------------------------
/src/test/fixtures/nullish-coalesce.js:
--------------------------------------------------------------------------------
1 | const bar = true;
2 | const foo = false || false;
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/object-newline.js:
--------------------------------------------------------------------------------
1 | // hey
2 | const foo = import("react");
3 | const hey = 1;
4 | const Bar = {
5 | foo: true,
6 | bar: 1,
7 | nested: {
8 | hey,
9 | hi: 2,
10 | },
11 | };
12 |
--------------------------------------------------------------------------------
/src/test/fixtures/optional-chain-polyfill.js:
--------------------------------------------------------------------------------
1 | var onError = _this2.props.onError;
2 | onError === null || onError === void 0 ? void 0 : onError(err, ret, parsedFile);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/quoted-escape.js:
--------------------------------------------------------------------------------
1 | // bug: doesn't properly choose best escape quote
2 | export default "foo" + '=""';
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/react-context.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import type { DocumentProps } from "./internal/types";
3 |
4 | export const DocumentContext = React.createContext(null as any);
5 |
6 | if (process.env.NODE_ENV !== "production") {
7 | DocumentContext.displayName = "DocumentContext";
8 | }
9 |
--------------------------------------------------------------------------------
/src/test/fixtures/regexp-validation.js:
--------------------------------------------------------------------------------
1 | /(^|\s)(1?\d?\d)vw/g.test("hi");
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/require-detector.js:
--------------------------------------------------------------------------------
1 | const foo = require("react");
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/simple-component.js:
--------------------------------------------------------------------------------
1 | export function Welcome() {
2 | return Hi.
;
3 | }
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/simple-component.tsx:
--------------------------------------------------------------------------------
1 | type WelcomeProps = {
2 | greeting?: string;
3 | };
4 |
5 | export function Welcome(props: WelcomeProps) {
6 | return {props.greeting}
;
7 | }
8 |
--------------------------------------------------------------------------------
/src/test/fixtures/spread-bug.js:
--------------------------------------------------------------------------------
1 | // spread
2 | const { currentUserId } = cookies(ctx);
3 |
--------------------------------------------------------------------------------
/src/test/fixtures/symbols-bug.js:
--------------------------------------------------------------------------------
1 | var boom = {
2 | a: 2,
3 | b: "4",
4 | c: "6",
5 | d: "8",
6 | e: "10",
7 | f: 12,
8 | g: 14,
9 | }["15"];
10 |
11 | const foo = "bacon";
12 | const james = "not-bacon";
13 | const lordy = "sammy";
14 | const boop = {
15 | hey: { foo },
16 | };
17 |
--------------------------------------------------------------------------------
/src/test/fixtures/tailwind.css:
--------------------------------------------------------------------------------
1 | .such-css {
2 | }
3 |
4 | #VERY_STYLE {
5 | }
6 |
7 | @tailwind base;
8 |
9 | @tailwind notARealIdentifier;
10 |
11 | @tailwind utilities;
12 |
13 | @tailwind utilieis;
14 |
15 | @tailwind components;
16 |
17 | .Wowiiee {
18 | }
19 |
20 | @tailwind screens;
21 |
--------------------------------------------------------------------------------
/src/test/fixtures/test-import.css:
--------------------------------------------------------------------------------
1 | .bacon {
2 | display: block;
3 | }
4 |
--------------------------------------------------------------------------------
/src/test/fixtures/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "baseUrl": "/Users/jarredsumner/Code/bun/src/test/fixtures",
4 | "paths": {
5 | "components/*": ["components/*"]
6 | },
7 | "jsx": "preserve",
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/test/fixtures/tsx-bug.tsx:
--------------------------------------------------------------------------------
1 | const subtitleProps = searchQuery ? ({ mt: 3, size: "sm" } as const) : {};
2 |
--------------------------------------------------------------------------------
/src/test/fixtures/uescape.js:
--------------------------------------------------------------------------------
1 | var rsApos = "['\u2019]";
2 |
3 | console.log(rsApos);
4 |
--------------------------------------------------------------------------------
/src/typegen.zig:
--------------------------------------------------------------------------------
1 | pub const bindgen = true;
2 |
3 | pub fn main() anyerror!void {
4 | return try @import("bun.js/typescript.zig").main();
5 | }
6 |
--------------------------------------------------------------------------------
/src/which_npm_client.zig:
--------------------------------------------------------------------------------
1 | const bun = @import("./global.zig");
2 | const string = bun.string;
3 | const Output = bun.Output;
4 | const Global = bun.Global;
5 | const Environment = bun.Environment;
6 | const strings = bun.strings;
7 | const MutableString = bun.MutableString;
8 | const stringZ = bun.stringZ;
9 | const default_allocator = bun.default_allocator;
10 | const C = bun.C;
11 |
12 | const std = @import("std");
13 |
14 | pub const NPMClient = struct {
15 | bin: string,
16 | tag: Tag,
17 |
18 | pub const Tag = enum {
19 | bun,
20 | };
21 | };
22 |
--------------------------------------------------------------------------------
/src/yield.zig:
--------------------------------------------------------------------------------
1 | pub fn Yield(comptime Type: anytype) type {
2 | return struct {
3 | frame: @Frame(Type) = undefined,
4 | wait: bool = false,
5 |
6 | pub fn set(this: *@This(), frame: anytype) void {
7 | this.wait = true;
8 | this.frame = frame.*;
9 | }
10 |
11 | pub fn maybeResume(this: *@This()) void {
12 | if (!this.wait) return;
13 | this.wait = false;
14 | resume this.frame;
15 | }
16 | };
17 | }
18 |
--------------------------------------------------------------------------------
/src/zlib.test.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/src/zlib.test.gz
--------------------------------------------------------------------------------
/test/apps/bun-create-react.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | killall -9 $(basename $BUN_BIN) || echo ""
4 |
5 | rm -rf /tmp/react-app
6 | mkdir -p /tmp/react-app
7 | $BUN_BIN create react /tmp/react-app
8 |
9 |
10 | if (($?)); then
11 | echo "bun create failed"
12 | exit 1
13 | fi
14 |
15 | cd /tmp/react-app
16 | BUN_CRASH_WITHOUT_JIT=1 $BUN_BIN dev --port 8087 &
17 | sleep 0.005
18 |
19 | curl --fail http://localhost:8087/ && curl --fail http://localhost:8087/src/index.jsx && killall -9 $(basename $BUN_BIN) && echo "✅ bun create react passed."
20 | exit $?
21 |
--------------------------------------------------------------------------------
/test/apps/bun-install-utf8.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -euo pipefail
4 |
5 | killall -9 $(basename $BUN_BIN) || echo ""
6 |
7 | dir=$(mktemp -d --suffix=bun-ADD)
8 |
9 | cd $dir
10 |
11 | # https://github.com/Jarred-Sumner/bun/issues/115
12 | echo '{ "author": "Arnaud Barré (https://github.com/ArnaudBarre)" }' >package.json
13 |
14 | $BUN_BIN add react
15 |
--------------------------------------------------------------------------------
/test/apps/bun-run-check-nameless-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "scripts": {
3 | "this-should-work": "echo \"✅ bun run test passed!\"",
4 | "argv": "node -e 'console.log(process.argv)'"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/test/apps/bun-run-check-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "check",
3 | "scripts": {
4 | "this-should-work": "echo \"✅ bun run test passed!\"",
5 | "argv": "node -e 'console.log(process.argv)'"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/test/bun.js/baz.js:
--------------------------------------------------------------------------------
1 | // this file is used in resolve.test.js
2 | export default {};
3 |
--------------------------------------------------------------------------------
/test/bun.js/bigint.test.js:
--------------------------------------------------------------------------------
1 | import { describe, expect, it } from "bun:test";
2 |
3 | describe("BigInt", () => {
4 | it("compares correctly (literal)", () => {
5 | expect(42n).toBe(42n);
6 | });
7 |
8 | it("compares correctly (object)", () => {
9 | expect(BigInt(42n)).toBe(BigInt(42n));
10 | expect(42n).toBe(BigInt(42n));
11 | expect(BigInt(Bun.inspect(42n).substring(0, 2))).toBe(BigInt(42n));
12 | expect(BigInt(42n).valueOf()).toBe(BigInt(42n));
13 | });
14 | })
15 |
--------------------------------------------------------------------------------
/test/bun.js/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/bun.js/bun.lockb
--------------------------------------------------------------------------------
/test/bun.js/bundled/always-bundled-module/always-bundled-module:
--------------------------------------------------------------------------------
1 | node_modules/always-bundled-module
--------------------------------------------------------------------------------
/test/bun.js/bundled/always-bundled-module/cjs.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | default: 0xdeadbeef,
3 | default() {
4 | return "ok";
5 | },
6 | default: true,
7 | ok() {
8 | return true;
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/always-bundled-module/esm.js:
--------------------------------------------------------------------------------
1 | const __esModule = true;
2 |
3 | export const foo = () => __esModule;
4 |
5 | export { __esModule, foo as default };
6 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/always-bundled-module/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "always-bundled-module",
3 | "version": "1.0.0"
4 | }
5 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/entrypoint.ts:
--------------------------------------------------------------------------------
1 | import "i-am-bundled/cjs";
2 | import "i-am-bundled/esm";
3 | import "always-bundled-module/esm";
4 | import "always-bundled-module/cjs";
5 | import { foo } from "i-am-bundled/esm";
6 | import { foo as foo2 } from "always-bundled-module/esm";
7 | import cJS from "always-bundled-module/cjs";
8 |
9 | foo();
10 | foo2();
11 | cJS();
12 |
13 | export default cJS();
14 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "to-bundle",
3 | "scripts": {
4 | "prebundle": "rm -rf node_modules; cp -r to_bundle_node_modules node_modules; ln -s always-bundled-module node_modules/always-bundled-module",
5 | "bundle": "${BUN_BIN:-$(which bun)} bun ./entrypoint.ts"
6 | },
7 | "bun": {
8 | "alwaysBundle": [
9 | "always-bundled-module"
10 | ]
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/to_bundle_node_modules/i-am-bundled/cjs.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | default: 0xdeadbeef,
3 | default() {
4 | return "ok";
5 | },
6 | default: true,
7 | ok() {
8 | return true;
9 | },
10 | };
11 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/to_bundle_node_modules/i-am-bundled/esm.js:
--------------------------------------------------------------------------------
1 | const __esModule = true;
2 |
3 | export const foo = () => __esModule;
4 |
5 | export { __esModule, foo as default };
6 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/to_bundle_node_modules/i-am-bundled/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "i-am-bundled",
3 | "version": "1.0.0"
4 | }
5 |
--------------------------------------------------------------------------------
/test/bun.js/bundled/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "paths": {},
4 | "baseUrl": "."
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/test/bun.js/dirname.test.js:
--------------------------------------------------------------------------------
1 | import { expect, it } from "bun:test";
2 |
3 | it("__dirname should work", () => {
4 | expect(import.meta.dir).toBe(__dirname);
5 | });
6 |
7 | it("__filename should work", () => {
8 | expect(import.meta.path).toBe(__filename);
9 | });
10 |
--------------------------------------------------------------------------------
/test/bun.js/esm/first.mjs:
--------------------------------------------------------------------------------
1 | import { end, start } from "./startEnd.mjs";
2 |
3 | start("First");
4 |
5 | import "./second.mjs";
6 | import "./third.mjs";
7 |
8 | end("First");
9 |
--------------------------------------------------------------------------------
/test/bun.js/esm/second-child.mjs:
--------------------------------------------------------------------------------
1 | import { start, end } from "./startEnd.mjs";
2 |
3 | start("Second (nested import)");
4 |
5 | end("Second (nested import)");
6 |
--------------------------------------------------------------------------------
/test/bun.js/esm/second.mjs:
--------------------------------------------------------------------------------
1 | import { start, end } from "./startEnd.mjs";
2 |
3 | start("Second");
4 |
5 | import "./second-child.mjs";
6 |
7 | end("Second");
8 |
--------------------------------------------------------------------------------
/test/bun.js/esm/startEnd.mjs:
--------------------------------------------------------------------------------
1 | export function start(name) {
2 | console.log(`[start] ${name}`);
3 | }
4 | export function end(name) {
5 | console.log(`[end] ${name}`);
6 | }
7 |
--------------------------------------------------------------------------------
/test/bun.js/esm/third.mjs:
--------------------------------------------------------------------------------
1 | import { end, start } from "./startEnd.mjs";
2 |
3 | start("Third");
4 | end("Third");
5 |
--------------------------------------------------------------------------------
/test/bun.js/exit.js:
--------------------------------------------------------------------------------
1 | process.exit(0);
2 | throw new Error("Well that didn't work");
3 |
--------------------------------------------------------------------------------
/test/bun.js/gc.js:
--------------------------------------------------------------------------------
1 | export function gc() {
2 | // console.trace("GC");
3 | Bun.gc(true);
4 | }
5 |
6 | // we must ensure that finalizers are run
7 | // so that the reference-counting logic is exercised
8 | export function gcTick(trace = false) {
9 | trace && console.trace("");
10 | // console.trace("hello");
11 | gc();
12 | return new Promise((resolve) => {
13 | setTimeout(resolve, 0);
14 | });
15 | }
16 |
--------------------------------------------------------------------------------
/test/bun.js/import.live.decl.js:
--------------------------------------------------------------------------------
1 | export var foo = 1;
2 | export function setFoo(val) {
3 | foo = val;
4 | }
5 |
--------------------------------------------------------------------------------
/test/bun.js/import.live.rexport-require.js:
--------------------------------------------------------------------------------
1 | export const Namespace = import.meta.require("./import.live.decl.js");
2 |
--------------------------------------------------------------------------------
/test/bun.js/import.live.rexport.js:
--------------------------------------------------------------------------------
1 | export { foo, setFoo } from "./import.live.decl";
2 | import { foo as bar } from "./import.live.decl";
3 |
--------------------------------------------------------------------------------
/test/bun.js/inline.macro.js:
--------------------------------------------------------------------------------
1 | export function whatDidIPass(expr, ctx) {
2 | return ctx;
3 | }
4 |
--------------------------------------------------------------------------------
/test/bun.js/macro-check.js:
--------------------------------------------------------------------------------
1 | export function keepSecondArgument(bacon1234) {
2 | return bacon1234.arguments[1];
3 | }
4 |
5 | export function bacon(heloooo) {
6 | return heloooo.arguments[1];
7 | }
8 |
--------------------------------------------------------------------------------
/test/bun.js/node-builtins.test.js:
--------------------------------------------------------------------------------
1 | import { describe, it, expect } from "bun:test";
2 |
3 | import { EventEmitter } from "events";
4 |
5 | describe("EventEmitter", () => {
6 | it("should emit events", () => {
7 | const emitter = new EventEmitter();
8 | var called = false;
9 | const listener = () => {
10 | called = true;
11 | };
12 | emitter.on("test", listener);
13 | emitter.emit("test");
14 | expect(called).toBe(true);
15 | });
16 | });
17 |
--------------------------------------------------------------------------------
/test/bun.js/performance.test.js:
--------------------------------------------------------------------------------
1 | import { expect, it } from "bun:test";
2 |
3 | it("performance.now() should be monotonic", () => {
4 | const first = performance.now();
5 | const second = performance.now();
6 | const third = performance.now();
7 | const fourth = performance.now();
8 | const fifth = performance.now();
9 | const sixth = performance.now();
10 | expect(first < second).toBe(true);
11 | expect(second < third).toBe(true);
12 | expect(third < fourth).toBe(true);
13 | expect(fourth < fifth).toBe(true);
14 | expect(fifth < sixth).toBe(true);
15 | expect(Bun.nanoseconds() > 0).toBe(true);
16 | expect(Bun.nanoseconds() > sixth).toBe(true);
17 | expect(typeof Bun.nanoseconds() === "number").toBe(true);
18 | });
19 |
--------------------------------------------------------------------------------
/test/bun.js/readFileSync.txt:
--------------------------------------------------------------------------------
1 | File read successfully
--------------------------------------------------------------------------------
/test/bun.js/readdir.js:
--------------------------------------------------------------------------------
1 | const { readdirSync } = require("fs");
2 |
3 | const count = parseInt(process.env.ITERATIONS || "1", 10) || 1;
4 |
5 | for (let i = 0; i < count; i++) {
6 | readdirSync(".");
7 | }
8 |
9 | console.log(readdirSync("."));
10 |
--------------------------------------------------------------------------------
/test/bun.js/require-js-top-level-await.js:
--------------------------------------------------------------------------------
1 | export const fail = await 1;
2 |
--------------------------------------------------------------------------------
/test/bun.js/require-js.js:
--------------------------------------------------------------------------------
1 | import { hello } from "./require-js2.js";
2 | export { hello };
3 |
--------------------------------------------------------------------------------
/test/bun.js/require-js2.js:
--------------------------------------------------------------------------------
1 | export const hello = -123;
2 |
--------------------------------------------------------------------------------
/test/bun.js/require-json.json:
--------------------------------------------------------------------------------
1 | {
2 | "hello": -123
3 | }
4 |
--------------------------------------------------------------------------------
/test/bun.js/resolve-typescript-file.tsx:
--------------------------------------------------------------------------------
1 | export default {};
2 |
--------------------------------------------------------------------------------
/test/bun.js/shadow.test.js:
--------------------------------------------------------------------------------
1 | import { describe, it, expect } from "bun:test";
2 |
3 | it("shadow realm works", () => {
4 | const red = new ShadowRealm();
5 | globalThis.someValue = 1;
6 | // Affects only the ShadowRealm's global
7 | const result = red.evaluate("globalThis.someValue = 2;");
8 | expect(globalThis.someValue).toBe(1);
9 | expect(result).toBe(2);
10 | });
11 |
--------------------------------------------------------------------------------
/test/bun.js/sleep.js:
--------------------------------------------------------------------------------
1 | const interval = 0.01;
2 | const now = performance.now();
3 | console.time("Slept");
4 | Bun.sleepSync(interval);
5 | const elapsed = performance.now() - now;
6 | if (elapsed < interval) {
7 | throw new Error("Didn't sleep");
8 | }
9 |
10 | console.timeEnd("Slept");
11 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/customElements/code.js:
--------------------------------------------------------------------------------
1 | const template = (
2 |
8 | );
9 |
10 | const template2 = (
11 |
17 | );
18 |
19 | const template3 = (
20 |
21 |
22 |
23 | );
24 |
25 | const template4 = (
26 | <>
27 |
28 | >
29 | );
30 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/fragments/output.bun.js:
--------------------------------------------------------------------------------
1 | const multiStatic = ;
2 | const multiExpression = ;
3 | const multiDynamic = ;
4 | const singleExpression = ;
5 | const singleDynamic = ;
6 | const firstStatic = ;
7 | const firstDynamic = ;
8 | const firstComponent = ;
9 | const lastStatic = ;
10 | const lastDynamic = ;
11 | const lastComponent = ;
12 | const spaces = ;
13 | const multiLineTrailing = ;
14 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/namespaceElements/code.js:
--------------------------------------------------------------------------------
1 | const template = ;
2 | const template2 = ;
3 | const template3 = ;
4 | const template4 = ;
5 | const template5 = ;
6 | const template6 = ;
7 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/namespaceElements/output.js:
--------------------------------------------------------------------------------
1 | import { template as _$template } from "r-dom";
2 | import { createComponent as _$createComponent } from "r-dom";
3 |
4 | const _tmpl$ = /*#__PURE__*/ _$template(``, 2);
5 |
6 | const template = _$createComponent(module.A, {});
7 |
8 | const template2 = _$createComponent(module.a.B, {});
9 |
10 | const template3 = _$createComponent(module.A.B, {});
11 |
12 | const template4 = _$createComponent(module["a-b"], {});
13 |
14 | const template5 = _$createComponent(module["a-b"]["c-d"], {});
15 |
16 | const template6 = _tmpl$.cloneNode(true);
17 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/simpleElements/code.js:
--------------------------------------------------------------------------------
1 | const template = (
2 |
3 |
4 |
Welcome
5 |
6 |
7 | {/* Comment Node */}
8 |
9 | );
10 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/simpleElements/output.bun.js:
--------------------------------------------------------------------------------
1 | var _tmpl$1 = _template$(
2 | 'Welcome
',
3 | 8
4 | );
5 | const template = _tmpl$1.cloneNode(true);
6 |
--------------------------------------------------------------------------------
/test/bun.js/solid-dom-fixtures/simpleElements/output.js:
--------------------------------------------------------------------------------
1 | import { template as _$template } from "r-dom";
2 |
3 | const _tmpl$ = /*#__PURE__*/ _$template(
4 | `Welcome
`,
5 | 9
6 | );
7 |
8 | const template = _tmpl$.cloneNode(true);
9 |
--------------------------------------------------------------------------------
/test/bun.js/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "noEmit": true,
7 | "allowJs": true,
8 | "typeRoots": ["../../types"],
9 | "types": ["bun"],
10 | "allowSyntheticDefaultImports": true,
11 | "baseUrl": ".",
12 | "paths": {
13 | "foo/bar": ["baz.js"]
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/test/bun.js/wasm-return-1-test.zig:
--------------------------------------------------------------------------------
1 | export fn hello() i32 {
2 | return 1;
3 | }
4 |
5 | pub fn main() void {}
6 |
--------------------------------------------------------------------------------
/test/bun.js/wasm.js:
--------------------------------------------------------------------------------
1 | import * as wasm from "./wasm-return-1-test.wasm";
2 |
--------------------------------------------------------------------------------
/test/bun.js/wasm.test.js:
--------------------------------------------------------------------------------
1 | import { it } from "bun:test";
2 | // import * as wasm from "./wasm-return-1-test.wasm";
3 |
4 | // import { readFileSync } from "fs";
5 |
6 | // it("wasm readFileSync", async () => {
7 | // console.log("here");
8 | // console.log(wasm.hello());
9 | // });
10 |
11 | // it("wasm import", async () => {
12 | // console.log("heyt");
13 | // try {
14 | // console.log("hi");
15 | // expect(wasm.hello()).toBe(1);
16 | // } catch (err) {
17 | // console.error(err);
18 | // throw err;
19 | // }
20 | // });
21 |
--------------------------------------------------------------------------------
/test/bun.js/writeFileSync.txt:
--------------------------------------------------------------------------------
1 | File
--------------------------------------------------------------------------------
/test/macro/assert.tsx:
--------------------------------------------------------------------------------
1 | // This logs the result at build time
2 | export function unreachable(call) {
3 | throw new Error(call.arguments[0].toString() || "unreachable");
4 | }
5 |
--------------------------------------------------------------------------------
/test/macro/fetchSync.tsx:
--------------------------------------------------------------------------------
1 | export async function fetchSync(ctx) {
2 | const str = ctx.arguments[0].toString();
3 |
4 | const response = await fetch(str);
5 | const text = await response.text();
6 |
7 | return ;
8 | }
9 |
--------------------------------------------------------------------------------
/test/macro/hello-fetch-macro.tsx:
--------------------------------------------------------------------------------
1 | import { fetchSync } from "macro:./fetchSync.tsx";
2 |
3 | const synchronousFetch = fetchSync(`https://example.com`);
4 |
5 | console.log(synchronousFetch);
6 |
--------------------------------------------------------------------------------
/test/scripts/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/scripts/bun.lockb
--------------------------------------------------------------------------------
/test/scripts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "puppeteer": "^10.4.0"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/test/snapshots/.prettierignore:
--------------------------------------------------------------------------------
1 | *.js
--------------------------------------------------------------------------------
/test/snapshots/bundled-entry-point.debug.js:
--------------------------------------------------------------------------------
1 | import {
2 | __require as require
3 | } from "http://localhost:8080/bun:wrap";
4 | import * as $bbcd215f from "http://localhost:8080/node_modules/react/index.js";
5 | export function test() {
6 | return testDone(import.meta.url);
7 |
8 | }
9 |
10 |
11 | //# sourceMappingURL=http://localhost:8080/bundled-entry-point.js.map
12 |
--------------------------------------------------------------------------------
/test/snapshots/bundled-entry-point.js:
--------------------------------------------------------------------------------
1 | import {
2 | __require as require
3 | } from "http://localhost:8080/bun:wrap";
4 | import * as $45b81229 from "http://localhost:8080/node_modules/react/index.js";
5 | export function test() {
6 | return testDone(import.meta.url);
7 | }
8 |
9 | //# sourceMappingURL=http://localhost:8080/bundled-entry-point.js.map
10 |
--------------------------------------------------------------------------------
/test/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.debug.js:
--------------------------------------------------------------------------------
1 | import _login from "http://localhost:8080/_login.js";
2 | import _auth from "http://localhost:8080/_auth.js";
3 | import * as _loginReally from "http://localhost:8080/_login.js";
4 | import * as _loginReally2 from "http://localhost:8080/_login.js";
5 | import * as _authReally from "http://localhost:8080/_auth.js";
6 |
7 | export { _login as login };
8 |
9 | export function test() {
10 | return testDone(import.meta.url);
11 | }
12 | export let foo;
13 | export let bar;
14 |
15 | //# sourceMappingURL=http://localhost:8080/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js.map
16 |
--------------------------------------------------------------------------------
/test/snapshots/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js:
--------------------------------------------------------------------------------
1 | import _login from "http://localhost:8080/_login.js";
2 | import _auth from "http://localhost:8080/_auth.js";
3 | import * as _loginReally from "http://localhost:8080/_login.js";
4 | import * as _loginReally2 from "http://localhost:8080/_login.js";
5 | import * as _authReally from "http://localhost:8080/_auth.js";
6 |
7 | export { _login as login };
8 | export function test() {
9 | return testDone(import.meta.url);
10 | }
11 | export let foo;
12 | export let bar;
13 |
14 | //# sourceMappingURL=http://localhost:8080/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js.map
15 |
--------------------------------------------------------------------------------
/test/snapshots/export-default-module-hot.debug.js:
--------------------------------------------------------------------------------
1 | export default typeof module !== "undefined" && module.id;
2 | export function test() {
3 | testDone(import.meta.url);
4 | }
5 |
6 | //# sourceMappingURL=http://localhost:8080/export-default-module-hot.js.map
7 |
--------------------------------------------------------------------------------
/test/snapshots/export-default-module-hot.js:
--------------------------------------------------------------------------------
1 | export default typeof module !== "undefined" && module.id;
2 | export function test() {
3 | testDone(import.meta.url);
4 | }
5 |
6 | //# sourceMappingURL=http://localhost:8080/export-default-module-hot.js.map
7 |
--------------------------------------------------------------------------------
/test/snapshots/forbid-in-is-correct.debug.js:
--------------------------------------------------------------------------------
1 | var foo = () => {
2 | var D = (i, r) => () => (r || i((r = { exports: {} }).exports, r), r.exports);
3 | return D;
4 | };
5 | export function test() {
6 | foo();
7 | testDone(import.meta.url);
8 | }
9 |
10 | //# sourceMappingURL=http://localhost:8080/forbid-in-is-correct.js.map
11 |
--------------------------------------------------------------------------------
/test/snapshots/forbid-in-is-correct.js:
--------------------------------------------------------------------------------
1 | var foo = () => {
2 | var D = (i, r) => () => (r || i((r = { exports: {} }).exports, r), r.exports);
3 | return D;
4 | };
5 | export function test() {
6 | foo();
7 | testDone(import.meta.url);
8 | }
9 |
10 | //# sourceMappingURL=http://localhost:8080/forbid-in-is-correct.js.map
11 |
--------------------------------------------------------------------------------
/test/snapshots/global-is-remapped-to-globalThis.debug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | console.assert(globalThis === globalThis);
3 | return testDone(import.meta.url);
4 | }
5 |
6 | //# sourceMappingURL=http://localhost:8080/global-is-remapped-to-globalThis.js.map
7 |
--------------------------------------------------------------------------------
/test/snapshots/global-is-remapped-to-globalThis.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | console.assert(globalThis === globalThis);
3 | return testDone(import.meta.url);
4 | }
5 |
6 | //# sourceMappingURL=http://localhost:8080/global-is-remapped-to-globalThis.js.map
7 |
--------------------------------------------------------------------------------
/test/snapshots/multiple-var.debug.js:
--------------------------------------------------------------------------------
1 | var foo = true;
2 | globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT = true;
3 | if (globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT)
4 | ({ foo } = { foo: false });
5 | var foo;
6 | export function test() {
7 | console.assert(foo === false, "foo should be false");
8 | return testDone(import.meta.url);
9 | }
10 |
11 | //# sourceMappingURL=http://localhost:8080/multiple-var.js.map
12 |
--------------------------------------------------------------------------------
/test/snapshots/multiple-var.js:
--------------------------------------------------------------------------------
1 | var foo = true;
2 | globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT = true;
3 | if (globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT)
4 | ({ foo } = { foo: false });
5 | var foo;
6 | export function test() {
7 | console.assert(foo === false, "foo should be false");
8 | return testDone(import.meta.url);
9 | }
10 |
11 | //# sourceMappingURL=http://localhost:8080/multiple-var.js.map
12 |
--------------------------------------------------------------------------------
/test/snapshots/number-literal-bug.debug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | const precision = 10;
3 | try {
4 | parseFloat(0 .toPrecision(precision) + "1");
5 | } catch (exception) {
6 | throw new Error("Test Failed", exception);
7 | }
8 | testDone(import.meta.url);
9 | }
10 |
11 | //# sourceMappingURL=http://localhost:8080/number-literal-bug.js.map
12 |
--------------------------------------------------------------------------------
/test/snapshots/number-literal-bug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | const precision = 10;
3 | try {
4 | parseFloat(0 .toPrecision(precision) + "1");
5 | } catch (exception) {
6 | throw new Error("Test Failed", exception);
7 | }
8 | testDone(import.meta.url);
9 | }
10 |
11 | //# sourceMappingURL=http://localhost:8080/number-literal-bug.js.map
12 |
--------------------------------------------------------------------------------
/test/snapshots/optional-chain-with-function.debug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | try {
3 | const multipleSecondaryValues = undefined;
4 | const ratings = ["123"];
5 | var bar = multipleSecondaryValues?.map((value) => false);
6 | bar = bar?.multipleSecondaryValues?.map((value) => false);
7 | bar = bar?.bar?.multipleSecondaryValues?.map((value) => false);
8 | bar = {}?.bar?.multipleSecondaryValues?.map((value) => false);
9 | } catch (e) {
10 | throw e;
11 | }
12 | return testDone(import.meta.url);
13 | }
14 |
15 | //# sourceMappingURL=http://localhost:8080/optional-chain-with-function.js.map
16 |
--------------------------------------------------------------------------------
/test/snapshots/optional-chain-with-function.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | try {
3 | const multipleSecondaryValues = undefined;
4 | const ratings = ["123"];
5 | var bar = multipleSecondaryValues?.map((value) => false);
6 | bar = bar?.multipleSecondaryValues?.map((value) => false);
7 | bar = bar?.bar?.multipleSecondaryValues?.map((value) => false);
8 | bar = {}?.bar?.multipleSecondaryValues?.map((value) => false);
9 | } catch (e) {
10 | throw e;
11 | }
12 | return testDone(import.meta.url);
13 | }
14 |
15 | //# sourceMappingURL=http://localhost:8080/optional-chain-with-function.js.map
16 |
--------------------------------------------------------------------------------
/test/snapshots/package-json-utf8.debug.js:
--------------------------------------------------------------------------------
1 | import pkg from "http://localhost:8080/utf8-package-json.json";
2 | export function test() {
3 | console.assert(!!pkg.author);
4 |
5 | return testDone(import.meta.url);
6 | }
7 |
8 |
9 | //# sourceMappingURL=http://localhost:8080/package-json-utf8.js.map
10 |
--------------------------------------------------------------------------------
/test/snapshots/package-json-utf8.js:
--------------------------------------------------------------------------------
1 | import pkg from "http://localhost:8080/utf8-package-json.json";
2 | export function test() {
3 | console.assert(!!pkg.author);
4 | return testDone(import.meta.url);
5 | }
6 |
7 | //# sourceMappingURL=http://localhost:8080/package-json-utf8.js.map
8 |
--------------------------------------------------------------------------------
/test/snapshots/ts-fallback-rewrite-works.debug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | return testDone(import.meta.url);
3 | }
4 |
5 | //# sourceMappingURL=http://localhost:8080/ts-fallback-rewrite-works.js.map
6 |
--------------------------------------------------------------------------------
/test/snapshots/ts-fallback-rewrite-works.hmr.js:
--------------------------------------------------------------------------------
1 | import {
2 | __HMRClient as Bun
3 | } from "http://localhost:8080/bun:wrap";
4 | Bun.activate(false);
5 | import {
6 | __HMRModule as HMR
7 | } from "http://localhost:8080/bun:wrap";
8 | var hmr = new HMR(1227236257, "ts-fallback-rewrite-works.ts"), exports = hmr.exports;
9 | (hmr._load = function() {
10 | function test() {
11 | return testDone(import.meta.url);
12 | }
13 | hmr.exportAll({
14 | test: () => test
15 | });
16 | })();
17 | var $$hmr_test = hmr.exports.test;
18 | hmr._update = function(exports) {
19 | $$hmr_test = exports.test;
20 | };
21 |
22 | export {
23 | $$hmr_test as test
24 | };
25 |
26 | //# sourceMappingURL=http://localhost:8080/ts-fallback-rewrite-works.js.map
27 |
--------------------------------------------------------------------------------
/test/snapshots/ts-fallback-rewrite-works.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | return testDone(import.meta.url);
3 | }
4 |
5 | //# sourceMappingURL=http://localhost:8080/ts-fallback-rewrite-works.js.map
6 |
--------------------------------------------------------------------------------
/test/snapshots/tsx-fallback-rewrite-works.debug.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | return testDone(import.meta.url);
3 | }
4 |
5 | //# sourceMappingURL=http://localhost:8080/tsx-fallback-rewrite-works.js.map
6 |
--------------------------------------------------------------------------------
/test/snapshots/tsx-fallback-rewrite-works.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | return testDone(import.meta.url);
3 | }
4 |
5 | //# sourceMappingURL=http://localhost:8080/tsx-fallback-rewrite-works.js.map
6 |
--------------------------------------------------------------------------------
/test/snapshots/type-only-imports.debug.ts:
--------------------------------------------------------------------------------
1 | export const baconator = true;
2 | export const SilentSymbolCollisionsAreOkayInTypeScript = true;
3 | export function test() {
4 | console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
5 | console.assert(baconator);
6 | return testDone(import.meta.url);
7 | }
8 |
9 | //# sourceMappingURL=http://localhost:8080/type-only-imports.ts.map
10 |
--------------------------------------------------------------------------------
/test/snapshots/type-only-imports.ts:
--------------------------------------------------------------------------------
1 | export const baconator = true;
2 | export const SilentSymbolCollisionsAreOkayInTypeScript = true;
3 | export function test() {
4 | console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
5 | console.assert(baconator);
6 | return testDone(import.meta.url);
7 | }
8 |
9 | //# sourceMappingURL=http://localhost:8080/type-only-imports.ts.map
10 |
--------------------------------------------------------------------------------
/test/snapshots/unicode-identifiers.debug.js:
--------------------------------------------------------------------------------
1 | var ε = 0.000001;
2 | var ε2 = ε * ε;
3 | var π = Math.PI;
4 | var τ = 2 * π;
5 | var τε = τ - ε;
6 | var halfπ = π / 2;
7 | var d3_radians = π / 180;
8 | var d3_degrees = 180 / π;
9 |
10 | export { d3_radians };
11 | export function test() {
12 | console.assert(ε === 0.000001);
13 | return testDone(import.meta.url);
14 | }
15 |
16 | //# sourceMappingURL=http://localhost:8080/unicode-identifiers.js.map
17 |
--------------------------------------------------------------------------------
/test/snapshots/unicode-identifiers.js:
--------------------------------------------------------------------------------
1 | var ε = 0.000001;
2 | var ε2 = ε * ε;
3 | var π = Math.PI;
4 | var τ = 2 * π;
5 | var τε = τ - ε;
6 | var halfπ = π / 2;
7 | var d3_radians = π / 180;
8 | var d3_degrees = 180 / π;
9 |
10 | export { d3_radians };
11 | export function test() {
12 | console.assert(ε === 0.000001);
13 | return testDone(import.meta.url);
14 | }
15 |
16 | //# sourceMappingURL=http://localhost:8080/unicode-identifiers.js.map
17 |
--------------------------------------------------------------------------------
/test/snapshots/void-shouldnt-delete-call-expressions.debug.js:
--------------------------------------------------------------------------------
1 | var was_called = false;
2 | function thisShouldBeCalled() {
3 | was_called = true;
4 | }
5 | thisShouldBeCalled();
6 | export function test() {
7 | if (!was_called)
8 | throw new Error("Expected thisShouldBeCalled to be called");
9 | return testDone(import.meta.url);
10 | }
11 |
12 | //# sourceMappingURL=http://localhost:8080/void-shouldnt-delete-call-expressions.js.map
13 |
--------------------------------------------------------------------------------
/test/snapshots/void-shouldnt-delete-call-expressions.js:
--------------------------------------------------------------------------------
1 | var was_called = false;
2 | function thisShouldBeCalled() {
3 | was_called = true;
4 | }
5 | thisShouldBeCalled();
6 | export function test() {
7 | if (!was_called)
8 | throw new Error("Expected thisShouldBeCalled to be called");
9 | return testDone(import.meta.url);
10 | }
11 |
12 | //# sourceMappingURL=http://localhost:8080/void-shouldnt-delete-call-expressions.js.map
13 |
--------------------------------------------------------------------------------
/test/snippets/_auth.js:
--------------------------------------------------------------------------------
1 | export default "hi";
2 |
--------------------------------------------------------------------------------
/test/snippets/_bacon.js:
--------------------------------------------------------------------------------
1 | export let hello = true;
2 |
--------------------------------------------------------------------------------
/test/snippets/_login.js:
--------------------------------------------------------------------------------
1 | export default function () {
2 | return true;
3 | }
4 |
--------------------------------------------------------------------------------
/test/snippets/bun.lockb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/snippets/bun.lockb
--------------------------------------------------------------------------------
/test/snippets/bundled-entry-point.js:
--------------------------------------------------------------------------------
1 | import "react";
2 |
3 | var hello = 123 ? null ?? "world" : "ok";
4 |
5 | export function test() {
6 | return testDone(import.meta.url);
7 | }
8 |
--------------------------------------------------------------------------------
/test/snippets/cjs-transform-shouldnt-have-static-imports-in-cjs-function.js:
--------------------------------------------------------------------------------
1 | import _login from "./_login";
2 | import _auth from "./_auth";
3 | import * as _loginReally from "./_login";
4 | import * as _loginReally2 from "./_login";
5 | import * as _authReally from "./_auth";
6 |
7 | // module.exports.iAmCommonJs = true;
8 | // exports.YouAreCommonJS = true;
9 | // require("./_login");
10 | // require("./_login");
11 | export { _login as login };
12 |
13 | export function test() {
14 | return testDone(import.meta.url);
15 | }
16 |
17 | export let foo, bar;
18 |
--------------------------------------------------------------------------------
/test/snippets/custom-emotion-jsx/file.jsx:
--------------------------------------------------------------------------------
1 | import * as ReactDOM from "react-dom";
2 | export const Foo = () => ;
3 |
4 | export function test() {
5 | const element = document.createElement("div");
6 | element.id = "custom-emotion-jsx";
7 | document.body.appendChild(element);
8 | ReactDOM.render(, element);
9 | const style = window.getComputedStyle(element.firstChild);
10 | if (!(style["content"] ?? "").includes("it worked!")) {
11 | throw new Error('Expected "it worked!" but received: ' + style["content"]);
12 | }
13 |
14 | return testDone(import.meta.url);
15 | }
16 |
--------------------------------------------------------------------------------
/test/snippets/custom-emotion-jsx/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "jsxImportSource": "@emotion/react"
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/test/snippets/export-default-module-hot.js:
--------------------------------------------------------------------------------
1 | // This test passes if there's no syntax error
2 | export default typeof module !== "undefined" && module.id;
3 |
4 | export function test() {
5 | testDone(import.meta.url);
6 | }
7 |
--------------------------------------------------------------------------------
/test/snippets/forbid-in-is-correct.js:
--------------------------------------------------------------------------------
1 | var foo = () => {
2 | // prettier-ignore
3 | var D=(i,r)=>()=>(r||i((r={exports:{}}).exports,r),r.exports);
4 | return D;
5 | };
6 |
7 | export function test() {
8 | foo();
9 | testDone(import.meta.url);
10 | }
11 |
--------------------------------------------------------------------------------
/test/snippets/global-is-remapped-to-globalThis.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | console.assert(global === globalThis);
3 | return testDone(import.meta.url);
4 | }
5 |
--------------------------------------------------------------------------------
/test/snippets/jsx-top-level.tsx:
--------------------------------------------------------------------------------
1 | const isDropdown = true;
2 | const iconName = "";
3 | const adjustedPadding = 5;
4 |
5 | const Icon = ({ name, size, color }) => {
6 | return name;
7 | };
8 |
9 | const Foo = ;
10 | const yoooo = [];
11 | const iconProps = {
12 | // This regression test is to ensure that the JSX value here does not print as an e_missing (nothing)
13 | rightIcon: ,
14 | paddingRight: adjustedPadding,
15 | };
16 |
17 | export function test() {
18 | const foo = iconProps.rightIcon;
19 | yoooo[0];
20 | return testDone(import.meta.url);
21 | }
22 |
--------------------------------------------------------------------------------
/test/snippets/multiple-imports.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import React2 from "react";
3 |
4 | const bacon = React;
5 | const bacon2 = <>hello>;
6 |
7 | export function test() {
8 | console.assert(bacon === React);
9 | console.assert(bacon === React2);
10 | console.assert(typeof bacon2 !== "undefined");
11 | console.assert(React.isValidElement(bacon2));
12 | return testDone(import.meta.url);
13 | }
14 |
--------------------------------------------------------------------------------
/test/snippets/multiple-var.js:
--------------------------------------------------------------------------------
1 | var foo = true;
2 |
3 | globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT = true;
4 | if (globalThis.TRUE_BUT_WE_CANT_TREESHAKE_IT) {
5 | var { foo } = { foo: false };
6 | }
7 |
8 | export function test() {
9 | console.assert(foo === false, "foo should be false");
10 | return testDone(import.meta.url);
11 | }
12 |
--------------------------------------------------------------------------------
/test/snippets/number-literal-bug.js:
--------------------------------------------------------------------------------
1 | // test that we don't call functions on number literals
2 | export function test() {
3 | const precision = 10;
4 | try {
5 | parseFloat((0.0).toPrecision(precision) + "1");
6 | } catch (exception) {
7 | throw new Error("Test Failed", exception);
8 | }
9 |
10 | testDone(import.meta.url);
11 | }
12 |
--------------------------------------------------------------------------------
/test/snippets/optional-chain-with-function.js:
--------------------------------------------------------------------------------
1 | export function test() {
2 | try {
3 | const multipleSecondaryValues = undefined;
4 | const ratings = ["123"];
5 |
6 | var bar = multipleSecondaryValues?.map((value) => false);
7 | bar = bar?.multipleSecondaryValues?.map((value) => false);
8 | bar = bar?.bar?.multipleSecondaryValues?.map((value) => false);
9 | bar = {}?.bar?.multipleSecondaryValues?.map((value) => false);
10 | } catch (e) {
11 | throw e;
12 | }
13 |
14 | return testDone(import.meta.url);
15 | }
16 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/exact/im-exact.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/snippets/package-json-exports/_node_modules_copy/exact/im-exact.js
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/exact/package.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/snippets/package-json-exports/_node_modules_copy/exact/package.json
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/browser/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "browser";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/browser/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/browser/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/browser/index.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/default/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/default/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/default/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'default';
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/default/index.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/node/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "node";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/node/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = "node";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/node/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'node';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/node/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/snippets/package-json-exports/_node_modules_copy/inexact/node/index.js
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/inexact/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "inexact",
3 | "exports": {
4 | ".": {
5 | "node": "./node/index.js",
6 | "browser": "./browser/index.js",
7 | "default": "./default/index.js"
8 | },
9 | "./foo": {
10 | "node": "./node/foo.js",
11 | "browser": "./browser/foo.js",
12 | "default": "./default/foo.js"
13 | },
14 | "./": {
15 | "node": "./node/dir/",
16 | "browser": "./browser/dir/",
17 | "default": "./default/dir/"
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "browser";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/index.js:
--------------------------------------------------------------------------------
1 | export const target = 'browser';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/js-file.js:
--------------------------------------------------------------------------------
1 | export const isJS = true;
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/browser/js-file.ts:
--------------------------------------------------------------------------------
1 | export const target = "browser";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/default/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/default/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/default/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'default';
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/default/index.js:
--------------------------------------------------------------------------------
1 | export const target = "default";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/node/dir/file.js:
--------------------------------------------------------------------------------
1 | export const target = "node";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/node/dir/foo.js:
--------------------------------------------------------------------------------
1 | export const target = "node";
2 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/node/foo.js:
--------------------------------------------------------------------------------
1 | export const target = 'node';
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/node/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/node/index.js
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/_node_modules_copy/js-only-exports/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "js-only-exports",
3 | "exports": {
4 | "./*": {
5 | "node": "./node/*.js",
6 | "browser": "./browser/*.js",
7 | "default": "./default/*.js"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/index.js:
--------------------------------------------------------------------------------
1 | import * as InexactRoot from "inexact";
2 | import * as InexactFile from "inexact/file";
3 | import * as ExactFile from "inexact/foo";
4 | import * as JSFileExtensionOnly from "js-only-exports/js-file";
5 |
6 | export async function test() {
7 | console.assert(InexactRoot.target === "browser");
8 | console.assert(InexactFile.target === "browser");
9 | console.assert(ExactFile.target === "browser");
10 | console.assert(JSFileExtensionOnly.isJS === true);
11 | return testDone(import.meta.url);
12 | }
13 |
--------------------------------------------------------------------------------
/test/snippets/package-json-exports/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "package-json-exports"
3 | }
4 |
--------------------------------------------------------------------------------
/test/snippets/package-json-utf8.js:
--------------------------------------------------------------------------------
1 | import pkg from "./utf8-package-json.json";
2 |
3 | export function test() {
4 | console.assert(!!pkg.author);
5 | return testDone(import.meta.url);
6 | }
7 |
--------------------------------------------------------------------------------
/test/snippets/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "snippets",
3 | "license": "MIT",
4 | "dependencies": {
5 | "@emotion/core": "^11.0.0",
6 | "@emotion/react": "^11.4.1",
7 | "lodash": "^4.17.21",
8 | "react": "^17.0.2",
9 | "react-dom": "^17.0.2",
10 | "redux": "^4.1.1",
11 | "styled-components": "^5.3.1"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/test/snippets/segfault.js:
--------------------------------------------------------------------------------
1 | Bun.unsafe.segfault();
2 |
--------------------------------------------------------------------------------
/test/snippets/spread_with_key.tsx:
--------------------------------------------------------------------------------
1 | import React from "react";
2 |
3 | export function SpreadWithTheKey({ className }: Props) {
4 | const rest = {};
5 | return (
6 | console.log("click")}
11 | >
12 | Rendered component containing warning
13 |
14 | );
15 | }
16 |
17 | export function test() {
18 | console.assert(React.isValidElement());
19 | return testDone(import.meta.url);
20 | }
21 |
--------------------------------------------------------------------------------
/test/snippets/ts-fallback-rewrite-works.ts:
--------------------------------------------------------------------------------
1 | // This looks like it does nothing
2 | // But if you import /ts-fallback-rewrite-works.js, it should resolve the import to /ts-fallback-rewrite-works.ts
3 | export function test() {
4 | return testDone(import.meta.url);
5 | }
6 |
--------------------------------------------------------------------------------
/test/snippets/tsx-fallback-rewrite-works.tsx:
--------------------------------------------------------------------------------
1 | // This looks like it does nothing
2 | // But if you import /tsx-fallback-rewrite-works.js, it should resolve the import to /tsx-fallback-rewrite-works.tsx
3 | export function test() {
4 | return testDone(import.meta.url);
5 | }
6 |
--------------------------------------------------------------------------------
/test/snippets/type-only-imports.ts:
--------------------------------------------------------------------------------
1 | import type Bacon from "tree";
2 | import type { SilentSymbolCollisionsAreOkayInTypeScript } from "./app";
3 |
4 | export const baconator: Bacon = true;
5 | export const SilentSymbolCollisionsAreOkayInTypeScript: SilentSymbolCollisionsAreOkayInTypeScript =
6 | true;
7 |
8 | export function test() {
9 | console.assert(SilentSymbolCollisionsAreOkayInTypeScript);
10 | console.assert(baconator);
11 | return testDone(import.meta.url);
12 | }
13 |
--------------------------------------------------------------------------------
/test/snippets/unicode-identifiers.js:
--------------------------------------------------------------------------------
1 | var ε = 1e-6,
2 | ε2 = ε * ε,
3 | π = Math.PI,
4 | τ = 2 * π,
5 | τε = τ - ε,
6 | halfπ = π / 2,
7 | d3_radians = π / 180,
8 | d3_degrees = 180 / π;
9 |
10 | export { d3_radians };
11 |
12 | export function test() {
13 | console.assert(ε === 1e-6);
14 | return testDone(import.meta.url);
15 | }
16 |
--------------------------------------------------------------------------------
/test/snippets/utf8-package-json.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Arnuad Barré (https://github.com/ArnaudBarre)"
3 | }
4 |
--------------------------------------------------------------------------------
/test/snippets/void-shouldnt-delete-call-expressions.js:
--------------------------------------------------------------------------------
1 | var was_called = false;
2 | function thisShouldBeCalled() {
3 | was_called = true;
4 | }
5 |
6 | void thisShouldBeCalled();
7 |
8 | export function test() {
9 | if (!was_called) {
10 | throw new Error("Expected thisShouldBeCalled to be called");
11 | }
12 |
13 | return testDone(import.meta.url);
14 | }
15 |
--------------------------------------------------------------------------------
/test/snippets/zero.js:
--------------------------------------------------------------------------------
1 | export const zero = "\0";
2 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "typeRoots": ["./types"],
7 | "types": ["bun"]
8 | },
9 | "exclude": ["src"]
10 | }
11 |
--------------------------------------------------------------------------------
/types/bun/README.md:
--------------------------------------------------------------------------------
1 | # Bun type definitions
2 |
3 | This has type definitions for Bun.js APIs. The type definitions are merged into a single file and copied to [../../packages/bun-types/types.d.ts](../../packages/bun-types/types.d.ts).
4 |
5 | ## Adding a new file
6 |
7 | 1. Add it to [./index.d.ts](./index.d.ts)
8 | 2. Add it to [./paths.txt](./paths.txt)
9 |
10 | ## How to generate types.d.ts
11 |
12 | [`./bundle.ts`](./bundle.ts) merges the types in this folder into a single file.
13 |
14 | To run it:
15 |
16 | ```bash
17 | bun ./bundle.ts ../../packages/bun-types
18 | ```
19 |
--------------------------------------------------------------------------------
/types/bun/constants.d.ts:
--------------------------------------------------------------------------------
1 | /** @deprecated use constants property exposed by the relevant module instead. */
2 | declare module 'constants' {
3 | import { constants as osConstants, SignalConstants } from 'node:os';
4 | import { constants as cryptoConstants } from 'node:crypto';
5 | import { constants as fsConstants } from 'node:fs';
6 |
7 | const exp: typeof osConstants.errno &
8 | typeof osConstants.priority &
9 | SignalConstants &
10 | typeof cryptoConstants &
11 | typeof fsConstants;
12 | export = exp;
13 | }
14 |
15 | declare module 'node:constants' {
16 | import constants = require('constants');
17 | export = constants;
18 | }
--------------------------------------------------------------------------------
/types/bun/header.txt:
--------------------------------------------------------------------------------
1 | // Type definitions for bun 0.0
2 | // Project: https://github.com/oven-sh/bun
3 | // Definitions by: Jarred Sumner
4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5 | ///
6 | ///
7 |
8 | // This file is bundled so that your TypeScript editor integration loads it faster.
9 |
--------------------------------------------------------------------------------
/types/bun/index.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/softwarearchitect817/Bun-fast-JavaScript-runtime/67d68cce5628af927cfe6974acc8e041674ee43e/types/bun/index.js
--------------------------------------------------------------------------------
/types/bun/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bun",
3 | "types": "index.d.ts"
4 | }
5 |
--------------------------------------------------------------------------------
/types/bun/paths.txt:
--------------------------------------------------------------------------------
1 | ./bun.d.ts
2 | ./buffer.d.ts
3 | ./ffi.d.ts
4 | ./sqlite.d.ts
5 | ./fs.d.ts
6 | ./html-rewriter.d.ts
7 | ./globals.d.ts
8 | ./path.d.ts
9 | ./bun-test.d.ts
10 | ./jsc.d.ts
11 | ./assert.d.ts
12 | ./events.d.ts
13 | ./os.d.ts
14 | ./domain.d.ts
15 | ./util.d.ts
16 | ./querystring.d.ts
17 | ./string_decoder.d.ts
18 | ./timers.d.ts
19 | ./stream.d.ts
20 | ./crypto.d.ts
21 | ./constants.d.ts
22 | ./url.d.ts
23 | ./tty.d.ts
24 | ./http.d.ts
25 | ./punycode.d.ts
26 | ./zlib.d.ts
27 | ./supports-color.d.ts
--------------------------------------------------------------------------------
/types/bun/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "emitDeclarationOnly": true,
5 | "lib": ["ESNext"],
6 | "baseUrl": ".",
7 | "rootDir": ".",
8 | "outFile": "./types.d.ts",
9 | "skipLibCheck": true,
10 | "target": "esnext",
11 | "disableSolutionSearching": true
12 | },
13 | "include": ["./*.d.ts"],
14 | "exclude": [
15 | "node_modules",
16 | "./node_modules",
17 | "./node_modules/*",
18 | "./node_modules/@types/node/index.d.ts"
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/types/bun/tty.d.ts:
--------------------------------------------------------------------------------
1 |
2 | declare module 'tty' {
3 | /**
4 | * The `tty.isatty()` method returns `true` if the given `fd` is associated with
5 | * a TTY and `false` if it is not, including whenever `fd` is not a non-negative
6 | * integer.
7 | * @since v0.5.8
8 | * @param fd A numeric file descriptor
9 | */
10 | function isatty(fd: number): boolean;
11 |
12 | // TODO: tty-browserify only polyfills functions that throws errors, wouldn't make sense to have types at the moment
13 | var ReadStream: Function;
14 | var WriteStream: Function;
15 | }
16 | declare module 'node:tty' {
17 | export * from 'tty';
18 | }
--------------------------------------------------------------------------------
/zig-build/.dockerignore:
--------------------------------------------------------------------------------
1 | *
2 |
--------------------------------------------------------------------------------