Rename node.libraryPaths to require.paths
authorRyan Dahl <ry@tinyclouds.org>
Sun, 25 Oct 2009 21:51:10 +0000 (22:51 +0100)
committerRyan Dahl <ry@tinyclouds.org>
Sun, 25 Oct 2009 21:51:57 +0000 (22:51 +0100)
to be more inline with CommonJS.

benchmark/http_simple.js
benchmark/process_loop.js
benchmark/run.js
benchmark/static_http_server.js
doc/api.txt
src/node.js
test/mjsunit/common.js
test/mjsunit/test-buffered-file.js

index 8974af6..43435ad 100644 (file)
@@ -1,5 +1,5 @@
 libDir = node.path.join(node.path.dirname(__filename), "../lib");
-node.libraryPaths.unshift(libDir);
+require.paths.unshift(libDir);
 
 node.mixin(require("/utils.js"));
 http = require("/http.js");
index 6f4d07e..494074a 100644 (file)
@@ -1,5 +1,5 @@
 libDir = node.path.join(node.path.dirname(__filename), "../lib");
-node.libraryPaths.unshift(libDir);
+require.paths.unshift(libDir);
 node.mixin(require("/utils.js"));
 function next (i) {
   if (i <= 0) return;
index 6379a16..965022b 100644 (file)
@@ -1,5 +1,5 @@
 libDir = node.path.join(node.path.dirname(__filename), "../lib");
-node.libraryPaths.unshift(libDir);
+require.paths.unshift(libDir);
 node.mixin(require("/utils.js"));
 var benchmarks = [ "static_http_server.js" 
                  , "timers.js"
index 3ce0499..1866051 100644 (file)
@@ -1,5 +1,5 @@
 libDir = node.path.join(node.path.dirname(__filename), "../lib");
-node.libraryPaths.unshift(libDir);
+require.paths.unshift(libDir);
 http = require("/http.js");
 var concurrency = 30;
 var port = 8000;
index 4bb146f..0f0cfd6 100644 (file)
@@ -73,7 +73,7 @@ more information.
 +require(path)+ ::
 See the modules section.
 
-+node.libraryPaths+ ::
++require.paths+ ::
 The search path for absolute path arguments to +require()+.
 
 +node.mixin([deep], target, object1, [objectN])+ ::
@@ -369,7 +369,7 @@ puts("The area of a cirlce of radius 4 is " + area(4));
 
 When an absolute path is given to +require()+, like
 +require("/mjsunit.js")+ the module is searched for in the
-+node.libraryPaths+ array. +node.libraryPaths+ on my system looks like this: 
++require.paths+ array. +require.paths+ on my system looks like this: 
 
 ----------------------------------------
 [ "/home/ryan/.node_libraries"
@@ -382,7 +382,7 @@ That is, first Node looks for +"/home/ryan/.node_libraries/mjsunit.js"+ and
 then for +"/home/ryan/local/node/lib/node_libraries/mjsunit.js"+. If not
 found, it finally looks for +"/mjsunit.js"+ (in the root directory).
 
-+node.libraryPaths+ can be modified at runtime by simply unshifting new
++require.paths+ can be modified at runtime by simply unshifting new
 paths on to it and at startup with the +NODE_LIBRARY_PATHS+ environmental
 variable (which should be a list of paths, colon separated).
 
index 1b3923d..dc55624 100644 (file)
@@ -294,6 +294,7 @@ node.Module.prototype.loadScript = function (loadPromise) {
       return requireAsync(url).wait();
     }
 
+    require.paths = node.libraryPaths;
     require.async = requireAsync;
 
     // create wrapper function
index 53338ab..808f676 100644 (file)
@@ -2,7 +2,7 @@ exports.testDir = node.path.dirname(__filename);
 exports.fixturesDir = node.path.join(exports.testDir, "fixtures");
 exports.libDir = node.path.join(exports.testDir, "../../lib");
 
-node.libraryPaths.unshift(exports.libDir);
+require.paths.unshift(exports.libDir);
 
 var mjsunit = require("/mjsunit.js");
 var utils = require("/utils.js");
index a27a3a7..23502b5 100644 (file)
@@ -3,7 +3,7 @@ node.mixin(require("common.js"));
 var testTxt = node.path.join(fixturesDir, "test.txt");
 
 var libDir = node.path.join(testDir, "../../lib");
-node.libraryPaths.unshift(libDir);
+require.paths.unshift(libDir);
 node.mixin(require("/file.js"));
 
 var fileUnlinked = false;