mirror of
https://github.com/lovell/sharp.git
synced 2026-02-13 10:06:13 +01:00
Compare commits
1 Commits
e1bad5470e
...
deecb81b86
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
deecb81b86 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,6 +1,7 @@
|
|||||||
src/build
|
src/build
|
||||||
src/node_modules
|
src/node_modules
|
||||||
node_modules
|
node_modules
|
||||||
|
/coverage
|
||||||
npm/*/*
|
npm/*/*
|
||||||
!npm/*/package.json
|
!npm/*/package.json
|
||||||
test/bench/node_modules
|
test/bench/node_modules
|
||||||
@@ -8,6 +9,7 @@ test/fixtures/output*
|
|||||||
test/fixtures/vips-properties.xml
|
test/fixtures/vips-properties.xml
|
||||||
test/leak/libvips.supp
|
test/leak/libvips.supp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
.nyc_output
|
||||||
.vscode/
|
.vscode/
|
||||||
package-lock.json
|
package-lock.json
|
||||||
.idea
|
.idea
|
||||||
|
|||||||
@@ -3,12 +3,9 @@ title: v0.35.0 - TBC
|
|||||||
slug: changelog/v0.35.0
|
slug: changelog/v0.35.0
|
||||||
---
|
---
|
||||||
|
|
||||||
* Breaking: Drop support for Node.js 18, now requires Node.js >= 20.9.0.
|
|
||||||
|
|
||||||
* Breaking: Remove `install` script from `package.json` file.
|
|
||||||
Compiling from source is now opt-in via the `build` script.
|
|
||||||
|
|
||||||
* Upgrade to libvips v8.18.0 for upstream bug fixes.
|
* Upgrade to libvips v8.18.0 for upstream bug fixes.
|
||||||
|
|
||||||
|
* Drop support for Node.js 18, now requires Node.js >= 20.9.0.
|
||||||
|
|
||||||
* Add `withGainMap` to process HDR JPEG images with embedded gain maps.
|
* Add `withGainMap` to process HDR JPEG images with embedded gain maps.
|
||||||
[#4314](https://github.com/lovell/sharp/issues/4314)
|
[#4314](https://github.com/lovell/sharp/issues/4314)
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ npm install sharp
|
|||||||
pnpm add sharp
|
pnpm add sharp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When using `pnpm`, add `sharp` to
|
||||||
|
[ignoredBuiltDependencies](https://pnpm.io/settings#ignoredbuiltdependencies)
|
||||||
|
to silence warnings.
|
||||||
|
|
||||||
```sh frame="none"
|
```sh frame="none"
|
||||||
yarn add sharp
|
yarn add sharp
|
||||||
```
|
```
|
||||||
@@ -108,13 +112,13 @@ and on macOS when running Node.js under Rosetta.
|
|||||||
|
|
||||||
## Building from source
|
## Building from source
|
||||||
|
|
||||||
```sh frame="none"
|
This module will be compiled from source when:
|
||||||
npm install sharp
|
|
||||||
npm explore sharp -- npm run build
|
|
||||||
```
|
|
||||||
|
|
||||||
The build process will search for a globally-installed libvips.
|
* a globally-installed libvips is detected, or
|
||||||
This detection logic can be skipped by setting the
|
* using `npm explore sharp -- npm run build`, or
|
||||||
|
* using the deprecated `npm run --build-from-source` at `npm install` time.
|
||||||
|
|
||||||
|
The logic to detect a globally-installed libvips can be skipped by setting the
|
||||||
`SHARP_IGNORE_GLOBAL_LIBVIPS` (never try to use it) or
|
`SHARP_IGNORE_GLOBAL_LIBVIPS` (never try to use it) or
|
||||||
`SHARP_FORCE_GLOBAL_LIBVIPS` (always try to use it, even when missing or outdated)
|
`SHARP_FORCE_GLOBAL_LIBVIPS` (always try to use it, even when missing or outdated)
|
||||||
environment variables.
|
environment variables.
|
||||||
@@ -125,12 +129,21 @@ Building from source requires:
|
|||||||
* [node-addon-api](https://www.npmjs.com/package/node-addon-api) version 7+
|
* [node-addon-api](https://www.npmjs.com/package/node-addon-api) version 7+
|
||||||
* [node-gyp](https://github.com/nodejs/node-gyp#installation) version 9+ and its dependencies
|
* [node-gyp](https://github.com/nodejs/node-gyp#installation) version 9+ and its 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 frame="none"
|
```sh frame="none"
|
||||||
npm install --save node-addon-api node-gyp
|
npm install --save node-addon-api node-gyp
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When using `pnpm`, you may need to add `sharp` to
|
||||||
|
[onlyBuiltDependencies](https://pnpm.io/settings#onlybuiltdependencies)
|
||||||
|
to ensure the installation script can be run.
|
||||||
|
|
||||||
|
For cross-compiling, the `--platform`, `--arch` and `--libc` npm flags
|
||||||
|
(or the `npm_config_platform`, `npm_config_arch` and `npm_config_libc` environment variables)
|
||||||
|
can be used to configure the target environment.
|
||||||
|
|
||||||
## WebAssembly
|
## WebAssembly
|
||||||
|
|
||||||
Experimental support is provided for runtime environments that provide
|
Experimental support is provided for runtime environments that provide
|
||||||
@@ -153,8 +166,10 @@ as well as the additional [building from source](#building-from-source) dependen
|
|||||||
|
|
||||||
```sh frame="none"
|
```sh frame="none"
|
||||||
pkg install -y pkgconf vips
|
pkg install -y pkgconf vips
|
||||||
npm install sharp
|
```
|
||||||
npm explore sharp -- npm run build
|
|
||||||
|
```sh frame="none"
|
||||||
|
cd /usr/ports/graphics/vips/ && make install clean
|
||||||
```
|
```
|
||||||
|
|
||||||
## Linux memory allocator
|
## Linux memory allocator
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const {
|
|||||||
spawnRebuild,
|
spawnRebuild,
|
||||||
} = require('../lib/libvips');
|
} = require('../lib/libvips');
|
||||||
|
|
||||||
log('Building from source');
|
log('Attempting to build from source via node-gyp');
|
||||||
log('See https://sharp.pixelplumbing.com/install#building-from-source');
|
log('See https://sharp.pixelplumbing.com/install#building-from-source');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -29,7 +29,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (useGlobalLibvips(log)) {
|
if (useGlobalLibvips(log)) {
|
||||||
log(`Found globally-installed libvips v${globalLibvipsVersion()}`);
|
log(`Detected globally-installed libvips v${globalLibvipsVersion()}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const status = spawnRebuild();
|
const status = spawnRebuild();
|
||||||
|
|||||||
14
install/check.js
Normal file
14
install/check.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/*!
|
||||||
|
Copyright 2013 Lovell Fuller and others.
|
||||||
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { useGlobalLibvips } = require('../lib/libvips');
|
||||||
|
if (useGlobalLibvips() || process.env.npm_config_build_from_source) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
const summary = err.message.split(/\n/).slice(0, 1);
|
||||||
|
console.log(`sharp: skipping install check: ${summary}`);
|
||||||
|
}
|
||||||
@@ -73,7 +73,6 @@ if (sharp) {
|
|||||||
} else {
|
} else {
|
||||||
help.push(
|
help.push(
|
||||||
`- Manually install libvips >= ${minimumLibvipsVersion}`,
|
`- Manually install libvips >= ${minimumLibvipsVersion}`,
|
||||||
' See https://sharp.pixelplumbing.com/install#building-from-source',
|
|
||||||
'- Add experimental WebAssembly-based dependencies:',
|
'- Add experimental WebAssembly-based dependencies:',
|
||||||
' npm install --cpu=wasm32 sharp',
|
' npm install --cpu=wasm32 sharp',
|
||||||
' npm install @img/sharp-wasm32'
|
' npm install @img/sharp-wasm32'
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-darwin-arm64": "1.3.0-rc.1"
|
"@img/sharp-libvips-darwin-arm64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-darwin-x64": "1.3.0-rc.1"
|
"@img/sharp-libvips-darwin-x64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-arm": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-arm": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-arm64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-arm64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-ppc64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-ppc64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-riscv64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-riscv64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-s390x": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-s390x": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linux-x64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linux-x64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
@@ -26,7 +25,7 @@
|
|||||||
},
|
},
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"exports": {
|
"exports": {
|
||||||
"./sharp.node": "./index.cjs",
|
"./sharp": "./index.cjs",
|
||||||
"./package": "./package.json"
|
"./package": "./package.json"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linuxmusl-arm64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linuxmusl-arm64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
"@img/sharp-libvips-linuxmusl-x64": "1.3.0-rc.1"
|
"@img/sharp-libvips-linuxmusl-x64": "1.3.0-rc.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib",
|
"lib",
|
||||||
"versions.json"
|
"versions.json"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib",
|
"lib",
|
||||||
"versions.json"
|
"versions.json"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
},
|
},
|
||||||
"preferUnplugged": true,
|
"preferUnplugged": true,
|
||||||
"files": [
|
"files": [
|
||||||
"index.cjs",
|
|
||||||
"lib",
|
"lib",
|
||||||
"versions.json"
|
"versions.json"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -93,7 +93,8 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node install/build.js",
|
"build": "node install/build.js",
|
||||||
"clean": "rm -rf src/build/ test/fixtures/output.*",
|
"install": "node install/check.js || npm run build",
|
||||||
|
"clean": "rm -rf src/build/ .nyc_output/ coverage/ test/fixtures/output.*",
|
||||||
"test": "npm run lint && npm run test-unit",
|
"test": "npm run lint && npm run test-unit",
|
||||||
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
|
"lint": "npm run lint-cpp && npm run lint-js && npm run lint-types",
|
||||||
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
|
"lint-cpp": "cpplint --quiet src/*.h src/*.cc",
|
||||||
|
|||||||
Reference in New Issue
Block a user