Remove node-pngquant-native dependency
- Unnecessary native dependency - It was disabled by default - Has issues on certain platforms - Not optimal for production use (performance)
This commit is contained in:
parent
54f11a2125
commit
d9f8582279
4 changed files with 1 additions and 18 deletions
|
@ -21,9 +21,7 @@ Example::
|
|||
],
|
||||
"formatQuality": {
|
||||
"jpeg": 80,
|
||||
"webp": 90,
|
||||
"pngQuantization": false,
|
||||
"png": 90
|
||||
"webp": 90
|
||||
},
|
||||
"maxScaleFactor": 3,
|
||||
"maxSize": 2048,
|
||||
|
@ -83,8 +81,6 @@ Use ``false`` to disable the front page altogether (404).
|
|||
|
||||
Quality of the compression of individual image formats. [0-100]
|
||||
|
||||
The value for ``png`` is only used when ``pngQuantization`` is ``true``.
|
||||
|
||||
``maxScaleFactor``
|
||||
-----------
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
"handlebars": "4.0.10",
|
||||
"http-shutdown": "^1.2.0",
|
||||
"morgan": "1.8.2",
|
||||
"node-pngquant-native": "1.0.5",
|
||||
"nomnom": "1.8.1",
|
||||
"pbf": "3.0.5",
|
||||
"proj4": "2.4.4",
|
||||
|
|
|
@ -23,7 +23,6 @@ packageJson.name += '-light';
|
|||
packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles';
|
||||
delete packageJson.dependencies['canvas'];
|
||||
delete packageJson.dependencies['@mapbox/mapbox-gl-native'];
|
||||
delete packageJson.dependencies['node-pngquant-native'];
|
||||
delete packageJson.dependencies['sharp'];
|
||||
|
||||
delete packageJson.optionalDependencies;
|
||||
|
|
|
@ -18,7 +18,6 @@ var Canvas = require('canvas'),
|
|||
mercator = new (require('@mapbox/sphericalmercator'))(),
|
||||
mbgl = require('@mapbox/mapbox-gl-native'),
|
||||
mbtiles = require('@mapbox/mbtiles'),
|
||||
pngquant = require('node-pngquant-native'),
|
||||
proj4 = require('proj4'),
|
||||
request = require('request');
|
||||
|
||||
|
@ -451,16 +450,6 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
|||
return res.status(404).send('Not found');
|
||||
}
|
||||
|
||||
if (format == 'png') {
|
||||
var usePngQuant =
|
||||
(options.formatQuality || {}).pngQuantization === true;
|
||||
if (usePngQuant) {
|
||||
buffer = pngquant.compress(buffer, {
|
||||
quality: [0, formatQuality || 90]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
res.set({
|
||||
'Last-Modified': lastModified,
|
||||
'Content-Type': 'image/' + format
|
||||
|
|
Loading…
Reference in a new issue