0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 15:06:33 +01:00

Rename node.libraryPaths to require.paths

to be more inline with CommonJS.
This commit is contained in:
Ryan Dahl 2009-10-25 22:51:10 +01:00
parent 4bcb01c8bf
commit 04e53cab90
8 changed files with 10 additions and 9 deletions

View 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");

View 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;

View 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"

View 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;

View 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).

View 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

View 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");

View 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;