remove node-zlib-backport as a dependency as it causes too many problems. Fixes #48

This commit is contained in:
Luke Page 2016-04-27 05:35:51 +02:00
parent ebdb3c546c
commit b914ab4d80
5 changed files with 32 additions and 11 deletions

View file

@ -1,7 +1,11 @@
language: node_js
before_script:
- test $TRAVIS_NODE_VERSION = '0.10' && npm i node-zlib-backport
- echo $TRAVIS_NODE_VERSION
after_success:
- test $TRAVIS_NODE_VERSION = '4.3' && npm run coverage && npm install coveralls@2 && npm run coveralls
- test $TRAVIS_NODE_VERSION =~ 5.* && npm run coverage && npm i coveralls@2 && npm run coveralls
node_js:
- "0.10"
- "0.12"
- "4.1"
- "4"
- "5"

View file

@ -4,7 +4,7 @@ clone_depth: 10
environment:
matrix:
- nodejs_version: '0.12'
- nodejs_version: '4'
- nodejs_version: ''
install:

View file

@ -1,14 +1,25 @@
'use strict';
var hasSyncZlib = true;
var zlib = require('zlib');
if (!zlib.deflateSync) {
// Backwards compatibility with 0.10.
zlib = require('node-zlib-backport');
try {
zlib = require('node-zlib-backport');
}
catch(ex) {
hasSyncZlib = false;
}
}
var constants = require('./constants');
var Packer = require('./packer');
module.exports = function(metaData, opt) {
if (!hasSyncZlib) {
throw new Error('To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport');
}
var options = opt || {};
var packer = new Packer(options);

View file

@ -1,9 +1,15 @@
'use strict';
var hasSyncZlib = true;
var zlib = require('zlib');
if (!zlib.inflateSync) {
if (!zlib.deflateSync) {
// Backwards compatibility with 0.10.
zlib = require('node-zlib-backport');
try {
zlib = require('node-zlib-backport');
}
catch(ex) {
hasSyncZlib = false;
}
}
var SyncReader = require('./sync-reader');
var FilterSync = require('./filter-parse-sync');
@ -14,6 +20,10 @@ var formatNormaliser = require('./format-normaliser');
module.exports = function(buffer, options) {
if (!hasSyncZlib) {
throw new Error('To use the sync capability of this library in old node versions, please also add a dependency on node-zlb-backport');
}
var err;
function handleError(_err_) {
err = _err_;
@ -85,4 +95,3 @@ module.exports = function(buffer, options) {
return metaData;
};

View file

@ -1,6 +1,6 @@
{
"name": "pngjs",
"version": "2.3.0",
"version": "2.3.1",
"description": "PNG encoder/decoder in pure JS, supporting any bit size & interlace, async & sync with full test suite.",
"contributors": [
"Alexandre Paré",
@ -49,9 +49,6 @@
"bugs": {
"url": "https://github.com/lukeapage/pngjs2/issues"
},
"optionalDependencies": {
"node-zlib-backport": "^0.11.15"
},
"devDependencies": {
"buffer-equal": "1.0.0",
"connect": "^3.4.0",