From 75b3264a4cc213f0961c0fcd9022ffd0da6f1684 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 27 Apr 2011 12:31:22 -0700 Subject: Just depend on node-uuid, don't include it. Since this isn't required for the npm self-install process, don't bundle it or load as a git submodule. It's only necessary for the adduser command. --- .gitignore | 1 + LICENSE | 3 -- lib/utils/npm-registry-client/adduser.js | 2 +- lib/utils/uuid.js | 84 -------------------------------- package.json | 6 ++- 5 files changed, 7 insertions(+), 89 deletions(-) delete mode 100644 lib/utils/uuid.js diff --git a/.gitignore b/.gitignore index d28e5585e..76d8e6813 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,6 @@ test/packages/npm-test-depends-on-spark/which-spark.log test/packages/test-package/random-data.txt test/root node_modules/ronn +node_modules/node-uuid node_modules/.bin npm-debug.log diff --git a/LICENSE b/LICENSE index 896616b6a..f7501dc27 100644 --- a/LICENSE +++ b/LICENSE @@ -30,6 +30,3 @@ officially affiliated with Joyent, Inc. Packages published in the npm registry are not part of npm itself, and are the sole property of their respective maintainers. - -This software contains the node-uuid library. Copyright 2010 -Robert Kieffer. Used under the MIT license. diff --git a/lib/utils/npm-registry-client/adduser.js b/lib/utils/npm-registry-client/adduser.js index 0cda561bf..20d4d7cd9 100644 --- a/lib/utils/npm-registry-client/adduser.js +++ b/lib/utils/npm-registry-client/adduser.js @@ -1,7 +1,7 @@ module.exports = adduser -var uuid = require("../uuid") +var uuid = require("node-uuid") , request = require("./request") , log = require("../log") , base64 = require("../base64") diff --git a/lib/utils/uuid.js b/lib/utils/uuid.js deleted file mode 100644 index 54bfd5be0..000000000 --- a/lib/utils/uuid.js +++ /dev/null @@ -1,84 +0,0 @@ -(function() { - /* - * Generate a RFC4122(v4) UUID - * - * Documentation at https://github.com/broofa/node-uuid - * - * Copyright 2010 Robert Kieffer - * Dual licensed under the MIT and GPL licenses. - */ - - // Use node.js Buffer class if available, otherwise use the Array class - var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array; - - // Buffer used for generating string uuids - var _buf = new BufferClass(16); - - // Cache number <-> hex string for octet values - var toString = []; - var toNumber = {}; - for (var i = 0; i < 256; i++) { - toString[i] = (i + 0x100).toString(16).substr(1).toUpperCase(); - toNumber[toString[i]] = i; - } - - function parse(s) { - var buf = new BufferClass(16); - var i = 0, ton = toNumber; - s.toUpperCase().replace(/[0-9A-F][0-9A-F]/g, function(octet) { - buf[i++] = toNumber[octet]; - }); - return buf; - } - - function unparse(buf) { - var tos = toString, b = buf; - return tos[b[0]] + tos[b[1]] + tos[b[2]] + tos[b[3]] + '-' + - tos[b[4]] + tos[b[5]] + '-' + - tos[b[6]] + tos[b[7]] + '-' + - tos[b[8]] + tos[b[9]] + '-' + - tos[b[10]] + tos[b[11]] + tos[b[12]] + - tos[b[13]] + tos[b[14]] + tos[b[15]]; - } - - function uuid(fmt, buf, offset) { - var b32 = 0x100000000, ff = 0xff; - - var b = fmt != 'binary' ? _buf : (buf ? buf : new BufferClass(16)); - var i = buf && offset || 0; - - r = Math.random()*b32; - b[i++] = r & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - r = Math.random()*b32; - b[i++] = r & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & 0x0f | 0x40; // See RFC4122 sect. 4.1.3 - b[i++] = (r=r>>>8) & ff; - r = Math.random()*b32; - b[i++] = r & 0x3f | 0x80; // See RFC4122 sect. 4.4 - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - r = Math.random()*b32; - b[i++] = r & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - b[i++] = (r=r>>>8) & ff; - - return fmt === undefined ? unparse(b) : b; - }; - - uuid.parse = parse; - uuid.unparse = unparse; - uuid.BufferClass = BufferClass; - - if (typeof(module) != 'undefined') { - module.exports = uuid; - } else { - // In browser? Set as top-level function - this.uuid = uuid; - } -})(); diff --git a/package.json b/package.json index 0600afa6d..046d2ef23 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,11 @@ } , "main" : "npm" , "bin" : "./bin/npm.js" -, "dependencies" : { "semver" : "1", "abbrev" : "1", "nopt" : "1" } +, "dependencies" : + { "semver" : "1" + , "abbrev" : "1" + , "nopt" : "1" + , "node-uuid" : "1.1" } , "bundleDependencies" : [ "semver", "abbrev", "nopt" ] , "devDependencies" : { "ronn" : "" } , "engines" : { "node" : "0.4 || 0.5", "npm" : "1" } -- cgit v1.2.3