-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove canvas dependency #194
Remove canvas dependency #194
Conversation
@@ -40,7 +41,8 @@ | |||
"canvas": "./src/util/shim/canvas.js", | |||
"eventemitter2": "./src/util/shim/EventEmitter2.js", | |||
"ws": "./src/util/shim/WebSocket.js", | |||
"xmldom": "./src/util/shim/xmldom.js" | |||
"xmldom": "./src/util/shim/xmldom.js", | |||
"../util/decompressPng": "./src/util/shim/decompressPng" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be ./src/util...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I also thought but this is the way aliasify works apparently 😞 We could rewrite it using the browser field of the package.json and not use aliasify.
This commit makes sure that - in a browser a canvas element will be used for decoding pngs (no external dependencies needed) - in node it will use the pngparse module which will use the native zlib module to inflate the data
a148bb5
to
1cb6e01
Compare
Fixed the merge conflict and removed aliasify so that it is more clear how the shims work. |
The canvas dependency makes this library difficult to install on for example travis and windows. This PR removes that dependency such that no native Node.js extensions are needed (no more libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++, just JavaScript code).
I modified the logic a bit but I think I tested all the code paths. Maybe we need CI tests to check the library with BSON and/or png compression.
external dependencies needed)
module to inflate the data