You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you publish and maintain latest iojs native modules in npm? If we want to support all active versions of Node then we can't simply require(<native module>) since it has different behaviors in different versions of Node.
For example, breaking changes in url module caused an issue for our test here. So now it's not safe to require url module anymore since you don't know what you are going to get back.
Typically this is handled by explicitly specifying engines in your package.json and/or branching on process.version when you need to smooth over differences between major node.js/io.js versions that you're supporting for a particular (major) version of your project/module.
If a package is usually used as a dependency engines is not really helpful. I can't tell don't depend on it if you're running a different version of node. Using process.version works but it requires unnecessary work on my side. The new url module in iojs has a bug fix in resolve method. I wish I could use the new and fixed url module in all engines.
I can't tell don't depend on it if you're running a different version of node.
Why not? Surely you don't expect people to use your module with e.g. Node.js 0.4? That's why READMEs usually mention which Node.js versions are supported.
Activity
mscdex commentedon Sep 7, 2015
Typically this is handled by explicitly specifying
enginesin yourpackage.jsonand/or branching onprocess.versionwhen you need to smooth over differences between major node.js/io.js versions that you're supporting for a particular (major) version of your project/module.Fishrock123 commentedon Sep 7, 2015
Version-checking in your code will be the most robust for backwards-compat. Otherwise, to send warnings, use the
enginesfield.Another option if you really need to maintain versions against node major releases, would be:
module-node.version.numbersmohsen1 commentedon Sep 7, 2015
If a package is usually used as a dependency
enginesis not really helpful. I can't tell don't depend on it if you're running a different version of node. Usingprocess.versionworks but it requires unnecessary work on my side. The newurlmodule in iojs has a bug fix inresolvemethod. I wish I could use the new and fixedurlmodule in all engines.mscdex commentedon Sep 8, 2015
@mohsen1 Why not just extract
url.jsfrom here and use it in your project then?brody2consult commentedon Sep 8, 2015
On Tuesday, September 8, 2015, Brian White notifications@github.com wrote:
+1 for your idea @mohsen1. The Cordova project did this starting with 3.0.
Sent from my mobile
mohsen1 commentedon Sep 8, 2015
I did use
url.jsfrom this repo here but copying over files is never a good idea!seishun commentedon Oct 15, 2015
Why not? Surely you don't expect people to use your module with e.g. Node.js 0.4? That's why READMEs usually mention which Node.js versions are supported.
jasnell commentedon Mar 22, 2016
Closing since no discussion since october last year