mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Expose own version as sharp.versions.sharp #3471
This commit is contained in:
parent
c150263ef1
commit
02f855d57a
@ -1,5 +1,5 @@
|
|||||||
## versions
|
## versions
|
||||||
An Object containing the version numbers of libvips and its dependencies.
|
An Object containing the version numbers of sharp, libvips and its dependencies.
|
||||||
|
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
@ -32,6 +32,9 @@ Requires libvips v8.14.0
|
|||||||
[#3470](https://github.com/lovell/sharp/pull/3470)
|
[#3470](https://github.com/lovell/sharp/pull/3470)
|
||||||
[@ejoebstl](https://github.com/ejoebstl)
|
[@ejoebstl](https://github.com/ejoebstl)
|
||||||
|
|
||||||
|
* Expose sharp version as `sharp.versions.sharp`.
|
||||||
|
[#3471](https://github.com/lovell/sharp/issues/3471)
|
||||||
|
|
||||||
* Respect `fastShrinkOnLoad` resize option for WebP input.
|
* Respect `fastShrinkOnLoad` resize option for WebP input.
|
||||||
[#3516](https://github.com/lovell/sharp/issues/3516)
|
[#3516](https://github.com/lovell/sharp/issues/3516)
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ const interpolators = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Object containing the version numbers of libvips and its dependencies.
|
* An Object containing the version numbers of sharp, libvips and its dependencies.
|
||||||
* @member
|
* @member
|
||||||
* @example
|
* @example
|
||||||
* console.log(sharp.versions);
|
* console.log(sharp.versions);
|
||||||
@ -54,6 +54,7 @@ let versions = {
|
|||||||
try {
|
try {
|
||||||
versions = require(`../vendor/${versions.vips}/${platformAndArch}/versions.json`);
|
versions = require(`../vendor/${versions.vips}/${platformAndArch}/versions.json`);
|
||||||
} catch (_err) { /* ignore */ }
|
} catch (_err) { /* ignore */ }
|
||||||
|
versions.sharp = require('../package.json').version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An Object containing the platform and architecture
|
* An Object containing the platform and architecture
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const assert = require('assert');
|
const assert = require('assert');
|
||||||
|
const semver = require('semver');
|
||||||
const sharp = require('../../');
|
const sharp = require('../../');
|
||||||
|
|
||||||
describe('Utilities', function () {
|
describe('Utilities', function () {
|
||||||
@ -137,7 +138,8 @@ describe('Utilities', function () {
|
|||||||
describe('Versions', function () {
|
describe('Versions', function () {
|
||||||
it('Contains expected attributes', function () {
|
it('Contains expected attributes', function () {
|
||||||
assert.strictEqual('object', typeof sharp.versions);
|
assert.strictEqual('object', typeof sharp.versions);
|
||||||
assert.strictEqual('string', typeof sharp.versions.vips);
|
assert(semver.valid(sharp.versions.vips));
|
||||||
|
assert(semver.valid(sharp.versions.sharp));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user