Docs: remove frame clutter from code samples

This commit is contained in:
Lovell Fuller 2025-09-08 11:10:51 +01:00
parent c1e33de33c
commit 1835288ab8
4 changed files with 24 additions and 24 deletions

View File

@ -11,8 +11,8 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/starlight": "^0.34.6", "@astrojs/starlight": "^0.35.2",
"astro": "^5.11.1", "astro": "^5.13.5",
"starlight-auto-sidebar": "^0.1.2" "starlight-auto-sidebar": "^0.1.2"
} }
} }

View File

@ -25,7 +25,7 @@ rotation, extraction, compositing and gamma correction are available.
Most modern macOS, Windows and Linux systems Most modern macOS, Windows and Linux systems
do not require any additional install or runtime dependencies. do not require any additional install or runtime dependencies.
```sh ```sh frame="none"
npm install sharp npm install sharp
``` ```

View File

@ -12,11 +12,11 @@ If a package manager lockfile must support multiple platforms,
please see the [cross-platform](#cross-platform) section please see the [cross-platform](#cross-platform) section
to help decide which package manager is appropriate. to help decide which package manager is appropriate.
```sh ```sh frame="none"
npm install sharp npm install sharp
``` ```
```sh ```sh frame="none"
pnpm add sharp pnpm add sharp
``` ```
@ -24,15 +24,15 @@ When using `pnpm`, you may need to add `sharp` to
[ignoredBuiltDependencies](https://pnpm.io/settings#ignoredbuiltdependencies) [ignoredBuiltDependencies](https://pnpm.io/settings#ignoredbuiltdependencies)
to silence warnings. to silence warnings.
```sh ```sh frame="none"
yarn add sharp yarn add sharp
``` ```
```sh ```sh frame="none"
bun add sharp bun add sharp
``` ```
```sh ```sh frame="none"
deno run --allow-ffi ... deno run --allow-ffi ...
``` ```
@ -75,7 +75,7 @@ npm `package-lock.json` files shared by multiple platforms can cause installatio
Provides limited support via `--os`, `--cpu` and `--libc` flags. Provides limited support via `--os`, `--cpu` and `--libc` flags.
To support macOS with Intel x64 and ARM64 CPUs: To support macOS with Intel x64 and ARM64 CPUs:
```sh ```sh frame="none"
npm install --cpu=x64 --os=darwin sharp npm install --cpu=x64 --os=darwin sharp
npm install --cpu=arm64 --os=darwin sharp npm install --cpu=arm64 --os=darwin sharp
``` ```
@ -83,7 +83,7 @@ npm install --cpu=arm64 --os=darwin sharp
When the cross-target is Linux, the C standard library must be specified. When the cross-target is Linux, the C standard library must be specified.
To support glibc (e.g. Debian) and musl (e.g. Alpine) Linux with Intel x64 CPUs: To support glibc (e.g. Debian) and musl (e.g. Alpine) Linux with Intel x64 CPUs:
```sh ```sh frame="none"
npm install --cpu=x64 --os=linux --libc=glibc sharp npm install --cpu=x64 --os=linux --libc=glibc sharp
npm install --cpu=x64 --os=linux --libc=musl sharp npm install --cpu=x64 --os=linux --libc=musl sharp
``` ```
@ -129,7 +129,7 @@ Building from source requires:
There is an install-time check for these dependencies. There is an install-time check for these dependencies.
If `node-addon-api` or `node-gyp` cannot be found, try adding them via: If `node-addon-api` or `node-gyp` cannot be found, try adding them via:
```sh ```sh frame="none"
npm install --save node-addon-api node-gyp npm install --save node-addon-api node-gyp
``` ```
@ -152,7 +152,7 @@ Native text rendering is unsupported.
[Tile-based output](/api-output#tile) is unsupported. [Tile-based output](/api-output#tile) is unsupported.
```sh ```sh frame="none"
npm install --cpu=wasm32 sharp npm install --cpu=wasm32 sharp
``` ```
@ -160,11 +160,11 @@ npm install --cpu=wasm32 sharp
The `vips` package must be installed before `npm install` is run. The `vips` package must be installed before `npm install` is run.
```sh ```sh frame="none"
pkg install -y pkgconf vips pkg install -y pkgconf vips
``` ```
```sh ```sh frame="none"
cd /usr/ports/graphics/vips/ && make install clean cd /usr/ports/graphics/vips/ && make install clean
``` ```
@ -213,7 +213,7 @@ Ensure sharp is excluded from bundling via the
[externals](https://webpack.js.org/configuration/externals/) [externals](https://webpack.js.org/configuration/externals/)
configuration. configuration.
```js ```js frame="none"
externals: { externals: {
'sharp': 'commonjs sharp' 'sharp': 'commonjs sharp'
} }
@ -225,7 +225,7 @@ Ensure sharp is excluded from bundling via the
[external](https://esbuild.github.io/api/#external) [external](https://esbuild.github.io/api/#external)
configuration. configuration.
```js ```js frame="none"
buildSync({ buildSync({
entryPoints: ['app.js'], entryPoints: ['app.js'],
bundle: true, bundle: true,
@ -234,14 +234,14 @@ buildSync({
}) })
``` ```
```sh ```sh frame="none"
esbuild app.js --bundle --platform=node --external:sharp esbuild app.js --bundle --platform=node --external:sharp
``` ```
For `serverless-esbuild`, ensure platform-specific binaries are installed For `serverless-esbuild`, ensure platform-specific binaries are installed
via the `serverless.yml` configuration. via the `serverless.yml` configuration.
```yaml ```yaml frame="none"
custom: custom:
esbuild: esbuild:
external: external:
@ -259,7 +259,7 @@ Ensure `sharp` is unpacked from the ASAR archive file using the
[asarUnpack](https://www.electron.build/app-builder-lib.interface.platformspecificbuildoptions#asarunpack) [asarUnpack](https://www.electron.build/app-builder-lib.interface.platformspecificbuildoptions#asarunpack)
option. option.
```json ```json frame="none"
{ {
"build": { "build": {
"asar": true, "asar": true,
@ -277,7 +277,7 @@ Ensure `sharp` is unpacked from the ASAR archive file using the
[unpack](https://js.electronforge.io/interfaces/_electron_forge_maker_squirrel.InternalOptions.Options.html#asar) [unpack](https://js.electronforge.io/interfaces/_electron_forge_maker_squirrel.InternalOptions.Options.html#asar)
option. option.
```json ```json frame="none"
{ {
"packagerConfig": { "packagerConfig": {
"asar": { "asar": {
@ -297,7 +297,7 @@ Ensure `sharp` is excluded from bundling via the
[build.rollupOptions](https://vitejs.dev/config/build-options.html) [build.rollupOptions](https://vitejs.dev/config/build-options.html)
configuration. configuration.
```js ```js frame="none"
import { defineConfig } from 'vite'; import { defineConfig } from 'vite';
export default defineConfig({ export default defineConfig({

View File

@ -13,7 +13,7 @@ environment variable, which defaults to 4.
When using more than 4 physical CPU cores, set this environment variable When using more than 4 physical CPU cores, set this environment variable
before the Node.js process starts to increase the thread pool size. before the Node.js process starts to increase the thread pool size.
```sh ```sh frame="none"
export UV_THREADPOOL_SIZE="$(lscpu -p | egrep -v "^#" | sort -u -t, -k 2,4 | wc -l)" export UV_THREADPOOL_SIZE="$(lscpu -p | egrep -v "^#" | sort -u -t, -k 2,4 | wc -l)"
``` ```
@ -28,7 +28,7 @@ To reduce memory fragmentation when using the default Linux glibc memory allocat
[`MALLOC_ARENA_MAX`](https://www.gnu.org/software/libc/manual/html_node/Memory-Allocation-Tunables.html) [`MALLOC_ARENA_MAX`](https://www.gnu.org/software/libc/manual/html_node/Memory-Allocation-Tunables.html)
environment variable before the Node.js process starts to reduce the number of memory pools. environment variable before the Node.js process starts to reduce the number of memory pools.
```sh ```sh frame="none"
export MALLOC_ARENA_MAX="2" export MALLOC_ARENA_MAX="2"
``` ```
@ -130,7 +130,7 @@ Note: jimp does not support premultiply/unpremultiply.
Requires Docker. Requires Docker.
```sh ```sh frame="none"
git clone https://github.com/lovell/sharp.git git clone https://github.com/lovell/sharp.git
cd sharp/test/bench cd sharp/test/bench
./run-with-docker.sh ./run-with-docker.sh