mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Upgrade to libvips v8.7.0
Drop Node 4 support Add experimental musl prebuild for Node 8 and 10
This commit is contained in:
@@ -44,10 +44,16 @@ const globalLibvipsVersion = function () {
|
||||
|
||||
const hasVendoredLibvips = function () {
|
||||
const currentPlatformId = platform();
|
||||
const vendorPath = path.join(__dirname, '..', 'vendor');
|
||||
let vendorVersionId;
|
||||
let vendorPlatformId;
|
||||
try {
|
||||
vendorPlatformId = require(path.join(__dirname, '..', 'vendor', 'platform.json'));
|
||||
vendorVersionId = require(path.join(vendorPath, 'versions.json')).vips;
|
||||
vendorPlatformId = require(path.join(vendorPath, 'platform.json'));
|
||||
} catch (err) {}
|
||||
if (vendorVersionId && vendorVersionId !== minimumLibvipsVersion) {
|
||||
throw new Error(`Found vendored libvips v${vendorVersionId} but require v${minimumLibvipsVersion}. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.`);
|
||||
}
|
||||
if (vendorPlatformId) {
|
||||
if (currentPlatformId === vendorPlatformId) {
|
||||
return true;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const detectLibc = require('detect-libc');
|
||||
|
||||
module.exports = function () {
|
||||
const arch = process.env.npm_config_arch || process.arch;
|
||||
const platform = process.env.npm_config_platform || process.platform;
|
||||
const libc = (platform === 'linux' && detectLibc.isNonGlibcLinux) ? detectLibc.family : '';
|
||||
|
||||
const platformId = [platform];
|
||||
const platformId = [`${platform}${libc}`];
|
||||
if (arch === 'arm' || arch === 'armhf' || arch === 'arm64') {
|
||||
const armVersion = (arch === 'arm64') ? '8' : process.env.npm_config_armv || process.config.variables.arm_version || '6';
|
||||
platformId.push(`armv${armVersion}`);
|
||||
|
||||
Reference in New Issue
Block a user