Skip to content

Commit 57946ed

Browse files
committed
Upgrade to libvips v8.6.0
Expose offset coordinates of strategy-based crop Switch to Github releases for prebuilt libvips Move packaging scripts to lovell/sharp-libvips repo
1 parent aad16ac commit 57946ed

30 files changed

+86
-631
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/libvips/* linguist-vendored

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ test/saliency/Image*
99
test/saliency/[Uu]serData*
1010
!test/saliency/userData.js
1111
vendor
12-
packaging/libvips*
13-
packaging/*.log
14-
!packaging/build
12+
.gitattributes
1513
.DS_Store
1614
.nyc_output

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ New bugs are assigned a `triage` label whilst under investigation.
1414

1515
If a [similar request](https://github.com/lovell/sharp/labels/enhancement) exists, it's probably fastest to add a comment to it about your requirement.
1616

17-
Implementation is usually straightforward if _libvips_ [already supports](http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/ch03.html) the feature you need.
17+
Implementation is usually straightforward if _libvips_ [already supports](https://jcupitt.github.io/libvips/API/current/) the feature you need.
1818

1919
## Submit a Pull Request to fix a bug
2020

@@ -41,8 +41,8 @@ Any change that modifies the existing public API should be added to the relevant
4141

4242
| Release | WIP branch |
4343
| ------: | :--------- |
44-
| v0.18.0 | ridge |
4544
| v0.19.0 | suit |
45+
| v0.20.0 | teeth |
4646

4747
Please squash your changes into a single commit using a command like `git rebase -i upstream/<wip-branch>`.
4848

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ environment:
66
matrix:
77
- nodejs_version: "4"
88
- nodejs_version: "6"
9-
- nodejs_version: "7"
9+
- nodejs_version: "8"
1010
install:
1111
- ps: Install-Product node $env:nodejs_version x64
1212
- npm install -g npm@latest

binding.gyp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@
230230
'copies': [{
231231
'destination': 'build/Release',
232232
'files': [
233-
'vendor/lib/GNU.Gettext.dll',
234233
'vendor/lib/libasprintf-0.dll',
235234
'vendor/lib/libcairo-2.dll',
236235
'vendor/lib/libcairo-gobject-2.dll',
@@ -245,19 +244,24 @@
245244
'vendor/lib/libfreetype-6.dll',
246245
'vendor/lib/libgcc_s_seh-1.dll',
247246
'vendor/lib/libgdk_pixbuf-2.0-0.dll',
247+
'vendor/lib/libgettextlib-0-19-8.dll',
248+
'vendor/lib/libgettextpo-1.dll',
249+
'vendor/lib/libgettextsrc-0-19-8.dll',
248250
'vendor/lib/libgif-7.dll',
249251
'vendor/lib/libgio-2.0-0.dll',
250252
'vendor/lib/libglib-2.0-0.dll',
251253
'vendor/lib/libgmodule-2.0-0.dll',
252254
'vendor/lib/libgobject-2.0-0.dll',
253255
'vendor/lib/libgsf-1-114.dll',
254256
'vendor/lib/libgthread-2.0-0.dll',
257+
'vendor/lib/libharfbuzz-0.dll',
255258
'vendor/lib/libiconv-2.dll',
256-
'vendor/lib/libintl-8.dll',
259+
'vendor/lib/libintl-9.dll',
257260
'vendor/lib/libjpeg-62.dll',
258261
'vendor/lib/liblcms2-2.dll',
259262
'vendor/lib/libpango-1.0-0.dll',
260263
'vendor/lib/libpangocairo-1.0-0.dll',
264+
'vendor/lib/libpangoft2-1.0-0.dll',
261265
'vendor/lib/libpangowin32-1.0-0.dll',
262266
'vendor/lib/libpixman-1-0.dll',
263267
'vendor/lib/libpng16-16.dll',

binding.js

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ const semver = require('semver');
1010
const tar = require('tar');
1111
const detectLibc = require('detect-libc');
1212

13-
const distBaseUrl = process.env.SHARP_DIST_BASE_URL || 'https://dl.bintray.com/lovell/sharp/';
14-
1513
// Use NPM-provided environment variable where available, falling back to require-based method for Electron
1614
const minimumLibvipsVersion = process.env.npm_package_config_libvips || require('./package.json').config.libvips;
1715

16+
const distBaseUrl = process.env.SHARP_DIST_BASE_URL || `https://github.com/lovell/sharp-libvips/releases/download/v${minimumLibvipsVersion}/`;
17+
1818
const platform = process.env.npm_config_platform || process.platform;
1919

2020
const arch = process.env.npm_config_arch || process.arch;
@@ -81,37 +81,32 @@ module.exports.download_vips = function () {
8181
}
8282
// Arch/platform-specific .tar.gz
8383
const tarFilename = ['libvips', minimumLibvipsVersion, platformId()].join('-') + '.tar.gz';
84-
const tarPathLocal = path.join(__dirname, 'packaging', tarFilename);
85-
if (isFile(tarPathLocal)) {
86-
unpack(tarPathLocal);
87-
} else {
88-
// Download to per-process temporary file
89-
const tarPathTemp = path.join(os.tmpdir(), process.pid + '-' + tarFilename);
90-
const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () {
91-
unpack(tarPathTemp, function () {
92-
// Attempt to remove temporary file
93-
try {
94-
fs.unlinkSync(tarPathTemp);
95-
} catch (err) {}
96-
});
84+
// Download to per-process temporary file
85+
const tarPathTemp = path.join(os.tmpdir(), process.pid + '-' + tarFilename);
86+
const tmpFile = fs.createWriteStream(tarPathTemp).on('finish', function () {
87+
unpack(tarPathTemp, function () {
88+
// Attempt to remove temporary file
89+
try {
90+
fs.unlinkSync(tarPathTemp);
91+
} catch (err) {}
9792
});
98-
const url = distBaseUrl + tarFilename;
99-
const simpleGetOpt = {
100-
url: url,
101-
agent: caw(null, {
102-
protocol: 'https'
103-
})
104-
};
105-
simpleGet(simpleGetOpt, function (err, response) {
106-
if (err) {
107-
error('Download of ' + url + ' failed: ' + err.message);
108-
}
109-
if (response.statusCode !== 200) {
110-
error(url + ' status code ' + response.statusCode);
111-
}
112-
response.pipe(tmpFile);
113-
});
114-
}
93+
});
94+
const url = distBaseUrl + tarFilename;
95+
const simpleGetOpt = {
96+
url: url,
97+
agent: caw(null, {
98+
protocol: 'https'
99+
})
100+
};
101+
simpleGet(simpleGetOpt, function (err, response) {
102+
if (err) {
103+
error('Download of ' + url + ' failed: ' + err.message);
104+
}
105+
if (response.statusCode !== 200) {
106+
error(url + ' status code ' + response.statusCode);
107+
}
108+
response.pipe(tmpFile);
109+
});
115110
}
116111
};
117112

circle.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/changelog.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
### v0.19 - "*suit*"
4+
5+
Requires libvips v8.6.0.
6+
7+
#### v0.19.0 - TBD
8+
9+
* Expose offset coordinates of strategy-based crop.
10+
[#868](https://github.com/lovell/sharp/issues/868)
11+
[@mirohristov-com](https://github.com/mirohristov-com)
12+
313
### v0.18 - "*ridge*"
414

515
Requires libvips v8.5.5.

lib/output.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const sharp = require('../build/Release/sharp.node');
1616
* @param {Function} [callback] - called on completion with two arguments `(err, info)`.
1717
* `info` contains the output image `format`, `size` (bytes), `width`, `height`,
1818
* `channels` and `premultiplied` (indicating if premultiplication was used).
19+
* When using a crop strategy also contains `cropOffsetLeft` and `cropOffsetTop`.
1920
* @returns {Promise<Object>} - when no callback is provided
2021
* @throws {Error} Invalid parameters
2122
*/

