Comparing version 0.0.1 to 0.1.0
@@ -25,3 +25,3 @@ | ||
// Production "Release" buildtype binary | ||
, [ 'module_root', 'compiled', 'platform', 'arch', 'version', 'bindings' ] | ||
, [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] | ||
] | ||
@@ -70,6 +70,8 @@ } | ||
throw new Error('Could not load the bindings file. Tried:\n' + | ||
tries.map(function (a) { return ' - ' + a }).join('\n')) | ||
var err = new Error('Could not load the bindings file. Tried:\n' | ||
+ tries.map(function (a) { return ' - ' + a }).join('\n')) | ||
err.tries = tries | ||
throw err | ||
} | ||
module.exports = exports = bindings; | ||
module.exports = exports = bindings | ||
@@ -76,0 +78,0 @@ |
{ "name": "bindings" | ||
, "description": "Helper module for loading your native module's bindings in a cross-platform way" | ||
, "keywords": [ "native", "addon", "bindings", "gyp" ] | ||
, "version": "0.0.1" | ||
, "version": "0.1.0" | ||
, "author": "Nathan Rajlich <nathan@tootallnate.net> (http://tootallnate.net)" | ||
@@ -6,0 +6,0 @@ , "repository": { "type": "git", "url": "git://github.com/TooTallNate/node-bindings.git" } |
@@ -5,15 +5,18 @@ node-bindings | ||
This is a helper module for authors of native addon node.js modules. In node >= | ||
This is a helper module for authors of Node.js native addon modules. In node >= | ||
0.7.0, it is encouraged to statically precompile your native addons for your | ||
various supported platforms and architectures, rather than depend on your users | ||
to do that. This adds an additional burden on the developer since we now have to | ||
compile the bindings ourselves, before publishing the module. We also have to | ||
figure out which version of the bindings to load at runtime, and that's where | ||
`node-bindings` comes into play. | ||
to do that. This adds two new burdens on the developer that we now need to | ||
condider while writing our module: | ||
This module solves the organizational problem of how to store these bindings files | ||
with a simple directory convention: | ||
1. You now have to compile the bindings yourself, before publishing the module. | ||
2. You now have to figure out which version of the bindings to load at runtime. | ||
`node-bindings` attempts to solve probelm `#2`. | ||
This module solves the organizational problem of how to store these bindings | ||
files with a simple directory convention: | ||
``` | ||
<module root>/compiled/<platform>/<arch>/<node_version>/bindings.node | ||
<module_root>/compiled/<platform>/<arch>/<node_version>/bindings.node | ||
``` | ||
@@ -25,3 +28,3 @@ | ||
``` | ||
<module root>/compiled/win32/ia32/0.6/bindings.node | ||
<module_root>/compiled/win32/ia32/0.6/bindings.node | ||
``` | ||
@@ -33,3 +36,3 @@ | ||
``` | ||
<module root>/compiled/darwin/x64/0.7/bindings.node | ||
<module_root>/compiled/darwin/x64/0.7/bindings.node | ||
``` | ||
@@ -45,4 +48,4 @@ | ||
The default "compiled" directory is `compiled` and the default name of every | ||
bindings file is `bindings.node`. This is configurable if you'd like. | ||
The default "compiled" directory is `compiled` and the default name of every | ||
"bindings" file is `bindings.node`. This is configurable if you'd like. | ||
@@ -49,0 +52,0 @@ |
var bindings = require('./') | ||
, thisFile = bindings.getFileName() | ||
, root = bindings.getRoot(thisFile) | ||
console.error(bindings.getFileName()) | ||
console.error(thisFile) | ||
console.error(root) | ||
bindings({ compiled:'test' }) |
7191
117
114