diff --git a/docs/api/binary-data.md b/docs/api/binary-data.md index a6c752410b..46bd6be3bd 100644 --- a/docs/api/binary-data.md +++ b/docs/api/binary-data.md @@ -511,7 +511,7 @@ for await (const chunk of stream) { } ``` -For a more complete discussion of streams in Bun, see [API > Streams](/docs/api/streams). +For a more complete discussion of streams in Bun, see [API > Streams](https://bun.sh/docs/api/streams). ## Conversion diff --git a/docs/api/fetch.md b/docs/api/fetch.md index dd20e45ac6..afbf53c5c1 100644 --- a/docs/api/fetch.md +++ b/docs/api/fetch.md @@ -241,7 +241,7 @@ dns.prefetch("bun.sh", 443); By default, Bun caches and deduplicates DNS queries in-memory for up to 30 seconds. You can see the cache stats by calling `dns.getCacheStats()`: -To learn more about DNS caching in Bun, see the [DNS caching](/docs/api/dns) documentation. +To learn more about DNS caching in Bun, see the [DNS caching](https://bun.sh/docs/api/dns) documentation. ### Preconnect to a host diff --git a/docs/api/file-io.md b/docs/api/file-io.md index 206abfe475..f9fd2368f3 100644 --- a/docs/api/file-io.md +++ b/docs/api/file-io.md @@ -1,8 +1,8 @@ {% callout %} - + -**Note** — The `Bun.file` and `Bun.write` APIs documented on this page are heavily optimized and represent the recommended way to perform file-system tasks using Bun. For operations that are not yet available with `Bun.file`, such as `mkdir` or `readdir`, you can use Bun's [nearly complete](/docs/runtime/nodejs-apis#node-fs) implementation of the [`node:fs`](https://nodejs.org/api/fs.html) module. +**Note** — The `Bun.file` and `Bun.write` APIs documented on this page are heavily optimized and represent the recommended way to perform file-system tasks using Bun. For operations that are not yet available with `Bun.file`, such as `mkdir` or `readdir`, you can use Bun's [nearly complete](https://bun.sh/docs/runtime/nodejs-apis#node-fs) implementation of the [`node:fs`](https://nodejs.org/api/fs.html) module. {% /callout %} diff --git a/docs/api/globals.md b/docs/api/globals.md index fe7cd60c64..8e5a89651a 100644 --- a/docs/api/globals.md +++ b/docs/api/globals.md @@ -34,7 +34,7 @@ Bun implements the following globals. - [`Buffer`](https://nodejs.org/api/buffer.html#class-buffer) - Node.js -- See [Node.js > `Buffer`](/docs/runtime/nodejs-apis#node-buffer) +- See [Node.js > `Buffer`](https://bun.sh/docs/runtime/nodejs-apis#node-buffer) --- @@ -172,7 +172,7 @@ Bun implements the following globals. - [`global`](https://nodejs.org/api/globals.html#global) - Node.js -- See [Node.js > `global`](/docs/runtime/nodejs-apis#global). +- See [Node.js > `global`](https://bun.sh/docs/runtime/nodejs-apis#global). --- @@ -188,7 +188,7 @@ Bun implements the following globals. --- -- [`HTMLRewriter`](/docs/api/html-rewriter) +- [`HTMLRewriter`](https://bun.sh/docs/api/html-rewriter) - Cloudflare -   @@ -220,7 +220,7 @@ Bun implements the following globals. - [`process`](https://nodejs.org/api/process.html) - Node.js -- See [Node.js > `process`](/docs/runtime/nodejs-apis#node-process) +- See [Node.js > `process`](https://bun.sh/docs/runtime/nodejs-apis#node-process) --- diff --git a/docs/api/http.md b/docs/api/http.md index 45b7c6a7e1..7b5c7636d6 100644 --- a/docs/api/http.md +++ b/docs/api/http.md @@ -1,7 +1,7 @@ The page primarily documents the Bun-native `Bun.serve` API. Bun also implements [`fetch`](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) and the Node.js [`http`](https://nodejs.org/api/http.html) and [`https`](https://nodejs.org/api/https.html) modules. {% callout %} -These modules have been re-implemented to use Bun's fast internal HTTP infrastructure. Feel free to use these modules directly; frameworks like [Express](https://expressjs.com/) that depend on these modules should work out of the box. For granular compatibility information, see [Runtime > Node.js APIs](/docs/runtime/nodejs-apis). +These modules have been re-implemented to use Bun's fast internal HTTP infrastructure. Feel free to use these modules directly; frameworks like [Express](https://expressjs.com/) that depend on these modules should work out of the box. For granular compatibility information, see [Runtime > Node.js APIs](https://bun.sh/docs/runtime/nodejs-apis). {% /callout %} To start a high-performance HTTP server with a clean API, the recommended approach is [`Bun.serve`](#start-a-server-bun-serve). @@ -475,7 +475,7 @@ Instead of passing the server options into `Bun.serve`, `export default` it. Thi $ bun --hot server.ts ``` --> - + ## Streaming files diff --git a/docs/api/test.md b/docs/api/test.md index 6704d407d6..d9898ffc0f 100644 --- a/docs/api/test.md +++ b/docs/api/test.md @@ -1 +1 @@ -See the [`bun test`](/docs/cli/test) documentation. +See the [`bun test`](https://bun.sh/docs/cli/test) documentation. diff --git a/docs/api/utils.md b/docs/api/utils.md index fa28674f86..d4e46441e0 100644 --- a/docs/api/utils.md +++ b/docs/api/utils.md @@ -183,7 +183,7 @@ const currentFile = import.meta.url; Bun.openInEditor(currentFile); ``` -You can override this via the `debug.editor` setting in your [`bunfig.toml`](/docs/runtime/bunfig). +You can override this via the `debug.editor` setting in your [`bunfig.toml`](https://bun.sh/docs/runtime/bunfig). ```toml-diff#bunfig.toml + [debug] diff --git a/docs/bundler/index.md b/docs/bundler/index.md index de0becca01..a3b166e8b4 100644 --- a/docs/bundler/index.md +++ b/docs/bundler/index.md @@ -146,7 +146,7 @@ $ bun build ./index.tsx --outdir ./out --watch ## Content types -Like the Bun runtime, the bundler supports an array of file types out of the box. The following table breaks down the bundler's set of standard "loaders". Refer to [Bundler > File types](/docs/runtime/loaders) for full documentation. +Like the Bun runtime, the bundler supports an array of file types out of the box. The following table breaks down the bundler's set of standard "loaders". Refer to [Bundler > File types](https://bun.sh/docs/runtime/loaders) for full documentation. {% table %} @@ -219,11 +219,11 @@ console.log(logo); The exact behavior of the file loader is also impacted by [`naming`](#naming) and [`publicPath`](#publicpath). {% /callout %} -Refer to the [Bundler > Loaders](/docs/bundler/loaders#file) page for more complete documentation on the file loader. +Refer to the [Bundler > Loaders](https://bun.sh/docs/bundler/loaders#file) page for more complete documentation on the file loader. ### Plugins -The behavior described in this table can be overridden or extended with [plugins](/docs/bundler/plugins). Refer to the [Bundler > Loaders](/docs/bundler/plugins) page for complete documentation. +The behavior described in this table can be overridden or extended with [plugins](https://bun.sh/docs/bundler/plugins). Refer to the [Bundler > Loaders](https://bun.sh/docs/bundler/plugins) page for complete documentation. ## API @@ -490,7 +490,7 @@ n/a {% /codetabs %} -Bun implements a universal plugin system for both Bun's runtime and bundler. Refer to the [plugin documentation](/docs/bundler/plugins) for complete documentation. +Bun implements a universal plugin system for both Bun's runtime and bundler. Refer to the [plugin documentation](https://bun.sh/docs/bundler/plugins) for complete documentation. - SQLite -- [`bun:sqlite`](/docs/api/sqlite) +- [`bun:sqlite`](https://bun.sh/docs/api/sqlite) --- - FFI -- [`bun:ffi`](/docs/api/ffi) +- [`bun:ffi`](https://bun.sh/docs/api/ffi) --- - Testing -- [`bun:test`](/docs/cli/test) +- [`bun:test`](https://bun.sh/docs/cli/test) --- - Node-API -- [`Node-API`](/docs/api/node-api) +- [`Node-API`](https://bun.sh/docs/api/node-api) --- - Glob -- [`Bun.Glob`](/docs/api/glob) +- [`Bun.Glob`](https://bun.sh/docs/api/glob) --- - Utilities -- [`Bun.version`](/docs/api/utils#bun-version) - [`Bun.revision`](/docs/api/utils#bun-revision) - [`Bun.env`](/docs/api/utils#bun-env) - [`Bun.main`](/docs/api/utils#bun-main) - [`Bun.sleep()`](/docs/api/utils#bun-sleep) - [`Bun.sleepSync()`](/docs/api/utils#bun-sleepsync) - [`Bun.which()`](/docs/api/utils#bun-which) - [`Bun.peek()`](/docs/api/utils#bun-peek) - [`Bun.openInEditor()`](/docs/api/utils#bun-openineditor) - [`Bun.deepEquals()`](/docs/api/utils#bun-deepequals) - [`Bun.escapeHTML()`](/docs/api/utils#bun-escapehtml) - [`Bun.fileURLToPath()`](/docs/api/utils#bun-fileurltopath) - [`Bun.pathToFileURL()`](/docs/api/utils#bun-pathtofileurl) - [`Bun.gzipSync()`](/docs/api/utils#bun-gzipsync) - [`Bun.gunzipSync()`](/docs/api/utils#bun-gunzipsync) - [`Bun.deflateSync()`](/docs/api/utils#bun-deflatesync) - [`Bun.inflateSync()`](/docs/api/utils#bun-inflatesync) - [`Bun.inspect()`](/docs/api/utils#bun-inspect) - [`Bun.nanoseconds()`](/docs/api/utils#bun-nanoseconds) - [`Bun.readableStreamTo*()`](/docs/api/utils#bun-readablestreamto) - [`Bun.resolveSync()`](/docs/api/utils#bun-resolvesync) +- [`Bun.version`](https://bun.sh/docs/api/utils#bun-version) + [`Bun.revision`](https://bun.sh/docs/api/utils#bun-revision) + [`Bun.env`](https://bun.sh/docs/api/utils#bun-env) + [`Bun.main`](https://bun.sh/docs/api/utils#bun-main) + [`Bun.sleep()`](https://bun.sh/docs/api/utils#bun-sleep) + [`Bun.sleepSync()`](https://bun.sh/docs/api/utils#bun-sleepsync) + [`Bun.which()`](https://bun.sh/docs/api/utils#bun-which) + [`Bun.peek()`](https://bun.sh/docs/api/utils#bun-peek) + [`Bun.openInEditor()`](https://bun.sh/docs/api/utils#bun-openineditor) + [`Bun.deepEquals()`](https://bun.sh/docs/api/utils#bun-deepequals) + [`Bun.escapeHTML()`](https://bun.sh/docs/api/utils#bun-escapehtml) + [`Bun.fileURLToPath()`](https://bun.sh/docs/api/utils#bun-fileurltopath) + [`Bun.pathToFileURL()`](https://bun.sh/docs/api/utils#bun-pathtofileurl) + [`Bun.gzipSync()`](https://bun.sh/docs/api/utils#bun-gzipsync) + [`Bun.gunzipSync()`](https://bun.sh/docs/api/utils#bun-gunzipsync) + [`Bun.deflateSync()`](https://bun.sh/docs/api/utils#bun-deflatesync) + [`Bun.inflateSync()`](https://bun.sh/docs/api/utils#bun-inflatesync) + [`Bun.inspect()`](https://bun.sh/docs/api/utils#bun-inspect) + [`Bun.nanoseconds()`](https://bun.sh/docs/api/utils#bun-nanoseconds) + [`Bun.readableStreamTo*()`](https://bun.sh/docs/api/utils#bun-readablestreamto) + [`Bun.resolveSync()`](https://bun.sh/docs/api/utils#bun-resolvesync) {% /table %} diff --git a/docs/runtime/index.md b/docs/runtime/index.md index 4c557cab49..d2dfe8e441 100644 --- a/docs/runtime/index.md +++ b/docs/runtime/index.md @@ -6,7 +6,7 @@ Bun is designed to start fast and run fast. Its transpiler and runtime are writt {% image src="/images/bun-run-speed.jpeg" caption="Bun vs Node.js vs Deno running Hello World" /%} - + Performance sensitive APIs like `Buffer`, `fetch`, and `Response` are heavily profiled and optimized. Under the hood Bun uses the [JavaScriptCore engine](https://developer.apple.com/documentation/javascriptcore), which is developed by Apple for Safari. It starts and runs faster than V8, the engine used by Node.js and Chromium-based browsers. @@ -21,7 +21,7 @@ $ bun index.ts $ bun index.tsx ``` -Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](/docs/runtime/typescript) page for details. +Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.sh/docs/runtime/typescript) page for details. @@ -122,17 +122,17 @@ $ bun run ./my-wasm-app.whatever ## Node.js compatibility -Long-term, Bun aims for complete Node.js compatibility. Most Node.js packages already work with Bun out of the box, but certain low-level APIs like `dgram` are still unimplemented. Track the current compatibility status at [Ecosystem > Node.js](/docs/runtime/nodejs-apis). +Long-term, Bun aims for complete Node.js compatibility. Most Node.js packages already work with Bun out of the box, but certain low-level APIs like `dgram` are still unimplemented. Track the current compatibility status at [Ecosystem > Node.js](https://bun.sh/docs/runtime/nodejs-apis). Bun implements the Node.js module resolution algorithm, so dependencies can still be managed with `package.json`, `node_modules`, and CommonJS-style imports. {% callout %} -**Note** — We recommend using Bun's [built-in package manager](/docs/cli/install) for a performance boost over other npm clients. +**Note** — We recommend using Bun's [built-in package manager](https://bun.sh/docs/cli/install) for a performance boost over other npm clients. {% /callout %} ## Web APIs - + Some Web APIs aren't relevant in the context of a server-first runtime like Bun, such as the [DOM API](https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API#html_dom_api_interfaces) or [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API). Many others, though, are broadly useful outside of the browser context; when possible, Bun implements these Web-standard APIs instead of introducing new APIs. @@ -237,67 +237,67 @@ Bun exposes a set of Bun-specific APIs on the `Bun` global object and through a --- -- [HTTP](/docs/api/http) +- [HTTP](https://bun.sh/docs/api/http) - `Bun.serve` --- -- [File I/O](/docs/api/file-io) +- [File I/O](https://bun.sh/docs/api/file-io) - `Bun.file` `Bun.write` --- -- [Processes](/docs/api/spawn) +- [Processes](https://bun.sh/docs/api/spawn) - `Bun.spawn` `Bun.spawnSync` --- -- [TCP](/docs/api/tcp) +- [TCP](https://bun.sh/docs/api/tcp) - `Bun.listen` `Bun.connect` --- -- [Transpiler](/docs/api/transpiler) +- [Transpiler](https://bun.sh/docs/api/transpiler) - `Bun.Transpiler` --- -- [Routing](/docs/api/file-system-router) +- [Routing](https://bun.sh/docs/api/file-system-router) - `Bun.FileSystemRouter` --- -- [HTMLRewriter](/docs/api/html-rewriter) +- [HTMLRewriter](https://bun.sh/docs/api/html-rewriter) - `HTMLRewriter` --- -- [Utils](/docs/api/utils) +- [Utils](https://bun.sh/docs/api/utils) - `Bun.peek` `Bun.which` --- -- [SQLite](/docs/api/sqlite) +- [SQLite](https://bun.sh/docs/api/sqlite) - `bun:sqlite` --- -- [FFI](/docs/api/ffi) +- [FFI](https://bun.sh/docs/api/ffi) - `bun:ffi` --- -- [DNS](/docs/api/dns) +- [DNS](https://bun.sh/docs/api/dns) - `bun:dns` --- -- [Testing](/docs/api/test) +- [Testing](https://bun.sh/docs/api/test) - `bun:test` --- -- [Node-API](/docs/api/node-api) +- [Node-API](https://bun.sh/docs/api/node-api) - `Node-API` --- @@ -306,4 +306,4 @@ Bun exposes a set of Bun-specific APIs on the `Bun` global object and through a ## Plugins -Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](/docs/bundler/plugins) for full documentation. +Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.sh/docs/bundler/plugins) for full documentation. diff --git a/docs/runtime/jsx.md b/docs/runtime/jsx.md index 31a61652bb..ab08255599 100644 --- a/docs/runtime/jsx.md +++ b/docs/runtime/jsx.md @@ -14,7 +14,7 @@ console.log(); ## Configuration -Bun reads your `tsconfig.json` or `jsconfig.json` configuration files to determines how to perform the JSX transform internally. To avoid using either of these, the following options can also be defined in [`bunfig.toml`](/docs/runtime/bunfig). +Bun reads your `tsconfig.json` or `jsconfig.json` configuration files to determines how to perform the JSX transform internally. To avoid using either of these, the following options can also be defined in [`bunfig.toml`](https://bun.sh/docs/runtime/bunfig). The following compiler options are respected. @@ -197,7 +197,7 @@ The module from which the component factory function (`createElement`, `jsx`, `j - ```jsonc { - "jsx": "react" + "jsx": "react", // jsxImportSource is not defined // default to "react" } @@ -213,7 +213,7 @@ The module from which the component factory function (`createElement`, `jsx`, `j - ```jsonc { "jsx": "react-jsx", - "jsxImportSource": "preact" + "jsxImportSource": "preact", } ``` @@ -227,7 +227,7 @@ The module from which the component factory function (`createElement`, `jsx`, `j - ```jsonc { "jsx": "react-jsxdev", - "jsxImportSource": "preact" + "jsxImportSource": "preact", } ``` @@ -263,7 +263,7 @@ All of these values can be set on a per-file basis using _pragmas_. A pragma is - ```jsonc { - "jsxFactory": "h" + "jsxFactory": "h", } ``` @@ -274,7 +274,7 @@ All of these values can be set on a per-file basis using _pragmas_. A pragma is ``` - ```jsonc { - "jsxFragmentFactory": "MyFragment" + "jsxFragmentFactory": "MyFragment", } ``` @@ -285,7 +285,7 @@ All of these values can be set on a per-file basis using _pragmas_. A pragma is ``` - ```jsonc { - "jsxImportSource": "preact" + "jsxImportSource": "preact", } ``` diff --git a/docs/runtime/loaders.md b/docs/runtime/loaders.md index 6b226823d0..69dd4df0cf 100644 --- a/docs/runtime/loaders.md +++ b/docs/runtime/loaders.md @@ -9,7 +9,7 @@ $ bun index.ts $ bun index.tsx ``` -Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](/docs/runtime/typescript) page for details. +Some aspects of Bun's runtime behavior are affected by the contents of your `tsconfig.json` file. Refer to [Runtime > TypeScript](https://bun.sh/docs/runtime/typescript) page for details. ## JSX @@ -85,15 +85,15 @@ $ bun run ./my-wasm-app.whatever You can import sqlite databases directly into your code. Bun will automatically load the database and return a `Database` object. ```ts -import db from "./my.db" with {type: "sqlite"}; +import db from "./my.db" with { type: "sqlite" }; console.log(db.query("select * from users LIMIT 1").get()); ``` -This uses [`bun:sqlite`](/docs/api/sqlite). +This uses [`bun:sqlite`](https://bun.sh/docs/api/sqlite). ## Custom loaders -Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](/docs/bundler/plugins) for full documentation. +Support for additional file types can be implemented with plugins. Refer to [Runtime > Plugins](https://bun.sh/docs/bundler/plugins) for full documentation.