mirror of
https://github.com/lovell/sharp.git
synced 2025-12-18 23:05:04 +01:00
Ensure SHARP_FORCE_GLOBAL_LIBVIPS option works correctly #4111
Allows the install/check script to inject a logger function, keeping its use within binding.gyp free of additional output. Co-authored-by: Lovell Fuller <github@lovell.info>
This commit is contained in:
committed by
Lovell Fuller
parent
cc96c21e42
commit
56fae3eda1
@@ -162,21 +162,23 @@ const pkgConfigPath = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const skipSearch = (status, reason) => {
|
||||
log(`Detected ${reason}, skipping search for globally-installed libvips`);
|
||||
const skipSearch = (status, reason, logger) => {
|
||||
if (logger) {
|
||||
logger(`Detected ${reason}, skipping search for globally-installed libvips`);
|
||||
}
|
||||
return status;
|
||||
};
|
||||
|
||||
const useGlobalLibvips = () => {
|
||||
const useGlobalLibvips = (logger) => {
|
||||
if (Boolean(process.env.SHARP_IGNORE_GLOBAL_LIBVIPS) === true) {
|
||||
return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS');
|
||||
return skipSearch(false, 'SHARP_IGNORE_GLOBAL_LIBVIPS', logger);
|
||||
}
|
||||
if (Boolean(process.env.SHARP_FORCE_GLOBAL_LIBVIPS) === true) {
|
||||
return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS');
|
||||
return skipSearch(true, 'SHARP_FORCE_GLOBAL_LIBVIPS', logger);
|
||||
}
|
||||
/* istanbul ignore next */
|
||||
if (isRosetta()) {
|
||||
return skipSearch(false, 'Rosetta');
|
||||
return skipSearch(false, 'Rosetta', logger);
|
||||
}
|
||||
const globalVipsVersion = globalLibvipsVersion();
|
||||
return !!globalVipsVersion && /* istanbul ignore next */
|
||||
|
||||
Reference in New Issue
Block a user