package.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sharp",
33
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images",
4-
"version": "0.18.4",
4+
"version": "0.19.0-alpha",
55
"author": "Lovell Fuller <[email protected]>",
66
"homepage": "https://github.com/lovell/sharp",
77
"contributors": [
@@ -44,7 +44,6 @@
4444
"clean": "rm -rf node_modules/ build/ vendor/ coverage/ test/fixtures/output.*",
4545
"test": "semistandard && cc && nyc --reporter=lcov --branches=99 mocha --slow=5000 --timeout=60000 ./test/unit/*.js",
4646
"test-leak": "./test/leak/leak.sh",
47-
"test-packaging": "./packaging/test-linux-x64.sh",
4847
"docs": "for m in constructor input resize composite operation colour channel output utility; do documentation build --shallow --format=md lib/$m.js >docs/api-$m.md; done"
4948
},
5049
"main": "lib/index.js",
@@ -71,26 +70,26 @@
7170
"caw": "^2.0.0",
7271
"color": "^2.0.0",
7372
"detect-libc": "^0.2.0",
74-
"nan": "^2.6.2",
75-
"semver": "^5.3.0",
73+
"nan": "^2.7.0",
74+
"semver": "^5.4.1",
7675
"simple-get": "^2.7.0",
77-
"tar": "^3.1.5"
76+
"tar": "^4.0.1"
7877
},
7978
"devDependencies": {
8079
"async": "^2.5.0",
8180
"cc": "^1.0.1",
8281
"documentation": "^4.0.0-rc.1",
8382
"exif-reader": "^1.0.2",
8483
"icc": "^1.0.0",
85-
"mocha": "^3.4.2",
86-
"nyc": "^11.0.3",
84+
"mocha": "^3.5.0",
85+
"nyc": "^11.1.0",
8786
"rimraf": "^2.6.1",
8887
"semistandard": "^11.0.0",
8988
"unzip": "^0.1.11"
9089
},
9190
"license": "Apache-2.0",
9291
"config": {
93-
"libvips": "8.5.5"
92+
"libvips": "8.6.0"
9493
},
9594
"engines": {
9695
"node": ">=4.5.0"

packaging/README.md

Lines changed: 0 additions & 57 deletions
This file was deleted.

packaging/build.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)