Comparing version 0.33.0-alpha.8 to 0.33.0-alpha.9
@@ -486,2 +486,3 @@ // Copyright 2013 Lovell Fuller and others. | ||
function metadata (callback) { | ||
const stack = Error(); | ||
if (is.fn(callback)) { | ||
@@ -491,6 +492,18 @@ if (this._isStreamInput()) { | ||
this._flattenBufferIn(); | ||
sharp.metadata(this.options, callback); | ||
sharp.metadata(this.options, (err, metadata) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, metadata); | ||
} | ||
}); | ||
}); | ||
} else { | ||
sharp.metadata(this.options, callback); | ||
sharp.metadata(this.options, (err, metadata) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, metadata); | ||
} | ||
}); | ||
} | ||
@@ -505,3 +518,3 @@ return this; | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -522,3 +535,3 @@ resolve(metadata); | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -579,2 +592,3 @@ resolve(metadata); | ||
function stats (callback) { | ||
const stack = Error(); | ||
if (is.fn(callback)) { | ||
@@ -584,6 +598,18 @@ if (this._isStreamInput()) { | ||
this._flattenBufferIn(); | ||
sharp.stats(this.options, callback); | ||
sharp.stats(this.options, (err, stats) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, stats); | ||
} | ||
}); | ||
}); | ||
} else { | ||
sharp.stats(this.options, callback); | ||
sharp.stats(this.options, (err, stats) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, stats); | ||
} | ||
}); | ||
} | ||
@@ -598,3 +624,3 @@ return this; | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -610,3 +636,3 @@ resolve(stats); | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -613,0 +639,0 @@ resolve(stats); |
@@ -140,2 +140,15 @@ // Copyright 2013 Lovell Fuller and others. | ||
/** | ||
* Ensures an Error from C++ contains a JS stack. | ||
* | ||
* @param {Error} native - Error with message from C++. | ||
* @param {Error} context - Error with stack from JS. | ||
* @returns {Error} Error with message and stack. | ||
* @private | ||
*/ | ||
const nativeError = function (native, context) { | ||
context.message = native.message; | ||
return context; | ||
}; | ||
module.exports = { | ||
@@ -155,3 +168,4 @@ defined, | ||
inArray, | ||
invalidParameterError | ||
invalidParameterError, | ||
nativeError | ||
}; |
@@ -51,3 +51,3 @@ // Copyright 2013 Lovell Fuller and others. | ||
try { | ||
return require('@sharpen/sharp-libvips-dev/include'); | ||
return require('@img/sharp-libvips-dev/include'); | ||
} catch {} | ||
@@ -60,3 +60,3 @@ /* istanbul ignore next */ | ||
try { | ||
return require('@sharpen/sharp-libvips-dev/cplusplus'); | ||
return require('@img/sharp-libvips-dev/cplusplus'); | ||
} catch {} | ||
@@ -69,3 +69,3 @@ /* istanbul ignore next */ | ||
try { | ||
return require(`@sharpen/sharp-libvips-${buildPlatformArch()}/lib`); | ||
return require(`@img/sharp-libvips-${buildPlatformArch()}/lib`); | ||
} catch {} | ||
@@ -72,0 +72,0 @@ /* istanbul ignore next */ |
@@ -89,3 +89,4 @@ // Copyright 2013 Lovell Fuller and others. | ||
this.options.fileOut = fileOut; | ||
return this._pipeline(callback); | ||
const stack = Error(); | ||
return this._pipeline(callback, stack); | ||
} | ||
@@ -161,3 +162,4 @@ return this; | ||
this.options.fileOut = ''; | ||
return this._pipeline(is.fn(options) ? options : callback); | ||
const stack = Error(); | ||
return this._pipeline(is.fn(options) ? options : callback, stack); | ||
} | ||
@@ -1287,3 +1289,4 @@ | ||
this.options.streamOut = true; | ||
this._pipeline(); | ||
const stack = Error(); | ||
this._pipeline(undefined, stack); | ||
} | ||
@@ -1297,3 +1300,3 @@ } | ||
*/ | ||
function _pipeline (callback) { | ||
function _pipeline (callback, stack) { | ||
if (typeof callback === 'function') { | ||
@@ -1305,7 +1308,19 @@ // output=file/buffer | ||
this._flattenBufferIn(); | ||
sharp.pipeline(this.options, callback); | ||
sharp.pipeline(this.options, (err, data, info) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, data, info); | ||
} | ||
}); | ||
}); | ||
} else { | ||
// output=file/buffer, input=file/buffer | ||
sharp.pipeline(this.options, callback); | ||
sharp.pipeline(this.options, (err, data, info) => { | ||
if (err) { | ||
callback(is.nativeError(err, stack)); | ||
} else { | ||
callback(null, data, info); | ||
} | ||
}); | ||
} | ||
@@ -1321,3 +1336,3 @@ return this; | ||
if (err) { | ||
this.emit('error', err); | ||
this.emit('error', is.nativeError(err, stack)); | ||
} else { | ||
@@ -1338,3 +1353,3 @@ this.emit('info', info); | ||
if (err) { | ||
this.emit('error', err); | ||
this.emit('error', is.nativeError(err, stack)); | ||
} else { | ||
@@ -1358,3 +1373,3 @@ this.emit('info', info); | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -1375,3 +1390,3 @@ if (this.options.resolveWithObject) { | ||
if (err) { | ||
reject(err); | ||
reject(is.nativeError(err, stack)); | ||
} else { | ||
@@ -1378,0 +1393,0 @@ if (this.options.resolveWithObject) { |
@@ -21,3 +21,3 @@ // Copyright 2013 Lovell Fuller and others. | ||
// Check for runtime package | ||
module.exports = require(`@sharpen/sharp-${runtimePlatform}/sharp.node`); | ||
module.exports = require(`@img/sharp-${runtimePlatform}/sharp.node`); | ||
} catch (errPackage) { | ||
@@ -35,3 +35,3 @@ const help = ['Could not load the "sharp" module at runtime']; | ||
help.push('- Add an explicit dependency for the runtime platform:'); | ||
help.push(` npm install --force @sharpen/sharp-${runtimePlatform}"`); | ||
help.push(` npm install --force @img/sharp-${runtimePlatform}`); | ||
} else { | ||
@@ -42,3 +42,3 @@ help.push(`- The ${runtimePlatform} platform requires manual installation of libvips >= ${minimumLibvipsVersion}`); | ||
try { | ||
const { engines } = require(`@sharpen/sharp-libvips-${runtimePlatform}/package`); | ||
const { engines } = require(`@img/sharp-libvips-${runtimePlatform}/package`); | ||
const libcFound = `${familySync()} ${versionSync()}`; | ||
@@ -45,0 +45,0 @@ const libcRequires = `${engines.musl ? 'musl' : 'glibc'} ${engines.musl || engines.glibc}`; |
@@ -63,6 +63,6 @@ // Copyright 2013 Lovell Fuller and others. | ||
try { | ||
versions = require(`@sharpen/sharp-${runtimePlatform}/versions`); | ||
versions = require(`@img/sharp-${runtimePlatform}/versions`); | ||
} catch (_) { | ||
try { | ||
versions = require(`@sharpen/sharp-libvips-${runtimePlatform}/versions`); | ||
versions = require(`@img/sharp-libvips-${runtimePlatform}/versions`); | ||
} catch (_) {} | ||
@@ -69,0 +69,0 @@ } |
{ | ||
"name": "sharp", | ||
"description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images", | ||
"version": "0.33.0-alpha.8", | ||
"version": "0.33.0-alpha.9", | ||
"author": "Lovell Fuller <npm@lovell.info>", | ||
@@ -142,23 +142,23 @@ "homepage": "https://github.com/lovell/sharp", | ||
"optionalDependencies": { | ||
"@sharpen/sharp-darwin-arm64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-darwin-x64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-libvips-darwin-arm64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-darwin-x64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-linux-arm": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-linux-arm64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-linux-x64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-linuxmusl-arm64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-linuxmusl-x64": "0.0.1-alpha.2", | ||
"@sharpen/sharp-linux-arm": "0.0.1-alpha.8", | ||
"@sharpen/sharp-linux-arm64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-linux-x64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-linuxmusl-arm64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-linuxmusl-x64": "0.0.1-alpha.8", | ||
"@sharpen/sharp-win32-ia32": "0.0.1-alpha.8", | ||
"@sharpen/sharp-win32-x64": "0.0.1-alpha.8" | ||
"@img/sharp-darwin-arm64": "0.33.0-alpha.9", | ||
"@img/sharp-darwin-x64": "0.33.0-alpha.9", | ||
"@img/sharp-libvips-darwin-arm64": "0.0.1", | ||
"@img/sharp-libvips-darwin-x64": "0.0.1", | ||
"@img/sharp-libvips-linux-arm": "0.0.1", | ||
"@img/sharp-libvips-linux-arm64": "0.0.1", | ||
"@img/sharp-libvips-linux-x64": "0.0.1", | ||
"@img/sharp-libvips-linuxmusl-arm64": "0.0.1", | ||
"@img/sharp-libvips-linuxmusl-x64": "0.0.1", | ||
"@img/sharp-linux-arm": "0.33.0-alpha.9", | ||
"@img/sharp-linux-arm64": "0.33.0-alpha.9", | ||
"@img/sharp-linux-x64": "0.33.0-alpha.9", | ||
"@img/sharp-linuxmusl-arm64": "0.33.0-alpha.9", | ||
"@img/sharp-linuxmusl-x64": "0.33.0-alpha.9", | ||
"@img/sharp-win32-ia32": "0.33.0-alpha.9", | ||
"@img/sharp-win32-x64": "0.33.0-alpha.9" | ||
}, | ||
"devDependencies": { | ||
"@sharpen/sharp-libvips-dev": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-win32-ia32": "0.0.1-alpha.2", | ||
"@sharpen/sharp-libvips-win32-x64": "0.0.1-alpha.2", | ||
"@img/sharp-libvips-dev": "0.0.1", | ||
"@img/sharp-libvips-win32-ia32": "0.0.1", | ||
"@img/sharp-libvips-win32-x64": "0.0.1", | ||
"@types/node": "*", | ||
@@ -165,0 +165,0 @@ "async": "^3.2.4", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
481136
6630