mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 15:25:07 +01:00
Add support for statically-linked dependencies (lovell/sharp-libvips#39) (#2223)
This commit is contained in:
committed by
GitHub
parent
85459e0ec6
commit
7c1c48327e
@@ -48,17 +48,11 @@ const globalLibvipsVersion = function () {
|
||||
|
||||
const hasVendoredLibvips = function () {
|
||||
const currentPlatformId = platform();
|
||||
const vendorPath = path.join(__dirname, '..', 'vendor');
|
||||
let vendorVersionId;
|
||||
const vendorPath = path.join(__dirname, '..', 'vendor', minimumLibvipsVersion);
|
||||
let vendorPlatformId;
|
||||
try {
|
||||
vendorVersionId = require(path.join(vendorPath, 'versions.json')).vips;
|
||||
vendorPlatformId = require(path.join(vendorPath, 'platform.json'));
|
||||
} catch (err) {}
|
||||
/* istanbul ignore if */
|
||||
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'.`);
|
||||
}
|
||||
/* istanbul ignore else */
|
||||
if (vendorPlatformId) {
|
||||
/* istanbul ignore else */
|
||||
|
||||
@@ -23,7 +23,7 @@ let versions = {
|
||||
vips: sharp.libvipsVersion()
|
||||
};
|
||||
try {
|
||||
versions = require('../vendor/versions.json');
|
||||
versions = require(`../vendor/${versions.vips}/versions.json`);
|
||||
} catch (err) {}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user