{"action":"created","issue":{"url":"https://api.github.com/repos/iojs/io.js/issues/269","labels_url":"https://api.github.com/repos/iojs/io.js/issues/269/labels{/name}","comments_url":"https://api.github.com/repos/iojs/io.js/issues/269/comments","events_url":"https://api.github.com/repos/iojs/io.js/issues/269/events","html_url":"https://github.com/iojs/io.js/issues/269","id":53835009,"number":269,"title":"npm and iojs with new es6 features","user":{"login":"iarna","id":983798,"avatar_url":"https://avatars.githubusercontent.com/u/983798?v=3","gravatar_id":"","url":"https://api.github.com/users/iarna","html_url":"https://github.com/iarna","followers_url":"https://api.github.com/users/iarna/followers","following_url":"https://api.github.com/users/iarna/following{/other_user}","gists_url":"https://api.github.com/users/iarna/gists{/gist_id}","starred_url":"https://api.github.com/users/iarna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iarna/subscriptions","organizations_url":"https://api.github.com/users/iarna/orgs","repos_url":"https://api.github.com/users/iarna/repos","events_url":"https://api.github.com/users/iarna/events{/privacy}","received_events_url":"https://api.github.com/users/iarna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-01-09T05:26:35Z","updated_at":"2015-01-11T10:35:59Z","closed_at":null,"body":"Since io.js is going to be getting a new v8, and thus a slew of new es6 features not previously enabled by default, this is going to create a situation where some modules will only work with io.js, at least, until such time as node.js updates its own v8.\r\n\r\nThe feature in npm that currently handles this kind of thing is [package.json engines field](https://docs.npmjs.com/files/package.json#engines).\r\n\r\nNow there’s an obvious problem if we add an “iojs” engine type: future versions of node will be likely be api & v8 compatible with iojs, and so depending on a specific iojs version would incorrectly block those node versions.\r\n\r\nIf adding an “iojs” engine type is out, another option would be to add a “v8” engine type.  This would solve the immediate problem, but end users don’t ordinarily think or care about v8 versions, and telling them “your v8 is too old” would be a very crappy user experience (and wouldn’t give them any immediate information on how to fix the problem).\r\n\r\nSo a third option would be to create a series of “feature-xxx”* modules (eg feature-generators) that have preinstall scripts that fail with meaningful messages if you try to install them in an environment without the feature. These wouldn’t import functionality, obviously, they’d just assert a engine that can handle the feature. Further, if one desired to, even in-development features could easily be supported with major version bumps as their implementation changes.\r\n\r\n\\* *Perhaps not actually \"feature-xxx\", another prefix would do just as well, maybe even just \"v8-xxx\"?*\r\n\r\nWhat do you all think? Do you have other ideas on how we might handle this?\r\n\r\n> #### engines\r\n> \r\n> You can specify the version of node that your stuff works on:\r\n> ```\r\n> { \"engines\" : { \"node\" : \">=0.10.3 <0.12\" } }\r\n> ```\r\n> And, like with dependencies, if you don't specify the version (or if you specify \"*\" as the version), then any version of node will do.\r\n> \r\n> If you specify an \"engines\" field, then npm will require that \"node\" be somewhere on that list. If \"engines\" is omitted, then npm will just assume that it works on node.\r\n> \r\n>  You can also use the \"engines\" field to specify which versions of npm are capable of properly installing your program. For example:\r\n> ```\r\n> { \"engines\" : { \"npm\" : \"~1.0.20\" } }\r\n> ```\r\n>  Note that, unless the user has set the engine-strict config flag, this field is advisory only.\r\n> \r\n> #### engineStrict\r\n> \r\n> If you are sure that your module will definitely not run properly on versions of Node/npm other than those specified in the engines object, then you can set\"engineStrict\": true in your package.json file. This will override the user'sengine-strict config setting.\r\n> \r\n> Please do not do this unless you are really very very sure. If your engines object is something overly restrictive, you can quite easily and inadvertently lock yourself into obscurity and prevent your users from updating to new versions of Node. Consider this choice carefully. If people abuse it, it will be removed in a future version of npm.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/iojs/io.js/issues/comments/69489942","html_url":"https://github.com/iojs/io.js/issues/269#issuecomment-69489942","issue_url":"https://api.github.com/repos/iojs/io.js/issues/269","id":69489942,"user":{"login":"sunflowerdeath","id":575734,"avatar_url":"https://avatars.githubusercontent.com/u/575734?v=3","gravatar_id":"","url":"https://api.github.com/users/sunflowerdeath","html_url":"https://github.com/sunflowerdeath","followers_url":"https://api.github.com/users/sunflowerdeath/followers","following_url":"https://api.github.com/users/sunflowerdeath/following{/other_user}","gists_url":"https://api.github.com/users/sunflowerdeath/gists{/gist_id}","starred_url":"https://api.github.com/users/sunflowerdeath/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sunflowerdeath/subscriptions","organizations_url":"https://api.github.com/users/sunflowerdeath/orgs","repos_url":"https://api.github.com/users/sunflowerdeath/repos","events_url":"https://api.github.com/users/sunflowerdeath/events{/privacy}","received_events_url":"https://api.github.com/users/sunflowerdeath/received_events","type":"User","site_admin":false},"created_at":"2015-01-11T10:35:59Z","updated_at":"2015-01-11T10:35:59Z","body":"It is possible to automatically find out version of V8 (and any other parameters that affect compatibility) from specified engine and version, and use it, when later there will be another version compatible with specified.\r\n\r\nFor example, if specified `{ \"engines\": { \"iojs\": \">=1.0.0\" } }` and node 0.15+ will be compatible with iojs 1.0, when you will try to install on old node version, error message will say that you need `iojs >= 1.0.0` OR `node >= 0.15`, which is compatible.\r\n\r\nAnd when you will install this package on `node >= 0.15` it will just warn, that current engine is not same, that was specified, but is compatible."}}