Is there a standard way of detecting the implementation (node.js, rhino etc) and ideally version of that implementation in CommonJS.
If not, what do people do to get it?
I’m thinking something akin to the HTTP User-Agent header in the browser world.
No, but you could detect whether you’re inside node, for example:
If you wanted to be absolutely certain it’s node:
I can’t say for other environments, (I’ve never used Rhino).
But to answer your question more in-depth, Node doesn’t have a strict “version” of CommonJS it implements. Node hasn’t been catering to CommonJS specs for a long time now (aside from the recent AMD implementation, which wasn’t a full implementation anyway).