bun-types 1.3.2-canary.20251105T140650 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bun.d.ts +102 -6
- package/docs/README.md +28 -0
- package/docs/bundler/bytecode.mdx +465 -0
- package/docs/bundler/{css.md → css.mdx} +97 -101
- package/docs/bundler/esbuild.mdx +253 -0
- package/docs/bundler/{executables.md → executables.mdx} +130 -221
- package/docs/bundler/fullstack.mdx +1064 -0
- package/docs/bundler/{hmr.md → hot-reloading.mdx} +74 -79
- package/docs/bundler/{html.md → html-static.mdx} +148 -111
- package/docs/bundler/index.mdx +1499 -0
- package/docs/bundler/loaders.mdx +356 -0
- package/docs/bundler/{macros.md → macros.mdx} +83 -84
- package/docs/bundler/minifier.mdx +1306 -0
- package/docs/bundler/plugins.mdx +411 -0
- package/docs/feedback.mdx +85 -0
- package/docs/guides/binary/{arraybuffer-to-array.md → arraybuffer-to-array.mdx} +3 -1
- package/docs/guides/binary/{arraybuffer-to-blob.md → arraybuffer-to-blob.mdx} +3 -1
- package/docs/guides/binary/{arraybuffer-to-buffer.md → arraybuffer-to-buffer.mdx} +3 -1
- package/docs/guides/binary/{arraybuffer-to-string.md → arraybuffer-to-string.mdx} +3 -1
- package/docs/guides/binary/{arraybuffer-to-typedarray.md → arraybuffer-to-typedarray.mdx} +3 -1
- package/docs/guides/binary/{blob-to-arraybuffer.md → blob-to-arraybuffer.mdx} +3 -1
- package/docs/guides/binary/{blob-to-dataview.md → blob-to-dataview.mdx} +3 -1
- package/docs/guides/binary/{blob-to-stream.md → blob-to-stream.mdx} +3 -1
- package/docs/guides/binary/{blob-to-string.md → blob-to-string.mdx} +3 -1
- package/docs/guides/binary/{blob-to-typedarray.md → blob-to-typedarray.mdx} +3 -1
- package/docs/guides/binary/{buffer-to-arraybuffer.md → buffer-to-arraybuffer.mdx} +3 -1
- package/docs/guides/binary/{buffer-to-blob.md → buffer-to-blob.mdx} +3 -1
- package/docs/guides/binary/{buffer-to-readablestream.md → buffer-to-readablestream.mdx} +3 -1
- package/docs/guides/binary/{buffer-to-string.md → buffer-to-string.mdx} +3 -1
- package/docs/guides/binary/{buffer-to-typedarray.md → buffer-to-typedarray.mdx} +3 -1
- package/docs/guides/binary/{dataview-to-string.md → dataview-to-string.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-arraybuffer.md → typedarray-to-arraybuffer.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-blob.md → typedarray-to-blob.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-buffer.md → typedarray-to-buffer.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-dataview.md → typedarray-to-dataview.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-readablestream.md → typedarray-to-readablestream.mdx} +3 -1
- package/docs/guides/binary/{typedarray-to-string.md → typedarray-to-string.mdx} +3 -1
- package/docs/guides/deployment/aws-lambda.mdx +204 -0
- package/docs/guides/deployment/digital-ocean.mdx +161 -0
- package/docs/guides/deployment/google-cloud-run.mdx +197 -0
- package/docs/guides/deployment/{railway.md → railway.mdx} +42 -54
- package/docs/guides/deployment/render.mdx +82 -0
- package/docs/guides/deployment/vercel.mdx +99 -0
- package/docs/guides/ecosystem/{astro.md → astro.mdx} +16 -6
- package/docs/guides/ecosystem/{discordjs.md → discordjs.mdx} +21 -18
- package/docs/guides/ecosystem/{docker.md → docker.mdx} +25 -14
- package/docs/guides/ecosystem/{drizzle.md → drizzle.mdx} +32 -22
- package/docs/guides/ecosystem/{edgedb.md → edgedb.mdx} +63 -34
- package/docs/guides/ecosystem/{elysia.md → elysia.mdx} +11 -11
- package/docs/guides/ecosystem/{express.md → express.mdx} +12 -9
- package/docs/guides/ecosystem/{hono.md → hono.mdx} +16 -8
- package/docs/guides/ecosystem/{mongoose.md → mongoose.mdx} +26 -21
- package/docs/guides/ecosystem/{neon-drizzle.md → neon-drizzle.mdx} +49 -35
- package/docs/guides/ecosystem/{neon-serverless-postgres.md → neon-serverless-postgres.mdx} +16 -11
- package/docs/guides/ecosystem/{nextjs.md → nextjs.mdx} +18 -10
- package/docs/guides/ecosystem/{nuxt.md → nuxt.mdx} +45 -11
- package/docs/guides/ecosystem/{pm2.md → pm2.mdx} +7 -9
- package/docs/guides/ecosystem/prisma-postgres.mdx +169 -0
- package/docs/guides/ecosystem/prisma.mdx +164 -0
- package/docs/guides/ecosystem/{qwik.md → qwik.mdx} +18 -11
- package/docs/guides/ecosystem/{react.md → react.mdx} +9 -7
- package/docs/guides/ecosystem/{remix.md → remix.mdx} +45 -26
- package/docs/guides/ecosystem/{sentry.md → sentry.mdx} +7 -5
- package/docs/guides/ecosystem/{solidstart.md → solidstart.mdx} +21 -13
- package/docs/guides/ecosystem/{ssr-react.md → ssr-react.mdx} +9 -11
- package/docs/guides/ecosystem/{stric.md → stric.mdx} +16 -17
- package/docs/guides/ecosystem/{sveltekit.md → sveltekit.mdx} +42 -29
- package/docs/guides/ecosystem/{systemd.md → systemd.mdx} +27 -26
- package/docs/guides/ecosystem/upstash.mdx +87 -0
- package/docs/guides/ecosystem/{vite.md → vite.mdx} +20 -14
- package/docs/guides/html-rewriter/{extract-links.md → extract-links.mdx} +11 -7
- package/docs/guides/html-rewriter/{extract-social-meta.md → extract-social-meta.mdx} +6 -2
- package/docs/guides/http/{cluster.md → cluster.mdx} +10 -7
- package/docs/guides/http/{fetch-unix.md → fetch-unix.mdx} +5 -3
- package/docs/guides/http/{fetch.md → fetch.mdx} +5 -3
- package/docs/guides/http/{file-uploads.md → file-uploads.mdx} +18 -15
- package/docs/guides/http/{hot.md → hot.mdx} +9 -7
- package/docs/guides/http/{proxy.md → proxy.mdx} +7 -5
- package/docs/guides/http/{server.md → server.mdx} +4 -2
- package/docs/guides/http/{simple.md → simple.mdx} +4 -2
- package/docs/guides/http/{stream-file.md → stream-file.mdx} +6 -4
- package/docs/guides/http/{stream-iterator.md → stream-iterator.mdx} +5 -3
- package/docs/guides/http/{stream-node-streams-in-bun.md → stream-node-streams-in-bun.mdx} +4 -2
- package/docs/guides/http/{tls.md → tls.mdx} +5 -3
- package/docs/guides/index.mdx +10 -0
- package/docs/guides/install/{add-dev.md → add-dev.mdx} +8 -6
- package/docs/guides/install/add-git.mdx +38 -0
- package/docs/guides/install/{add-optional.md → add-optional.mdx} +7 -5
- package/docs/guides/install/{add-peer.md → add-peer.mdx} +13 -11
- package/docs/guides/install/{add-tarball.md → add-tarball.mdx} +7 -5
- package/docs/guides/install/{add.md → add.mdx} +12 -10
- package/docs/guides/install/{azure-artifacts.md → azure-artifacts.mdx} +15 -12
- package/docs/guides/{runtime/cicd.md → install/cicd.mdx} +13 -13
- package/docs/guides/install/{custom-registry.md → custom-registry.mdx} +6 -4
- package/docs/guides/install/{from-npm-install-to-bun-install.md → from-npm-install-to-bun-install.mdx} +50 -34
- package/docs/guides/install/{git-diff-bun-lockfile.md → git-diff-bun-lockfile.mdx} +14 -11
- package/docs/guides/install/{jfrog-artifactory.md → jfrog-artifactory.mdx} +4 -4
- package/docs/guides/install/{npm-alias.md → npm-alias.mdx} +6 -4
- package/docs/guides/install/{registry-scope.md → registry-scope.mdx} +6 -4
- package/docs/guides/install/{trusted.md → trusted.mdx} +22 -18
- package/docs/guides/install/{workspaces.md → workspaces.mdx} +13 -13
- package/docs/guides/install/{yarnlock.md → yarnlock.mdx} +15 -9
- package/docs/guides/process/{argv.md → argv.mdx} +17 -9
- package/docs/guides/process/{ctrl-c.md → ctrl-c.mdx} +4 -2
- package/docs/guides/process/{ipc.md → ipc.mdx} +13 -10
- package/docs/guides/process/{nanoseconds.md → nanoseconds.mdx} +3 -1
- package/docs/guides/process/{os-signals.md → os-signals.mdx} +3 -1
- package/docs/guides/process/{spawn-stderr.md → spawn-stderr.mdx} +4 -1
- package/docs/guides/process/{spawn-stdout.md → spawn-stdout.mdx} +3 -1
- package/docs/guides/process/{spawn.md → spawn.mdx} +3 -1
- package/docs/guides/process/{stdin.md → stdin.mdx} +15 -7
- package/docs/guides/read-file/{arraybuffer.md → arraybuffer.mdx} +5 -3
- package/docs/guides/read-file/{buffer.md → buffer.mdx} +4 -2
- package/docs/guides/read-file/{exists.md → exists.mdx} +4 -2
- package/docs/guides/read-file/{json.md → json.mdx} +4 -2
- package/docs/guides/read-file/{mime.md → mime.mdx} +3 -1
- package/docs/guides/read-file/{stream.md → stream.mdx} +3 -1
- package/docs/guides/read-file/{string.md → string.mdx} +3 -1
- package/docs/guides/read-file/{uint8array.md → uint8array.mdx} +3 -1
- package/docs/guides/read-file/{watch.md → watch.mdx} +6 -8
- package/docs/guides/runtime/{build-time-constants.md → build-time-constants.mdx} +24 -22
- package/docs/guides/{install/cicd.md → runtime/cicd.mdx} +11 -7
- package/docs/guides/runtime/{codesign-macos-executable.md → codesign-macos-executable.mdx} +14 -9
- package/docs/guides/runtime/{define-constant.md → define-constant.mdx} +20 -16
- package/docs/guides/runtime/{delete-directory.md → delete-directory.mdx} +5 -3
- package/docs/guides/runtime/{delete-file.md → delete-file.mdx} +4 -2
- package/docs/guides/runtime/{heap-snapshot.md → heap-snapshot.mdx} +5 -3
- package/docs/guides/runtime/{import-html.md → import-html.mdx} +4 -2
- package/docs/guides/runtime/{import-json.md → import-json.mdx} +6 -4
- package/docs/guides/runtime/{import-toml.md → import-toml.mdx} +5 -3
- package/docs/guides/runtime/{import-yaml.md → import-yaml.mdx} +9 -7
- package/docs/guides/runtime/{read-env.md → read-env.mdx} +10 -5
- package/docs/guides/runtime/{set-env.md → set-env.mdx} +14 -10
- package/docs/guides/runtime/{shell.md → shell.mdx} +6 -4
- package/docs/guides/runtime/{timezone.md → timezone.mdx} +10 -7
- package/docs/guides/runtime/{tsconfig-paths.md → tsconfig-paths.mdx} +5 -3
- package/docs/guides/runtime/{typescript.md → typescript.mdx} +8 -6
- package/docs/guides/runtime/{vscode-debugger.md → vscode-debugger.mdx} +12 -11
- package/docs/guides/runtime/{web-debugger.md → web-debugger.mdx} +39 -18
- package/docs/guides/streams/{node-readable-to-arraybuffer.md → node-readable-to-arraybuffer.mdx} +3 -1
- package/docs/guides/streams/{node-readable-to-blob.md → node-readable-to-blob.mdx} +3 -1
- package/docs/guides/streams/{node-readable-to-json.md → node-readable-to-json.mdx} +3 -1
- package/docs/guides/streams/{node-readable-to-string.md → node-readable-to-string.mdx} +3 -1
- package/docs/guides/streams/{node-readable-to-uint8array.md → node-readable-to-uint8array.mdx} +3 -1
- package/docs/guides/streams/{to-array.md → to-array.mdx} +3 -1
- package/docs/guides/streams/{to-arraybuffer.md → to-arraybuffer.mdx} +3 -1
- package/docs/guides/streams/{to-blob.md → to-blob.mdx} +3 -1
- package/docs/guides/streams/{to-buffer.md → to-buffer.mdx} +3 -1
- package/docs/guides/streams/{to-json.md → to-json.mdx} +4 -2
- package/docs/guides/streams/{to-string.md → to-string.mdx} +3 -1
- package/docs/guides/streams/{to-typedarray.md → to-typedarray.mdx} +3 -1
- package/docs/guides/test/{bail.md → bail.mdx} +7 -5
- package/docs/guides/test/{coverage-threshold.md → coverage-threshold.mdx} +14 -7
- package/docs/guides/test/{coverage.md → coverage.mdx} +9 -4
- package/docs/guides/test/{happy-dom.md → happy-dom.mdx} +13 -8
- package/docs/guides/test/{migrate-from-jest.md → migrate-from-jest.mdx} +19 -37
- package/docs/guides/test/{mock-clock.md → mock-clock.mdx} +3 -1
- package/docs/guides/test/{mock-functions.md → mock-functions.mdx} +7 -5
- package/docs/guides/test/{rerun-each.md → rerun-each.mdx} +5 -3
- package/docs/guides/test/{run-tests.md → run-tests.mdx} +16 -11
- package/docs/guides/test/{skip-tests.md → skip-tests.mdx} +8 -4
- package/docs/guides/test/{snapshot.md → snapshot.mdx} +20 -13
- package/docs/guides/test/spy-on.mdx +49 -0
- package/docs/guides/test/{svelte-test.md → svelte-test.mdx} +16 -23
- package/docs/guides/test/{testing-library.md → testing-library.mdx} +18 -17
- package/docs/guides/test/{timeout.md → timeout.mdx} +5 -3
- package/docs/guides/test/{todo-tests.md → todo-tests.mdx} +13 -6
- package/docs/guides/test/{update-snapshots.md → update-snapshots.mdx} +9 -6
- package/docs/guides/test/{watch-mode.md → watch-mode.mdx} +9 -4
- package/docs/guides/util/{base64.md → base64.mdx} +3 -1
- package/docs/guides/util/{deep-equals.md → deep-equals.mdx} +5 -3
- package/docs/guides/util/{deflate.md → deflate.mdx} +3 -1
- package/docs/guides/util/{detect-bun.md → detect-bun.mdx} +3 -1
- package/docs/guides/util/{entrypoint.md → entrypoint.mdx} +4 -2
- package/docs/guides/util/{escape-html.md → escape-html.mdx} +3 -1
- package/docs/guides/util/{file-url-to-path.md → file-url-to-path.mdx} +3 -1
- package/docs/guides/util/{gzip.md → gzip.mdx} +3 -1
- package/docs/guides/util/{hash-a-password.md → hash-a-password.mdx} +3 -1
- package/docs/guides/util/{import-meta-dir.md → import-meta-dir.mdx} +4 -2
- package/docs/guides/util/{import-meta-file.md → import-meta-file.mdx} +4 -2
- package/docs/guides/util/{import-meta-path.md → import-meta-path.mdx} +4 -2
- package/docs/guides/util/{javascript-uuid.md → javascript-uuid.mdx} +3 -1
- package/docs/guides/util/{main.md → main.mdx} +19 -8
- package/docs/guides/util/{path-to-file-url.md → path-to-file-url.mdx} +3 -1
- package/docs/guides/util/{sleep.md → sleep.mdx} +3 -1
- package/docs/guides/util/{version.md → version.mdx} +6 -4
- package/docs/guides/util/{which-path-to-executable-bin.md → which-path-to-executable-bin.mdx} +4 -2
- package/docs/guides/websocket/{compression.md → compression.mdx} +5 -3
- package/docs/guides/websocket/{context.md → context.mdx} +9 -12
- package/docs/guides/websocket/{pubsub.md → pubsub.mdx} +5 -6
- package/docs/guides/websocket/{simple.md → simple.mdx} +5 -3
- package/docs/guides/write-file/{append.md → append.mdx} +3 -1
- package/docs/guides/write-file/{basic.md → basic.mdx} +3 -1
- package/docs/guides/write-file/{blob.md → blob.mdx} +3 -1
- package/docs/guides/write-file/{cat.md → cat.mdx} +4 -2
- package/docs/guides/write-file/{file-cp.md → file-cp.mdx} +3 -1
- package/docs/guides/write-file/{filesink.md → filesink.mdx} +3 -1
- package/docs/guides/write-file/{response.md → response.mdx} +3 -1
- package/docs/guides/write-file/{stdout.md → stdout.mdx} +3 -1
- package/docs/guides/write-file/{stream.md → stream.mdx} +3 -1
- package/docs/guides/write-file/{unlink.md → unlink.mdx} +3 -1
- package/docs/{index.md → index.mdx} +97 -41
- package/docs/installation.mdx +365 -0
- package/docs/{cli/bunx.md → pm/bunx.mdx} +25 -31
- package/docs/{install/catalogs.md → pm/catalogs.mdx} +18 -24
- package/docs/{cli/add.md → pm/cli/add.mdx} +61 -55
- package/docs/{install/audit.md → pm/cli/audit.mdx} +11 -8
- package/docs/{cli/install.md → pm/cli/install.mdx} +208 -81
- package/docs/{cli/link.md → pm/cli/link.mdx} +27 -19
- package/docs/{cli/outdated.md → pm/cli/outdated.mdx} +119 -12
- package/docs/{install/patch.md → pm/cli/patch.mdx} +25 -15
- package/docs/{cli/pm.md → pm/cli/pm.mdx} +96 -62
- package/docs/{cli/publish.md → pm/cli/publish.mdx} +38 -35
- package/docs/pm/cli/remove.mdx +16 -0
- package/docs/{cli/update.md → pm/cli/update.mdx} +26 -15
- package/docs/{cli/why.md → pm/cli/why.mdx} +27 -10
- package/docs/{cli/filter.md → pm/filter.mdx} +26 -14
- package/docs/{install/cache.md → pm/global-cache.mdx} +25 -12
- package/docs/{install/isolated.md → pm/isolated-installs.mdx} +32 -24
- package/docs/{install/lifecycle.md → pm/lifecycle.mdx} +20 -9
- package/docs/{install/lockfile.md → pm/lockfile.mdx} +18 -12
- package/docs/{install/npmrc.md → pm/npmrc.mdx} +30 -24
- package/docs/{install/overrides.md → pm/overrides.mdx} +47 -37
- package/docs/{install/registries.md → pm/scopes-registries.mdx} +8 -3
- package/docs/{install/security-scanner-api.md → pm/security-scanner-api.mdx} +22 -8
- package/docs/{install/workspaces.md → pm/workspaces.mdx} +17 -22
- package/docs/project/{benchmarking.md → benchmarking.mdx} +26 -11
- package/docs/project/{bindgen.md → bindgen.mdx} +12 -14
- package/docs/project/{building-windows.md → building-windows.mdx} +18 -47
- package/docs/project/{contributing.md → contributing.mdx} +56 -60
- package/docs/project/feedback.mdx +20 -0
- package/docs/project/license.mdx +78 -0
- package/docs/project/roadmap.mdx +8 -0
- package/docs/quickstart.mdx +240 -0
- package/docs/runtime/{autoimport.md → auto-install.mdx} +34 -31
- package/docs/{api/binary-data.md → runtime/binary-data.mdx} +77 -269
- package/docs/runtime/bun-apis.mdx +59 -0
- package/docs/runtime/{bunfig.md → bunfig.mdx} +95 -225
- package/docs/{api/cc.md → runtime/c-compiler.mdx} +16 -9
- package/docs/{api/spawn.md → runtime/child-process.mdx} +69 -119
- package/docs/{api/color.md → runtime/color.mdx} +6 -1
- package/docs/{api/console.md → runtime/console.mdx} +17 -7
- package/docs/{api/cookie.md → runtime/cookies.mdx} +24 -19
- package/docs/runtime/{debugger.md → debugger.mdx} +61 -51
- package/docs/runtime/environment-variables.mdx +214 -0
- package/docs/{api/ffi.md → runtime/ffi.mdx} +53 -45
- package/docs/{api/file-io.md → runtime/file-io.mdx} +41 -101
- package/docs/{api/file-system-router.md → runtime/file-system-router.mdx} +8 -2
- package/docs/{bundler/loaders.md → runtime/file-types.mdx} +56 -112
- package/docs/{api/glob.md → runtime/glob.mdx} +4 -1
- package/docs/runtime/globals.mdx +72 -0
- package/docs/{api/hashing.md → runtime/hashing.mdx} +18 -22
- package/docs/{api/html-rewriter.md → runtime/html-rewriter.mdx} +36 -30
- package/docs/runtime/http/cookies.mdx +79 -0
- package/docs/runtime/http/error-handling.mdx +40 -0
- package/docs/runtime/http/metrics.mdx +36 -0
- package/docs/runtime/http/routing.mdx +289 -0
- package/docs/runtime/http/server.mdx +647 -0
- package/docs/runtime/http/tls.mdx +101 -0
- package/docs/{api/websockets.md → runtime/http/websockets.mdx} +62 -231
- package/docs/{cli/run.md → runtime/index.mdx} +70 -108
- package/docs/runtime/jsx.mdx +115 -0
- package/docs/runtime/{modules.md → module-resolution.mdx} +83 -61
- package/docs/{api/dns.md → runtime/networking/dns.mdx} +23 -22
- package/docs/{api/fetch.md → runtime/networking/fetch.mdx} +10 -5
- package/docs/{api/tcp.md → runtime/networking/tcp.mdx} +59 -41
- package/docs/{api/udp.md → runtime/networking/udp.mdx} +14 -8
- package/docs/{api/node-api.md → runtime/node-api.mdx} +5 -0
- package/docs/runtime/{nodejs-apis.md → nodejs-compat.mdx} +9 -4
- package/docs/{bundler/plugins.md → runtime/plugins.mdx} +17 -61
- package/docs/{api/redis.md → runtime/redis.mdx} +65 -80
- package/docs/{api/s3.md → runtime/s3.mdx} +79 -66
- package/docs/{api/secrets.md → runtime/secrets.mdx} +27 -10
- package/docs/{api/semver.md → runtime/semver.mdx} +9 -4
- package/docs/runtime/{shell.md → shell.mdx} +52 -20
- package/docs/{api/sql.md → runtime/sql.mdx} +129 -99
- package/docs/{api/sqlite.md → runtime/sqlite.mdx} +162 -157
- package/docs/{api/streams.md → runtime/streams.mdx} +33 -31
- package/docs/{cli/bun-create.md → runtime/templating/create.mdx} +74 -143
- package/docs/{cli/init.md → runtime/templating/init.mdx} +24 -51
- package/docs/{api/transpiler.md → runtime/transpiler.mdx} +50 -38
- package/docs/{typescript.md → runtime/typescript.mdx} +7 -2
- package/docs/{api/utils.md → runtime/utils.mdx} +81 -50
- package/docs/runtime/{hot.md → watch-mode.mdx} +53 -37
- package/docs/runtime/web-apis.mdx +29 -0
- package/docs/{api/workers.md → runtime/workers.mdx} +28 -22
- package/docs/{api/yaml.md → runtime/yaml.mdx} +33 -232
- package/docs/snippets/cli/add.mdx +166 -0
- package/docs/snippets/cli/build.mdx +196 -0
- package/docs/snippets/cli/feedback.mdx +17 -0
- package/docs/snippets/cli/init.mdx +84 -0
- package/docs/snippets/cli/install.mdx +173 -0
- package/docs/snippets/cli/link.mdx +163 -0
- package/docs/snippets/cli/outdated.mdx +140 -0
- package/docs/snippets/cli/patch.mdx +171 -0
- package/docs/snippets/cli/publish.mdx +198 -0
- package/docs/snippets/cli/remove.mdx +146 -0
- package/docs/snippets/cli/run.mdx +293 -0
- package/docs/snippets/cli/test.mdx +100 -0
- package/docs/snippets/cli/update.mdx +144 -0
- package/docs/snippets/product-card.mdx +32 -0
- package/docs/snippets/product-tiles.mdx +94 -0
- package/docs/test/code-coverage.mdx +409 -0
- package/docs/test/configuration.mdx +467 -0
- package/docs/test/{time.md → dates-times.mdx} +23 -20
- package/docs/test/{discovery.md → discovery.mdx} +15 -10
- package/docs/test/dom.mdx +226 -0
- package/docs/{cli/test.md → test/index.mdx} +77 -94
- package/docs/test/lifecycle.mdx +348 -0
- package/docs/test/mocks.mdx +637 -0
- package/docs/test/{reporters.md → reporters.mdx} +15 -15
- package/docs/test/runtime-behavior.mdx +342 -0
- package/docs/test/snapshots.mdx +434 -0
- package/docs/test/writing-tests.mdx +635 -0
- package/docs/typescript.mdx +54 -0
- package/package.json +8 -6
- package/test.d.ts +2 -2
- package/docs/api/file.md +0 -19
- package/docs/api/globals.md +0 -387
- package/docs/api/http.md +0 -1408
- package/docs/api/import-meta.md +0 -69
- package/docs/benchmarks.md +0 -120
- package/docs/bun-flavored-toml.md +0 -42
- package/docs/bundler/css_modules.md +0 -145
- package/docs/bundler/fullstack.md +0 -418
- package/docs/bundler/index.md +0 -1735
- package/docs/bundler/intro.md +0 -75
- package/docs/bundler/vs-esbuild.md +0 -1127
- package/docs/cli/bun-completions.md +0 -3
- package/docs/cli/bun-install.md +0 -349
- package/docs/cli/bun-upgrade.md +0 -39
- package/docs/cli/info.md +0 -65
- package/docs/cli/patch-commit.md +0 -11
- package/docs/cli/remove.md +0 -7
- package/docs/cli/unlink.md +0 -9
- package/docs/contributing/upgrading-webkit.md +0 -57
- package/docs/ecosystem/elysia.md +0 -24
- package/docs/ecosystem/express.md +0 -37
- package/docs/ecosystem/hono.md +0 -18
- package/docs/ecosystem/react.md +0 -65
- package/docs/ecosystem/stric.md +0 -38
- package/docs/guides/ecosystem/prisma.md +0 -141
- package/docs/guides/ecosystem/render.md +0 -79
- package/docs/guides/install/add-git.md +0 -36
- package/docs/guides/test/spy-on.md +0 -46
- package/docs/install/index.md +0 -248
- package/docs/installation.md +0 -327
- package/docs/project/asan.md +0 -124
- package/docs/project/internals/build-process-for-ci.md +0 -75
- package/docs/project/licensing.md +0 -73
- package/docs/project/roadmap.md +0 -87
- package/docs/quickstart.md +0 -157
- package/docs/runtime/bun-apis.md +0 -207
- package/docs/runtime/env.md +0 -253
- package/docs/runtime/index.md +0 -312
- package/docs/runtime/jsx.md +0 -385
- package/docs/runtime/loaders.md +0 -130
- package/docs/runtime/plugins.md +0 -561
- package/docs/runtime/typescript.md +0 -139
- package/docs/runtime/web-apis.md +0 -128
- package/docs/test/configuration.md +0 -154
- package/docs/test/coverage.md +0 -142
- package/docs/test/dom.md +0 -75
- package/docs/test/examples/concurrent-test-glob.md +0 -132
- package/docs/test/hot.md +0 -15
- package/docs/test/lifecycle.md +0 -81
- package/docs/test/mocks.md +0 -313
- package/docs/test/runtime-behavior.md +0 -95
- package/docs/test/snapshots.md +0 -68
- package/docs/test/writing.md +0 -825
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Use Prisma with Bun
|
|
3
|
+
sidebarTitle: Prisma ORM with Bun
|
|
4
|
+
mode: center
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<Note>
|
|
8
|
+
**Note** — Prisma's dynamic subcommand loading system currently requires npm to be installed alongside Bun. This
|
|
9
|
+
affects certain CLI commands like `prisma init`, `prisma migrate`, etc. Generated code works perfectly with Bun using
|
|
10
|
+
the new `prisma-client` generator.
|
|
11
|
+
</Note>
|
|
12
|
+
|
|
13
|
+
<Steps>
|
|
14
|
+
<Step title="Create a new project">
|
|
15
|
+
Prisma works out of the box with Bun. First, create a directory and initialize it with `bun init`.
|
|
16
|
+
|
|
17
|
+
```bash terminal icon="terminal"
|
|
18
|
+
mkdir prisma-app
|
|
19
|
+
cd prisma-app
|
|
20
|
+
bun init
|
|
21
|
+
```
|
|
22
|
+
</Step>
|
|
23
|
+
|
|
24
|
+
<Step title="Install Prisma dependencies">
|
|
25
|
+
Then install the Prisma CLI (`prisma`), Prisma Client (`@prisma/client`), and the LibSQL adapter as dependencies.
|
|
26
|
+
|
|
27
|
+
```bash terminal icon="terminal"
|
|
28
|
+
bun add -d prisma
|
|
29
|
+
bun add @prisma/client @prisma/adapter-libsql
|
|
30
|
+
```
|
|
31
|
+
</Step>
|
|
32
|
+
|
|
33
|
+
<Step title="Initialize Prisma with SQLite">
|
|
34
|
+
We'll use the Prisma CLI with `bunx` to initialize our schema and migration directory. For simplicity we'll be using an in-memory SQLite database.
|
|
35
|
+
|
|
36
|
+
```bash terminal icon="terminal"
|
|
37
|
+
bunx --bun prisma init --datasource-provider sqlite
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
This creates a basic schema. We need to update it to use the new Rust-free client with Bun optimization. Open `prisma/schema.prisma` and modify the generator block, then add a simple `User` model.
|
|
41
|
+
|
|
42
|
+
```prisma prisma/schema.prisma icon="/icons/ecosystem/prisma.svg"
|
|
43
|
+
generator client {
|
|
44
|
+
provider = "prisma-client" // [!code ++]
|
|
45
|
+
output = "./generated" // [!code ++]
|
|
46
|
+
engineType = "client" // [!code ++]
|
|
47
|
+
runtime = "bun" // [!code ++]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
datasource db {
|
|
51
|
+
provider = "sqlite"
|
|
52
|
+
url = env("DATABASE_URL")
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
model User { // [!code ++]
|
|
56
|
+
id Int @id @default(autoincrement()) // [!code ++]
|
|
57
|
+
email String @unique // [!code ++]
|
|
58
|
+
name String? // [!code ++]
|
|
59
|
+
} // [!code ++]
|
|
60
|
+
```
|
|
61
|
+
</Step>
|
|
62
|
+
|
|
63
|
+
<Step title="Create and run database migration">
|
|
64
|
+
Then generate and run initial migration.
|
|
65
|
+
|
|
66
|
+
This will generate a `.sql` migration file in `prisma/migrations`, create a new SQLite instance, and execute the migration against the new instance.
|
|
67
|
+
|
|
68
|
+
```bash terminal icon="terminal"
|
|
69
|
+
bunx --bun prisma migrate dev --name init
|
|
70
|
+
```
|
|
71
|
+
```txt
|
|
72
|
+
Environment variables loaded from .env
|
|
73
|
+
Prisma schema loaded from prisma/schema.prisma
|
|
74
|
+
Datasource "db": SQLite database "dev.db" at "file:./dev.db"
|
|
75
|
+
|
|
76
|
+
SQLite database dev.db created at file:./dev.db
|
|
77
|
+
|
|
78
|
+
Applying migration `20251014141233_init`
|
|
79
|
+
|
|
80
|
+
The following migration(s) have been created and applied from new schema changes:
|
|
81
|
+
|
|
82
|
+
prisma/migrations/
|
|
83
|
+
└─ 20251014141233_init/
|
|
84
|
+
└─ migration.sql
|
|
85
|
+
|
|
86
|
+
Your database is now in sync with your schema.
|
|
87
|
+
|
|
88
|
+
✔ Generated Prisma Client (6.17.1) to ./generated in 18ms
|
|
89
|
+
```
|
|
90
|
+
</Step>
|
|
91
|
+
|
|
92
|
+
<Step title="Generate Prisma Client">
|
|
93
|
+
As indicated in the output, Prisma re-generates our _Prisma client_ whenever we execute a new migration. The client provides a fully typed API for reading and writing from our database. You can manually re-generate the client with the Prisma CLI.
|
|
94
|
+
|
|
95
|
+
```sh terminal icon="terminal"
|
|
96
|
+
bunx --bun prisma generate
|
|
97
|
+
```
|
|
98
|
+
</Step>
|
|
99
|
+
|
|
100
|
+
<Step title="Initialize Prisma Client with LibSQL">
|
|
101
|
+
Now we need to create a Prisma client instance. Create a new file `prisma/db.ts` to initialize the PrismaClient with the LibSQL adapter.
|
|
102
|
+
|
|
103
|
+
```ts prisma/db.ts icon="/icons/typescript.svg"
|
|
104
|
+
import { PrismaClient } from "./generated/client";
|
|
105
|
+
import { PrismaLibSQL } from "@prisma/adapter-libsql";
|
|
106
|
+
|
|
107
|
+
const adapter = new PrismaLibSQL({ url: process.env.DATABASE_URL || "" });
|
|
108
|
+
export const prisma = new PrismaClient({ adapter });
|
|
109
|
+
```
|
|
110
|
+
</Step>
|
|
111
|
+
|
|
112
|
+
<Step title="Create a test script">
|
|
113
|
+
Let's write a simple script to create a new user, then count the number of users in the database.
|
|
114
|
+
|
|
115
|
+
```ts index.ts icon="/icons/typescript.svg"
|
|
116
|
+
import { prisma } from "./prisma/db";
|
|
117
|
+
|
|
118
|
+
// create a new user
|
|
119
|
+
await prisma.user.create({
|
|
120
|
+
data: {
|
|
121
|
+
name: "John Dough",
|
|
122
|
+
email: `john-${Math.random()}@example.com`,
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// count the number of users
|
|
127
|
+
const count = await prisma.user.count();
|
|
128
|
+
console.log(`There are ${count} users in the database.`);
|
|
129
|
+
```
|
|
130
|
+
</Step>
|
|
131
|
+
|
|
132
|
+
<Step title="Run and test the application">
|
|
133
|
+
Let's run this script with `bun run`. Each time we run it, a new user is created.
|
|
134
|
+
|
|
135
|
+
```bash terminal icon="terminal"
|
|
136
|
+
bun run index.ts
|
|
137
|
+
```
|
|
138
|
+
```txg
|
|
139
|
+
Created john-0.12802932895402364@example.com
|
|
140
|
+
There are 1 users in the database.
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```bash terminal icon="terminal"
|
|
144
|
+
bun run index.ts
|
|
145
|
+
```
|
|
146
|
+
```txt
|
|
147
|
+
Created john-0.8671308799782803@example.com
|
|
148
|
+
There are 2 users in the database.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```bash terminal icon="terminal"
|
|
152
|
+
bun run index.ts
|
|
153
|
+
```
|
|
154
|
+
```txt
|
|
155
|
+
Created john-0.4465968383115295@example.com
|
|
156
|
+
There are 3 users in the database.
|
|
157
|
+
```
|
|
158
|
+
</Step>
|
|
159
|
+
|
|
160
|
+
</Steps>
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
That's it! Now that you've set up Prisma using Bun, we recommend referring to the [official Prisma docs](https://www.prisma.io/docs/concepts/components/prisma-client) as you continue to develop your application.
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Build an app with Qwik and Bun
|
|
3
|
+
sidebarTitle: Qwik with Bun
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
7
|
Initialize a new Qwik app with `bunx create-qwik`.
|
|
6
8
|
|
|
7
9
|
The `create-qwik` package detects when you are using `bunx` and will automatically install dependencies using `bun`.
|
|
8
10
|
|
|
9
|
-
```sh
|
|
10
|
-
|
|
11
|
+
```sh terminal icon="terminal"
|
|
12
|
+
bun create qwik
|
|
13
|
+
```
|
|
11
14
|
|
|
15
|
+
```txts
|
|
12
16
|
............
|
|
13
17
|
.::: :--------:.
|
|
14
18
|
.:::: .:-------:.
|
|
@@ -85,22 +89,25 @@ $ bun create qwik
|
|
|
85
89
|
|
|
86
90
|
Run `bun run dev` to start the development server.
|
|
87
91
|
|
|
88
|
-
```sh
|
|
89
|
-
|
|
90
|
-
|
|
92
|
+
```sh terminal icon="terminal"
|
|
93
|
+
bun run dev
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```txt
|
|
97
|
+
$ vite--mode ssr
|
|
91
98
|
|
|
92
|
-
|
|
99
|
+
VITE v4.4.7 ready in 1190 ms
|
|
93
100
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
➜ Local: http://localhost:5173/
|
|
102
|
+
➜ Network: use --host to expose
|
|
103
|
+
➜ press h to show help
|
|
97
104
|
```
|
|
98
105
|
|
|
99
106
|
---
|
|
100
107
|
|
|
101
108
|
Open [http://localhost:5173](http://localhost:5173) with your browser to see the result. Qwik will hot-reload your app as you edit your source files.
|
|
102
109
|
|
|
103
|
-
|
|
110
|
+
<Frame></Frame>
|
|
104
111
|
|
|
105
112
|
---
|
|
106
113
|
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Build a React app with Bun
|
|
3
|
+
sidebarTitle: React with Bun
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
7
|
Bun supports `.jsx` and `.tsx` files out of the box. React just works with Bun.
|
|
6
8
|
|
|
7
9
|
Create a new React app with `bun init --react`. This gives you a template with a simple React app and a simple API server together in one full-stack app.
|
|
8
10
|
|
|
9
|
-
```bash
|
|
11
|
+
```bash terminal icon="terminal"
|
|
10
12
|
# Create a new React app
|
|
11
|
-
|
|
13
|
+
bun init --react
|
|
12
14
|
|
|
13
15
|
# Run the app in development mode
|
|
14
|
-
|
|
16
|
+
bun dev
|
|
15
17
|
|
|
16
18
|
# Build as a static site for production
|
|
17
|
-
|
|
19
|
+
bun run build
|
|
18
20
|
|
|
19
21
|
# Run the server in production
|
|
20
|
-
|
|
22
|
+
bun start
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
---
|
|
@@ -34,7 +36,7 @@ Run `bun start` to start the API server and frontend together in one process.
|
|
|
34
36
|
|
|
35
37
|
Run `bun run build` to build the app as a static site. This will create a `dist` directory with the built app and all the assets.
|
|
36
38
|
|
|
37
|
-
```
|
|
39
|
+
```txt File Tree icon="folder-tree"
|
|
38
40
|
├── src/
|
|
39
41
|
│ ├── index.tsx # Server entry point with API routes
|
|
40
42
|
│ ├── frontend.tsx # React app entry point with HMR
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Build an app with Remix and Bun
|
|
3
|
+
sidebarTitle: Remix with Bun
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
Currently the Remix development server (`remix dev`) relies on Node.js APIs that Bun does not yet implement. The guide
|
|
7
|
-
|
|
7
|
+
<Note>
|
|
8
|
+
Currently the Remix development server (`remix dev`) relies on Node.js APIs that Bun does not yet implement. The guide
|
|
9
|
+
below uses Bun to initialize a project and install dependencies, but it uses Node.js to run the dev server.
|
|
10
|
+
</Note>
|
|
8
11
|
|
|
9
12
|
---
|
|
10
13
|
|
|
11
14
|
Initialize a Remix app with `create-remix`.
|
|
12
15
|
|
|
13
|
-
```sh
|
|
14
|
-
|
|
16
|
+
```sh terminal icon="terminal"
|
|
17
|
+
bun create remix
|
|
18
|
+
```
|
|
15
19
|
|
|
20
|
+
```txt
|
|
16
21
|
remix v1.19.3 💿 Let's build a better website...
|
|
17
22
|
|
|
18
23
|
dir Where should we create your new project?
|
|
@@ -28,11 +33,9 @@ $ bun create remix
|
|
|
28
33
|
Yes
|
|
29
34
|
|
|
30
35
|
✔ Dependencies installed
|
|
31
|
-
|
|
32
36
|
✔ Git initialized
|
|
33
37
|
|
|
34
38
|
done That's it!
|
|
35
|
-
|
|
36
39
|
Enter your project directory using cd ./my-app
|
|
37
40
|
Check out README.md for development and deploy instructions.
|
|
38
41
|
```
|
|
@@ -41,36 +44,52 @@ $ bun create remix
|
|
|
41
44
|
|
|
42
45
|
To start the dev server, run `bun run dev` from the project root. This will start the dev server using the `remix dev` command. Note that Node.js will be used to run the dev server.
|
|
43
46
|
|
|
44
|
-
```sh
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
```sh terminal icon="terminal"
|
|
48
|
+
cd my-app
|
|
49
|
+
bun run dev
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```txt
|
|
53
|
+
$ remix dev
|
|
48
54
|
|
|
49
|
-
|
|
55
|
+
💿 remix dev
|
|
50
56
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
info building...
|
|
58
|
+
info built (263ms)
|
|
59
|
+
Remix App Server started at http://localhost:3000 (http://172.20.0.143:3000)
|
|
54
60
|
```
|
|
55
61
|
|
|
56
62
|
---
|
|
57
63
|
|
|
58
64
|
Open [http://localhost:3000](http://localhost:3000) to see the app. Any changes you make to `app/routes/_index.tsx` will be hot-reloaded in the browser.
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
<Frame>
|
|
67
|
+

|
|
68
|
+
</Frame>
|
|
61
69
|
|
|
62
70
|
---
|
|
63
71
|
|
|
64
|
-
To build and start your app, run `bun run build`
|
|
72
|
+
To build and start your app, run `bun run build`
|
|
73
|
+
|
|
74
|
+
```sh terminal icon="terminal"
|
|
75
|
+
bun run build
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```txt
|
|
79
|
+
$ remix build
|
|
80
|
+
info building... (NODE_ENV=production)
|
|
81
|
+
info built (158ms)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Then `bun run start` from the project root.
|
|
85
|
+
|
|
86
|
+
```sh terminal icon="terminal"
|
|
87
|
+
bun start
|
|
88
|
+
```
|
|
65
89
|
|
|
66
|
-
```
|
|
67
|
-
$
|
|
68
|
-
|
|
69
|
-
info building... (NODE_ENV=production)
|
|
70
|
-
info built (158ms)
|
|
71
|
-
$ bun start
|
|
72
|
-
$ remix-serve ./build/index.js
|
|
73
|
-
[remix-serve] http://localhost:3000 (http://192.168.86.237:3000)
|
|
90
|
+
```txt
|
|
91
|
+
$ remix-serve ./build/index.js
|
|
92
|
+
[remix-serve] http://localhost:3000 (http://192.168.86.237:3000)
|
|
74
93
|
```
|
|
75
94
|
|
|
76
95
|
---
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Add Sentry to a Bun app
|
|
3
|
+
sidebarTitle: Sentry with Bun
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
7
|
[Sentry](https://sentry.io) is a developer-first error tracking and performance monitoring platform. Sentry has a first-class SDK for Bun, `@sentry/bun`, that instruments your Bun application to automatically collect error and performance data.
|
|
@@ -10,15 +12,15 @@ Don't already have an account and Sentry project established? Head over to [sent
|
|
|
10
12
|
|
|
11
13
|
To start using Sentry with Bun, first install the Sentry Bun SDK.
|
|
12
14
|
|
|
13
|
-
```sh
|
|
14
|
-
|
|
15
|
+
```sh terminal icon="terminal"
|
|
16
|
+
bun add @sentry/bun
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
---
|
|
18
20
|
|
|
19
21
|
Then, initialize the Sentry SDK with your Sentry DSN in your app's entry file. You can find your DSN in your Sentry project settings.
|
|
20
22
|
|
|
21
|
-
```js
|
|
23
|
+
```js sentry.ts icon="/icons/typescript.svg"
|
|
22
24
|
import * as Sentry from "@sentry/bun";
|
|
23
25
|
|
|
24
26
|
// Ensure to call this before importing any other modules!
|
|
@@ -35,7 +37,7 @@ Sentry.init({
|
|
|
35
37
|
|
|
36
38
|
You can verify that Sentry is working by capturing a test error:
|
|
37
39
|
|
|
38
|
-
```js
|
|
40
|
+
```js sentry.ts icon="/icons/typescript.svg"
|
|
39
41
|
setTimeout(() => {
|
|
40
42
|
try {
|
|
41
43
|
foo();
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Build an app with SolidStart and Bun
|
|
3
|
+
sidebarTitle: "SolidStart with Bun"
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
SolidStart currently relies on Node.js APIs that Bun does not yet implement. The guide below uses Bun to initialize a
|
|
7
|
-
|
|
7
|
+
<Warning>
|
|
8
|
+
SolidStart currently relies on Node.js APIs that Bun does not yet implement. The guide below uses Bun to initialize a
|
|
9
|
+
project and install dependencies, but it uses Node.js to run the dev server.
|
|
10
|
+
</Warning>
|
|
8
11
|
|
|
9
12
|
---
|
|
10
13
|
|
|
11
14
|
Initialize a SolidStart app with `create-solid`.
|
|
12
15
|
|
|
13
|
-
```sh
|
|
14
|
-
|
|
16
|
+
```sh terminal icon="terminal"
|
|
17
|
+
bun create solid my-app
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```txt
|
|
15
21
|
create-solid version 0.2.31
|
|
16
22
|
|
|
17
23
|
Welcome to the SolidStart setup wizard!
|
|
@@ -32,26 +38,28 @@ cloned solidjs/solid-start#main to /path/to/my-app/.solid-start
|
|
|
32
38
|
|
|
33
39
|
As instructed by the `create-solid` CLI, let's install our dependencies.
|
|
34
40
|
|
|
35
|
-
```sh
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
```sh terminal icon="terminal"
|
|
42
|
+
cd my-app
|
|
43
|
+
bun install
|
|
38
44
|
```
|
|
39
45
|
|
|
40
46
|
---
|
|
41
47
|
|
|
42
48
|
Then run the development server.
|
|
43
49
|
|
|
44
|
-
```sh
|
|
45
|
-
|
|
50
|
+
```sh terminal icon="terminal"
|
|
51
|
+
bun run dev
|
|
46
52
|
# or, equivalently
|
|
47
|
-
|
|
53
|
+
bunx solid-start dev
|
|
48
54
|
```
|
|
49
55
|
|
|
50
56
|
---
|
|
51
57
|
|
|
52
58
|
Open [localhost:3000](http://localhost:3000). Any changes you make to `src/routes/index.tsx` will be hot-reloaded automatically.
|
|
53
59
|
|
|
54
|
-
|
|
60
|
+
<Frame>
|
|
61
|
+

|
|
62
|
+
</Frame>
|
|
55
63
|
|
|
56
64
|
---
|
|
57
65
|
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Server-side render (SSR) a React component
|
|
3
|
+
sidebarTitle: "SSR React with Bun"
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
7
|
To get started, install `react` & `react-dom`:
|
|
6
8
|
|
|
7
|
-
```sh
|
|
9
|
+
```sh terminal icon="terminal"
|
|
8
10
|
# Any package manager can be used
|
|
9
|
-
|
|
11
|
+
bun add react react-dom
|
|
10
12
|
```
|
|
11
13
|
|
|
12
14
|
---
|
|
13
15
|
|
|
14
16
|
To render a React component to an HTML stream server-side (SSR):
|
|
15
17
|
|
|
16
|
-
```tsx
|
|
18
|
+
```tsx ssr-react.tsx icon="file-code"
|
|
17
19
|
import { renderToReadableStream } from "react-dom/server";
|
|
18
20
|
|
|
19
21
|
function Component(props: { message: string }) {
|
|
@@ -24,21 +26,17 @@ function Component(props: { message: string }) {
|
|
|
24
26
|
);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
|
-
const stream = await renderToReadableStream(
|
|
28
|
-
<Component message="Hello from server!" />,
|
|
29
|
-
);
|
|
29
|
+
const stream = await renderToReadableStream(<Component message="Hello from server!" />);
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
34
34
|
Combining this with `Bun.serve()`, we get a simple SSR HTTP server:
|
|
35
35
|
|
|
36
|
-
```tsx
|
|
36
|
+
```tsx server.ts icon="/icons/typescript.svg"
|
|
37
37
|
Bun.serve({
|
|
38
38
|
async fetch() {
|
|
39
|
-
const stream = await renderToReadableStream(
|
|
40
|
-
<Component message="Hello from server!" />,
|
|
41
|
-
);
|
|
39
|
+
const stream = await renderToReadableStream(<Component message="Hello from server!" />);
|
|
42
40
|
return new Response(stream, {
|
|
43
41
|
headers: { "Content-Type": "text/html" },
|
|
44
42
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
title: Build an HTTP server using StricJS and Bun
|
|
3
|
+
sidebarTitle: "StricJS with Bun"
|
|
4
|
+
mode: center
|
|
3
5
|
---
|
|
4
6
|
|
|
5
7
|
[StricJS](https://github.com/bunsvr) is a Bun framework for building high-performance web applications and APIs.
|
|
@@ -12,42 +14,39 @@ name: Build an HTTP server using StricJS and Bun
|
|
|
12
14
|
|
|
13
15
|
Use `bun init` to create an empty project.
|
|
14
16
|
|
|
15
|
-
```bash
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
```bash terminal icon="terminal"
|
|
18
|
+
mkdir myapp
|
|
19
|
+
cd myapp
|
|
20
|
+
bun init
|
|
21
|
+
bun add @stricjs/router @stricjs/utils
|
|
20
22
|
```
|
|
21
23
|
|
|
22
24
|
---
|
|
23
25
|
|
|
24
26
|
To implement a simple HTTP server with StricJS:
|
|
25
27
|
|
|
26
|
-
```ts
|
|
27
|
-
import { Router } from
|
|
28
|
+
```ts index.ts icon="file-code"
|
|
29
|
+
import { Router } from "@stricjs/router";
|
|
28
30
|
|
|
29
|
-
export default new Router()
|
|
30
|
-
.get('/', () => new Response('Hi'));
|
|
31
|
+
export default new Router().get("/", () => new Response("Hi"));
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
---
|
|
34
35
|
|
|
35
36
|
To serve static files from `/public`:
|
|
36
37
|
|
|
37
|
-
```ts
|
|
38
|
-
import { dir } from
|
|
38
|
+
```ts index.ts icon="file-code"
|
|
39
|
+
import { dir } from "@stricjs/utils";
|
|
39
40
|
|
|
40
|
-
export default new Router()
|
|
41
|
-
.get('/', () => new Response('Hi'))
|
|
42
|
-
.get('/*', dir('./public'));
|
|
41
|
+
export default new Router().get("/", () => new Response("Hi")).get("/*", dir("./public"));
|
|
43
42
|
```
|
|
44
43
|
|
|
45
44
|
---
|
|
46
45
|
|
|
47
46
|
Run the file in watch mode to start the development server.
|
|
48
47
|
|
|
49
|
-
```bash
|
|
50
|
-
|
|
48
|
+
```bash terminal icon="terminal"
|
|
49
|
+
bun --watch run index.ts
|
|
51
50
|
```
|
|
52
51
|
|
|
53
52
|
---
|