mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
Docs: remove frame clutter from code samples
This commit is contained in:
parent
c1e33de33c
commit
1835288ab8
@ -11,8 +11,8 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.34.6",
|
||||
"astro": "^5.11.1",
|
||||
"@astrojs/starlight": "^0.35.2",
|
||||
"astro": "^5.13.5",
|
||||
"starlight-auto-sidebar": "^0.1.2"
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@ rotation, extraction, compositing and gamma correction are available.
|
||||
Most modern macOS, Windows and Linux systems
|
||||
do not require any additional install or runtime dependencies.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
|
||||
@ -12,11 +12,11 @@ If a package manager lockfile must support multiple platforms,
|
||||
please see the [cross-platform](#cross-platform) section
|
||||
to help decide which package manager is appropriate.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
npm install sharp
|
||||
```
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
pnpm add sharp
|
||||
```
|
||||
|
||||
@ -24,15 +24,15 @@ When using `pnpm`, you may need to add `sharp` to
|
||||
[ignoredBuiltDependencies](https://pnpm.io/settings#ignoredbuiltdependencies)
|
||||
to silence warnings.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
yarn add sharp
|
||||
```
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
bun add sharp
|
||||
```
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
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.
|
||||
|
||||
To support macOS with Intel x64 and ARM64 CPUs:
|
||||
```sh
|
||||
```sh frame="none"
|
||||
npm install --cpu=x64 --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.
|
||||
|
||||
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=musl sharp
|
||||
```
|
||||
@ -129,7 +129,7 @@ Building from source requires:
|
||||
There is an install-time check for these dependencies.
|
||||
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
|
||||
```
|
||||
|
||||
@ -152,7 +152,7 @@ Native text rendering is unsupported.
|
||||
|
||||
[Tile-based output](/api-output#tile) is unsupported.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
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.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
pkg install -y pkgconf vips
|
||||
```
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
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/)
|
||||
configuration.
|
||||
|
||||
```js
|
||||
```js frame="none"
|
||||
externals: {
|
||||
'sharp': 'commonjs sharp'
|
||||
}
|
||||
@ -225,7 +225,7 @@ Ensure sharp is excluded from bundling via the
|
||||
[external](https://esbuild.github.io/api/#external)
|
||||
configuration.
|
||||
|
||||
```js
|
||||
```js frame="none"
|
||||
buildSync({
|
||||
entryPoints: ['app.js'],
|
||||
bundle: true,
|
||||
@ -234,14 +234,14 @@ buildSync({
|
||||
})
|
||||
```
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
esbuild app.js --bundle --platform=node --external:sharp
|
||||
```
|
||||
|
||||
For `serverless-esbuild`, ensure platform-specific binaries are installed
|
||||
via the `serverless.yml` configuration.
|
||||
|
||||
```yaml
|
||||
```yaml frame="none"
|
||||
custom:
|
||||
esbuild:
|
||||
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)
|
||||
option.
|
||||
|
||||
```json
|
||||
```json frame="none"
|
||||
{
|
||||
"build": {
|
||||
"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)
|
||||
option.
|
||||
|
||||
```json
|
||||
```json frame="none"
|
||||
{
|
||||
"packagerConfig": {
|
||||
"asar": {
|
||||
@ -297,7 +297,7 @@ Ensure `sharp` is excluded from bundling via the
|
||||
[build.rollupOptions](https://vitejs.dev/config/build-options.html)
|
||||
configuration.
|
||||
|
||||
```js
|
||||
```js frame="none"
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
@ -13,7 +13,7 @@ environment variable, which defaults to 4.
|
||||
When using more than 4 physical CPU cores, set this environment variable
|
||||
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)"
|
||||
```
|
||||
|
||||
@ -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)
|
||||
environment variable before the Node.js process starts to reduce the number of memory pools.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
export MALLOC_ARENA_MAX="2"
|
||||
```
|
||||
|
||||
@ -130,7 +130,7 @@ Note: jimp does not support premultiply/unpremultiply.
|
||||
|
||||
Requires Docker.
|
||||
|
||||
```sh
|
||||
```sh frame="none"
|
||||
git clone https://github.com/lovell/sharp.git
|
||||
cd sharp/test/bench
|
||||
./run-with-docker.sh
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user