From be3a77bd428612dc7c8b6bd0f76e51ef277f4fb0 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sun, 19 Aug 2012 11:11:47 -0700 Subject: [PATCH 01/35] build: don't use "-Wnewline-eof" on OS X This is the only thing preventing a manually compiled version of GCC (rather than Apple's provided llvm-gcc or heavily modified gcc 4.2) from working properly, so we might as well enable support for that. With this patch I was able to compile node using a manually compiled gcc 4.7.1. Closes #3887. --- common.gypi | 1 - 1 file changed, 1 deletion(-) diff --git a/common.gypi b/common.gypi index d8cb5323afa..b2a9bee2757 100644 --- a/common.gypi +++ b/common.gypi @@ -190,7 +190,6 @@ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics 'GCC_VERSION': '4.2', - 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof 'PREBINDING': 'NO', # No -Wl,-prebind 'MACOSX_DEPLOYMENT_TARGET': '10.5', # -mmacosx-version-min=10.5 'USE_HEADERMAP': 'NO', From 0844e2359bc6b5974db9ec5a8065561ffa87cdcc Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 20 Aug 2012 17:20:41 +0200 Subject: [PATCH 02/35] deps: upgrade libuv to 012cbda --- deps/uv/include/uv.h | 48 ++++++--- deps/uv/src/fs-poll.c | 149 +++++++++++++++------------- deps/uv/src/unix/cygwin.c | 2 +- deps/uv/src/unix/freebsd.c | 2 +- deps/uv/src/unix/fs.c | 2 +- deps/uv/src/unix/linux/linux-core.c | 2 +- deps/uv/src/unix/netbsd.c | 2 +- deps/uv/src/unix/openbsd.c | 2 +- deps/uv/src/unix/sunos.c | 6 +- deps/uv/test/benchmark-sizes.c | 1 + 10 files changed, 122 insertions(+), 94 deletions(-) diff --git a/deps/uv/include/uv.h b/deps/uv/include/uv.h index cdde9059479..7c2c03f9286 100644 --- a/deps/uv/include/uv.h +++ b/deps/uv/include/uv.h @@ -1093,8 +1093,7 @@ UV_EXTERN int uv_async_send(uv_async_t* async); /* * uv_timer_t is a subclass of uv_handle_t. * - * Wraps libev's ev_timer watcher. Used to get woken up at a specified time - * in the future. + * Used to get woken up at a specified time in the future. */ struct uv_timer_s { UV_HANDLE_FIELDS @@ -1103,8 +1102,22 @@ struct uv_timer_s { UV_EXTERN int uv_timer_init(uv_loop_t*, uv_timer_t* timer); -UV_EXTERN int uv_timer_start(uv_timer_t* timer, uv_timer_cb cb, - int64_t timeout, int64_t repeat); +/* + * Start the timer. `timeout` and `repeat` are in milliseconds. + * + * If timeout is zero, the callback fires on the next tick of the event loop. + * + * If repeat is non-zero, the callback fires first after timeout milliseconds + * and then repeatedly after repeat milliseconds. + * + * timeout and repeat are signed integers but that will change in a future + * version of libuv. Don't pass in negative values, you'll get a nasty surprise + * when that change becomes effective. + */ +UV_EXTERN int uv_timer_start(uv_timer_t* timer, + uv_timer_cb cb, + int64_t timeout, + int64_t repeat); UV_EXTERN int uv_timer_stop(uv_timer_t* timer); @@ -1116,10 +1129,10 @@ UV_EXTERN int uv_timer_stop(uv_timer_t* timer); UV_EXTERN int uv_timer_again(uv_timer_t* timer); /* - * Set the repeat value. Note that if the repeat value is set from a timer - * callback it does not immediately take effect. If the timer was non-repeating - * before, it will have been stopped. If it was repeating, then the old repeat - * value will have been used to schedule the next timeout. + * Set the repeat value in milliseconds. Note that if the repeat value is set + * from a timer callback it does not immediately take effect. If the timer was + * non-repeating before, it will have been stopped. If it was repeating, then + * the old repeat value will have been used to schedule the next timeout. */ UV_EXTERN void uv_timer_set_repeat(uv_timer_t* timer, int64_t repeat); @@ -1518,14 +1531,17 @@ struct uv_fs_event_s { struct uv_fs_poll_s { UV_HANDLE_FIELDS /* Private, don't touch. */ - int busy_polling; /* TODO(bnoordhuis) Fold into flags field. */ - unsigned int interval; - uint64_t start_time; - char* path; - uv_fs_poll_cb poll_cb; - uv_timer_t timer_handle; - uv_fs_t* fs_req; - uv_statbuf_t statbuf; + void* poll_ctx; + /* v0.8 ABI compatibility */ + char padding[sizeof(int) + + sizeof(unsigned int) + + sizeof(uint64_t) + + sizeof(char*) + + sizeof(uv_fs_poll_cb) + + sizeof(uv_timer_t) + + sizeof(uv_fs_t*) + + sizeof(uv_statbuf_t) + - sizeof(void*)]; }; UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle); diff --git a/deps/uv/src/fs-poll.c b/deps/uv/src/fs-poll.c index 99d3bcfae91..71eaebc0a1a 100644 --- a/deps/uv/src/fs-poll.c +++ b/deps/uv/src/fs-poll.c @@ -26,24 +26,30 @@ #include #include +struct poll_ctx { + uv_fs_poll_t* parent_handle; /* NULL if parent has been stopped or closed */ + int busy_polling; + unsigned int interval; + uint64_t start_time; + uv_loop_t* loop; + uv_fs_poll_cb poll_cb; + uv_timer_t timer_handle; + uv_fs_t fs_req; /* TODO(bnoordhuis) mark fs_req internal */ + uv_statbuf_t statbuf; + char path[1]; /* variable length */ +}; + static int statbuf_eq(const uv_statbuf_t* a, const uv_statbuf_t* b); -static void timer_cb(uv_timer_t* timer, int status); static void poll_cb(uv_fs_t* req); +static void timer_cb(uv_timer_t* timer, int status); +static void timer_close_cb(uv_handle_t* handle); static uv_statbuf_t zero_statbuf; int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle) { - /* TODO(bnoordhuis) Mark fs_req internal. */ uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_POLL); loop->counters.fs_poll_init++; - - if (uv_timer_init(loop, &handle->timer_handle)) - return -1; - - handle->timer_handle.flags |= UV__HANDLE_INTERNAL; - uv__handle_unref(&handle->timer_handle); - return 0; } @@ -52,30 +58,37 @@ int uv_fs_poll_start(uv_fs_poll_t* handle, uv_fs_poll_cb cb, const char* path, unsigned int interval) { - uv_fs_t* req; + struct poll_ctx* ctx; + uv_loop_t* loop; size_t len; if (uv__is_active(handle)) return 0; - len = strlen(path) + 1; - req = malloc(sizeof(*req) + len); + loop = handle->loop; + len = strlen(path); + ctx = calloc(1, sizeof(*ctx) + len); - if (req == NULL) - return uv__set_artificial_error(handle->loop, UV_ENOMEM); + if (ctx == NULL) + return uv__set_artificial_error(loop, UV_ENOMEM); - req->data = handle; - handle->path = memcpy(req + 1, path, len); - handle->fs_req = req; - handle->poll_cb = cb; - handle->interval = interval ? interval : 1; - handle->start_time = uv_now(handle->loop); - handle->busy_polling = 0; - memset(&handle->statbuf, 0, sizeof(handle->statbuf)); + ctx->loop = loop; + ctx->poll_cb = cb; + ctx->interval = interval ? interval : 1; + ctx->start_time = uv_now(loop); + ctx->parent_handle = handle; + memcpy(ctx->path, path, len + 1); - if (uv_fs_stat(handle->loop, handle->fs_req, handle->path, poll_cb)) + if (uv_timer_init(loop, &ctx->timer_handle)) abort(); + ctx->timer_handle.flags |= UV__HANDLE_INTERNAL; + uv__handle_unref(&ctx->timer_handle); + + if (uv_fs_stat(loop, &ctx->fs_req, ctx->path, poll_cb)) + abort(); + + handle->poll_ctx = ctx; uv__handle_start(handle); return 0; @@ -83,25 +96,19 @@ int uv_fs_poll_start(uv_fs_poll_t* handle, int uv_fs_poll_stop(uv_fs_poll_t* handle) { + struct poll_ctx* ctx; + if (!uv__is_active(handle)) return 0; - /* Don't free the fs req if it's active. Signal poll_cb that it needs to free - * the req by removing the handle backlink. - * - * TODO(bnoordhuis) Have uv-unix postpone the close callback until the req - * finishes so we don't need this pointer / lifecycle hackery. The callback - * always runs on the next tick now. - */ - if (handle->fs_req->data) - handle->fs_req->data = NULL; - else - free(handle->fs_req); + ctx = handle->poll_ctx; + assert(ctx != NULL); + assert(ctx->parent_handle != NULL); - handle->fs_req = NULL; - handle->path = NULL; + ctx->parent_handle = NULL; + uv_timer_stop(&ctx->timer_handle); - uv_timer_stop(&handle->timer_handle); + handle->poll_ctx = NULL; uv__handle_stop(handle); return 0; @@ -110,73 +117,75 @@ int uv_fs_poll_stop(uv_fs_poll_t* handle) { void uv__fs_poll_close(uv_fs_poll_t* handle) { uv_fs_poll_stop(handle); - uv_close((uv_handle_t*)&handle->timer_handle, NULL); } static void timer_cb(uv_timer_t* timer, int status) { - uv_fs_poll_t* handle; + struct poll_ctx* ctx; - handle = container_of(timer, uv_fs_poll_t, timer_handle); - handle->start_time = uv_now(handle->loop); - handle->fs_req->data = handle; + ctx = container_of(timer, struct poll_ctx, timer_handle); - if (uv_fs_stat(handle->loop, handle->fs_req, handle->path, poll_cb)) + if (ctx->parent_handle == NULL) { /* handle has been stopped or closed */ + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + return; + } + + assert(ctx->parent_handle->poll_ctx == ctx); + ctx->start_time = uv_now(ctx->loop); + + if (uv_fs_stat(ctx->loop, &ctx->fs_req, ctx->path, poll_cb)) abort(); - - assert(uv__is_active(handle)); } static void poll_cb(uv_fs_t* req) { uv_statbuf_t* statbuf; - uv_fs_poll_t* handle; + struct poll_ctx* ctx; uint64_t interval; - handle = req->data; + ctx = container_of(req, struct poll_ctx, fs_req); - if (handle == NULL) /* Handle has been stopped or closed. */ - goto out; - - assert(req == handle->fs_req); + if (ctx->parent_handle == NULL) { /* handle has been stopped or closed */ + uv_close((uv_handle_t*)&ctx->timer_handle, timer_close_cb); + uv_fs_req_cleanup(req); + return; + } if (req->result != 0) { - if (handle->busy_polling != -req->errorno) { - uv__set_artificial_error(handle->loop, req->errorno); - handle->poll_cb(handle, -1, &handle->statbuf, &zero_statbuf); - handle->busy_polling = -req->errorno; + if (ctx->busy_polling != -req->errorno) { + uv__set_artificial_error(ctx->loop, req->errorno); + ctx->poll_cb(ctx->parent_handle, -1, &ctx->statbuf, &zero_statbuf); + ctx->busy_polling = -req->errorno; } goto out; } statbuf = req->ptr; - if (handle->busy_polling != 0) - if (handle->busy_polling < 0 || !statbuf_eq(&handle->statbuf, statbuf)) - handle->poll_cb(handle, 0, &handle->statbuf, statbuf); + if (ctx->busy_polling != 0) + if (ctx->busy_polling < 0 || !statbuf_eq(&ctx->statbuf, statbuf)) + ctx->poll_cb(ctx->parent_handle, 0, &ctx->statbuf, statbuf); - handle->statbuf = *statbuf; - handle->busy_polling = 1; + ctx->statbuf = *statbuf; + ctx->busy_polling = 1; out: uv_fs_req_cleanup(req); - if (req->data == NULL) { /* Handle has been stopped or closed. */ - free(req); - return; - } - - req->data = NULL; /* Tell uv_fs_poll_stop() it's safe to free the req. */ - /* Reschedule timer, subtract the delay from doing the stat(). */ - interval = handle->interval; - interval -= (uv_now(handle->loop) - handle->start_time) % interval; + interval = ctx->interval; + interval -= (uv_now(ctx->loop) - ctx->start_time) % interval; - if (uv_timer_start(&handle->timer_handle, timer_cb, interval, 0)) + if (uv_timer_start(&ctx->timer_handle, timer_cb, interval, 0)) abort(); } +static void timer_close_cb(uv_handle_t* handle) { + free(container_of(handle, struct poll_ctx, timer_handle)); +} + + static int statbuf_eq(const uv_statbuf_t* a, const uv_statbuf_t* b) { #ifdef _WIN32 return a->st_mtime == b->st_mtime diff --git a/deps/uv/src/unix/cygwin.c b/deps/uv/src/unix/cygwin.c index a99779d4e4c..183beb32217 100644 --- a/deps/uv/src/unix/cygwin.c +++ b/deps/uv/src/unix/cygwin.c @@ -35,7 +35,7 @@ uint64_t uv_hrtime() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * NANOSEC + ts.tv_nsec); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } void uv_loadavg(double avg[3]) { diff --git a/deps/uv/src/unix/freebsd.c b/deps/uv/src/unix/freebsd.c index be8006c5a8c..0528835f965 100644 --- a/deps/uv/src/unix/freebsd.c +++ b/deps/uv/src/unix/freebsd.c @@ -57,7 +57,7 @@ static char *process_title; uint64_t uv_hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * NANOSEC + ts.tv_nsec); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } diff --git a/deps/uv/src/unix/fs.c b/deps/uv/src/unix/fs.c index e62832db5a5..c43c19f23e6 100644 --- a/deps/uv/src/unix/fs.c +++ b/deps/uv/src/unix/fs.c @@ -85,7 +85,7 @@ void uv_fs_req_cleanup(uv_fs_t* req) { if (req->cb) uv__req_unregister(req->loop, req); - free(req->path); + free((void*)req->path); req->path = NULL; switch (req->fs_type) { diff --git a/deps/uv/src/unix/linux/linux-core.c b/deps/uv/src/unix/linux/linux-core.c index 34f48a94b9f..c77c81cc920 100644 --- a/deps/uv/src/unix/linux/linux-core.c +++ b/deps/uv/src/unix/linux/linux-core.c @@ -71,7 +71,7 @@ static struct { uint64_t uv_hrtime() { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * NANOSEC + ts.tv_nsec); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } diff --git a/deps/uv/src/unix/netbsd.c b/deps/uv/src/unix/netbsd.c index a1a7091bbb0..5f7a8484991 100644 --- a/deps/uv/src/unix/netbsd.c +++ b/deps/uv/src/unix/netbsd.c @@ -38,7 +38,7 @@ uint64_t uv_hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * NANOSEC + ts.tv_nsec); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } void uv_loadavg(double avg[3]) { diff --git a/deps/uv/src/unix/openbsd.c b/deps/uv/src/unix/openbsd.c index 865f8e9e6af..a18674fabeb 100644 --- a/deps/uv/src/unix/openbsd.c +++ b/deps/uv/src/unix/openbsd.c @@ -46,7 +46,7 @@ static char *process_title; uint64_t uv_hrtime(void) { struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); - return (ts.tv_sec * NANOSEC + ts.tv_nsec); + return (((uint64_t) ts.tv_sec) * NANOSEC + ts.tv_nsec); } diff --git a/deps/uv/src/unix/sunos.c b/deps/uv/src/unix/sunos.c index 6598ea2581e..b49e4483118 100644 --- a/deps/uv/src/unix/sunos.c +++ b/deps/uv/src/unix/sunos.c @@ -346,8 +346,10 @@ uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) { cpu_info->model = NULL; } else { knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"clock_MHz"); - assert(knp->data_type == KSTAT_DATA_INT32); - cpu_info->speed = knp->value.i32; + assert(knp->data_type == KSTAT_DATA_INT32 || + knp->data_type == KSTAT_DATA_INT64); + cpu_info->speed = (knp->data_type == KSTAT_DATA_INT32) ? knp->value.i32 + : knp->value.i64; knp = (kstat_named_t *) kstat_data_lookup(ksp, (char *)"brand"); assert(knp->data_type == KSTAT_DATA_STRING); diff --git a/deps/uv/test/benchmark-sizes.c b/deps/uv/test/benchmark-sizes.c index b9cf74f2fbf..8ccf10ee475 100644 --- a/deps/uv/test/benchmark-sizes.c +++ b/deps/uv/test/benchmark-sizes.c @@ -36,6 +36,7 @@ BENCHMARK_IMPL(sizes) { LOGF("uv_idle_t: %u bytes\n", (unsigned int) sizeof(uv_idle_t)); LOGF("uv_async_t: %u bytes\n", (unsigned int) sizeof(uv_async_t)); LOGF("uv_timer_t: %u bytes\n", (unsigned int) sizeof(uv_timer_t)); + LOGF("uv_fs_poll_t: %u bytes\n", (unsigned int) sizeof(uv_fs_poll_t)); LOGF("uv_fs_event_t: %u bytes\n", (unsigned int) sizeof(uv_fs_event_t)); LOGF("uv_process_t: %u bytes\n", (unsigned int) sizeof(uv_process_t)); LOGF("uv_poll_t: %u bytes\n", (unsigned int) sizeof(uv_poll_t)); From b1ffbdc975d58b31e3b13749c29fdc07049ea1d9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 20 Aug 2012 12:52:26 +0200 Subject: [PATCH 03/35] fs: fix use after free in stat watcher The uv_fs_poll_t handle was stopped but not closed, leaving libuv's internal handle queue in a corrupted state. --- src/node_stat_watcher.cc | 34 +++++++++++++++++++++++++++------- src/node_stat_watcher.h | 11 +++-------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index 8f38033d1a2..c3f668c086f 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -49,19 +49,39 @@ void StatWatcher::Initialize(Handle target) { } +static void Delete(uv_handle_t* handle) { + delete reinterpret_cast(handle); +} + + +StatWatcher::StatWatcher() + : ObjectWrap() + , watcher_(new uv_fs_poll_t) +{ + uv_fs_poll_init(uv_default_loop(), watcher_); + watcher_->data = static_cast(this); +} + + +StatWatcher::~StatWatcher() { + Stop(); + uv_close(reinterpret_cast(watcher_), Delete); +} + + void StatWatcher::Callback(uv_fs_poll_t* handle, int status, const uv_statbuf_t* prev, const uv_statbuf_t* curr) { - StatWatcher* wrap = container_of(handle, StatWatcher, watcher_); - assert(handle == &wrap->watcher_); + StatWatcher* wrap = static_cast(handle->data); + assert(wrap->watcher_ == handle); HandleScope scope; Local argv[3]; argv[0] = BuildStatsObject(curr); argv[1] = BuildStatsObject(prev); argv[2] = Integer::New(status); if (status == -1) { - SetErrno(uv_last_error(wrap->watcher_.loop)); + SetErrno(uv_last_error(wrap->watcher_->loop)); } if (onchange_sym.IsEmpty()) { onchange_sym = NODE_PSYMBOL("onchange"); @@ -88,8 +108,8 @@ Handle StatWatcher::Start(const Arguments& args) { const bool persistent = args[1]->BooleanValue(); const uint32_t interval = args[2]->Uint32Value(); - if (!persistent) uv_unref(reinterpret_cast(&wrap->watcher_)); - uv_fs_poll_start(&wrap->watcher_, Callback, *path, interval); + if (!persistent) uv_unref(reinterpret_cast(wrap->watcher_)); + uv_fs_poll_start(wrap->watcher_, Callback, *path, interval); wrap->Ref(); return Undefined(); @@ -109,8 +129,8 @@ Handle StatWatcher::Stop(const Arguments& args) { void StatWatcher::Stop () { - if (!uv_is_active(reinterpret_cast(&watcher_))) return; - uv_fs_poll_stop(&watcher_); + if (!uv_is_active(reinterpret_cast(watcher_))) return; + uv_fs_poll_stop(watcher_); Unref(); } diff --git a/src/node_stat_watcher.h b/src/node_stat_watcher.h index 62bbce0fc82..18afa79944f 100644 --- a/src/node_stat_watcher.h +++ b/src/node_stat_watcher.h @@ -34,13 +34,8 @@ class StatWatcher : ObjectWrap { protected: static v8::Persistent constructor_template; - StatWatcher() : ObjectWrap() { - uv_fs_poll_init(uv_default_loop(), &watcher_); - } - - ~StatWatcher() { - Stop(); - } + StatWatcher(); + virtual ~StatWatcher(); static v8::Handle New(const v8::Arguments& args); static v8::Handle Start(const v8::Arguments& args); @@ -53,7 +48,7 @@ class StatWatcher : ObjectWrap { const uv_statbuf_t* curr); void Stop(); - uv_fs_poll_t watcher_; + uv_fs_poll_t* watcher_; }; } // namespace node From d38d7bea6c08ba9b1367ebd44f9ade1154e3d04d Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 20 Aug 2012 19:13:05 +0300 Subject: [PATCH 04/35] unix: don't explicitly instantiate v8::Persistent templates These explicit instantiations were added to make MSVC happy. It turns out that some older versions of gcc and llvm now complain about duplicate symbols, so we instantiate these templates only when MSVC is used. --- src/node_object_wrap.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 62ea2444858..32d584c849a 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -29,8 +29,11 @@ // Explicitly instantiate some template classes, so we're sure they will be // present in the binary / shared object. There isn't much doubt that they will // be, but MSVC tends to complain about these things. -template class NODE_EXTERN v8::Persistent; -template class NODE_EXTERN v8::Persistent; +#ifdef _MSC_VER + template class NODE_EXTERN v8::Persistent; + template class NODE_EXTERN v8::Persistent; +#endif + namespace node { From 2d9239359db7ba8d23761ca18cef9455f812f111 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 21 Aug 2012 03:04:16 +0200 Subject: [PATCH 05/35] v8: upgrade to v3.11.10.19 --- deps/v8/build/common.gypi | 11 ++++-- deps/v8/src/code-stubs.cc | 12 +++++-- deps/v8/src/heap.h | 3 +- deps/v8/src/version.cc | 2 +- deps/v8/test/mjsunit/regress/regress-2291.js | 36 ++++++++++++++++++++ deps/v8/tools/gyp/v8.gyp | 3 -- 6 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-2291.js diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index 16091978763..7f084b8c1db 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -239,6 +239,7 @@ 'WIN32', ], 'msvs_configuration_attributes': { + 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', 'CharacterSet': '1', }, @@ -270,7 +271,7 @@ 'target_conditions': [ ['_toolset=="host"', { 'variables': { - 'm32flag': ' /dev/null 2>&1) && echo "-m32" || true)', + 'm32flag': ' /dev/null 2>&1) && echo -n "-m32" || true)', }, 'cflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ], @@ -280,7 +281,7 @@ }], ['_toolset=="target"', { 'variables': { - 'm32flag': ' /dev/null 2>&1) && echo "-m32" || true)', + 'm32flag': ' /dev/null 2>&1) && echo -n "-m32" || true)', }, 'cflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ], @@ -323,7 +324,7 @@ }, 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wno-unused-parameter', + 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], }], ], @@ -332,6 +333,10 @@ 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="android"', { + 'cflags!': [ + '-O2', + '-Os', + ], 'cflags': [ '-fdata-sections', '-ffunction-sections', diff --git a/deps/v8/src/code-stubs.cc b/deps/v8/src/code-stubs.cc index 8f316606c20..7d4f23ce942 100644 --- a/deps/v8/src/code-stubs.cc +++ b/deps/v8/src/code-stubs.cc @@ -172,7 +172,9 @@ void ICCompareStub::AddToSpecialCache(Handle new_object) { Isolate* isolate = new_object->GetIsolate(); Factory* factory = isolate->factory(); return Map::UpdateCodeCache(known_map_, - factory->compare_ic_symbol(), + strict() ? + factory->strict_compare_ic_symbol() : + factory->compare_ic_symbol(), new_object); } @@ -183,10 +185,16 @@ bool ICCompareStub::FindCodeInSpecialCache(Code** code_out) { Code::Flags flags = Code::ComputeFlags( static_cast(GetCodeKind()), UNINITIALIZED); + ASSERT(op_ == Token::EQ || op_ == Token::EQ_STRICT); Handle probe( - known_map_->FindInCodeCache(*factory->compare_ic_symbol(), flags)); + known_map_->FindInCodeCache( + strict() ? + *factory->strict_compare_ic_symbol() : + *factory->compare_ic_symbol(), + flags)); if (probe->IsCode()) { *code_out = Code::cast(*probe); + ASSERT(op_ == (*code_out)->compare_operation()); return true; } return false; diff --git a/deps/v8/src/heap.h b/deps/v8/src/heap.h index dd1f710b252..f80f2a7804c 100644 --- a/deps/v8/src/heap.h +++ b/deps/v8/src/heap.h @@ -240,7 +240,8 @@ namespace internal { V(use_strict, "use strict") \ V(dot_symbol, ".") \ V(anonymous_function_symbol, "(anonymous function)") \ - V(compare_ic_symbol, ".compare_ic") \ + V(compare_ic_symbol, "==") \ + V(strict_compare_ic_symbol, "===") \ V(infinity_symbol, "Infinity") \ V(minus_infinity_symbol, "-Infinity") \ V(hidden_stack_trace_symbol, "v8::hidden_stack_trace") \ diff --git a/deps/v8/src/version.cc b/deps/v8/src/version.cc index f6afc47ccad..2da80cc678f 100644 --- a/deps/v8/src/version.cc +++ b/deps/v8/src/version.cc @@ -35,7 +35,7 @@ #define MAJOR_VERSION 3 #define MINOR_VERSION 11 #define BUILD_NUMBER 10 -#define PATCH_LEVEL 18 +#define PATCH_LEVEL 19 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) #define IS_CANDIDATE_VERSION 0 diff --git a/deps/v8/test/mjsunit/regress/regress-2291.js b/deps/v8/test/mjsunit/regress/regress-2291.js new file mode 100644 index 00000000000..96627fc6f0b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-2291.js @@ -0,0 +1,36 @@ +// Copyright 2012 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function StrictCompare(x) { return x === Object(x); } + +var obj = new Object(); +var obj2 = new Object(); +obj == obj; // Populate IC cache with non-strict comparison. + +StrictCompare(obj); // Set IC in StrictCompare from IC cache. + +assertFalse(StrictCompare('foo')); // Use == stub for === operation. diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index f742cc6f3cc..ea82d31814e 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -721,9 +721,6 @@ '../../src/win32-math.h', ], 'msvs_disabled_warnings': [4351, 4355, 4800], - 'direct_dependent_settings': { - 'msvs_disabled_warnings': [4351, 4355, 4800], - }, 'link_settings': { 'libraries': [ '-lwinmm.lib', '-lws2_32.lib' ], }, From ef0ca2affd9f96327c9e72497bd0c74aae5c8861 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Tue, 21 Aug 2012 03:05:25 +0200 Subject: [PATCH 06/35] v8: reapply floating patches --- deps/v8/build/common.gypi | 11 +++-------- deps/v8/tools/gyp/v8.gyp | 3 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index 7f084b8c1db..16091978763 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -239,7 +239,6 @@ 'WIN32', ], 'msvs_configuration_attributes': { - 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', 'CharacterSet': '1', }, @@ -271,7 +270,7 @@ 'target_conditions': [ ['_toolset=="host"', { 'variables': { - 'm32flag': ' /dev/null 2>&1) && echo -n "-m32" || true)', + 'm32flag': ' /dev/null 2>&1) && echo "-m32" || true)', }, 'cflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ], @@ -281,7 +280,7 @@ }], ['_toolset=="target"', { 'variables': { - 'm32flag': ' /dev/null 2>&1) && echo -n "-m32" || true)', + 'm32flag': ' /dev/null 2>&1) && echo "-m32" || true)', }, 'cflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ], @@ -324,7 +323,7 @@ }, 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd"', { - 'cflags': [ '-Wall', '<(werror)', '-W', '-Wno-unused-parameter', + 'cflags': [ '-Wno-unused-parameter', '-Wnon-virtual-dtor', '-Woverloaded-virtual' ], }], ], @@ -333,10 +332,6 @@ 'conditions': [ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="netbsd" \ or OS=="android"', { - 'cflags!': [ - '-O2', - '-Os', - ], 'cflags': [ '-fdata-sections', '-ffunction-sections', diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp index ea82d31814e..f742cc6f3cc 100644 --- a/deps/v8/tools/gyp/v8.gyp +++ b/deps/v8/tools/gyp/v8.gyp @@ -721,6 +721,9 @@ '../../src/win32-math.h', ], 'msvs_disabled_warnings': [4351, 4355, 4800], + 'direct_dependent_settings': { + 'msvs_disabled_warnings': [4351, 4355, 4800], + }, 'link_settings': { 'libraries': [ '-lwinmm.lib', '-lws2_32.lib' ], }, From 7c75ca7182872c95c798e192ed28c1c610b1024b Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 21 Aug 2012 13:44:29 +0200 Subject: [PATCH 07/35] doc: cluster: setupMaster() can be called only once --- doc/api/cluster.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/cluster.markdown b/doc/api/cluster.markdown index 0686c163a1b..de0e897326f 100644 --- a/doc/api/cluster.markdown +++ b/doc/api/cluster.markdown @@ -222,8 +222,8 @@ call `.setupMaster()` with no arguments. * `silent` {Boolean} whether or not to send output to parent's stdio. (Default=`false`) -The `setupMaster` is used to change the default 'fork' behavior. It takes -one option object argument. +`setupMaster` is used to change the default 'fork' behavior. The new settings +are effective immediately and permanently, they cannot be changed later on. Example: From badbd1af27f5f3fd07862b8ee7d0810e7ae9ef56 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Tue, 21 Aug 2012 22:27:13 +0200 Subject: [PATCH 08/35] tls: update default cipher list Update the default cipher list from RC4-SHA:AES128-SHA:AES256-SHA to ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH in order to mitigate BEAST attacks. The documentation suggested AES256-SHA but unfortunately that's a CBC cipher and therefore susceptible to attacks. Fixes #3900. --- doc/api/tls.markdown | 46 ++++++++++++++++++++++++++++---------------- lib/tls.js | 5 ++++- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/doc/api/tls.markdown b/doc/api/tls.markdown index 279a672faa1..8ac39509348 100644 --- a/doc/api/tls.markdown +++ b/doc/api/tls.markdown @@ -101,24 +101,34 @@ automatically set as a listener for the [secureConnection][] event. The - `crl` : Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List) - - `ciphers`: A string describing the ciphers to use or exclude. Consult - for - details on the format. - To mitigate [BEAST attacks] - (http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html), - it is recommended that you use this option in conjunction with the - `honorCipherOrder` option described below to prioritize the RC4 algorithm, - since it is a non-CBC cipher. A recommended cipher list follows: - `ECDHE-RSA-AES256-SHA:AES256-SHA:RC4-SHA:RC4:HIGH:!MD5:!aNULL:!EDH:!AESGCM` + - `ciphers`: A string describing the ciphers to use or exclude. - - `honorCipherOrder` : - When choosing a cipher, use the server's preferences instead of the client - preferences. - Note that if SSLv2 is used, the server will send its list of preferences - to the client, and the client chooses the cipher. - Although, this option is disabled by default, it is *recommended* that you - use this option in conjunction with the `ciphers` option to mitigate - BEAST attacks. + To mitigate [BEAST attacks] it is recommended that you use this option in + conjunction with the `honorCipherOrder` option described below to + prioritize the non-CBC cipher. + + Defaults to + `ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH`. + Consult the [OpenSSL cipher list format documentation] for details on the + format. + + `ECDHE-RSA-AES128-SHA256` and `AES128-GCM-SHA256` are used when node.js is + linked against OpenSSL 1.0.1 or newer and the client speaks TLS 1.2, RC4 is + used as a secure fallback. + + **NOTE**: Previous revisions of this section suggested `AES256-SHA` as an + acceptable cipher. Unfortunately, `AES256-SHA` is a CBC cipher and therefore + susceptible to BEAST attacks. Do *not* use it. + + - `honorCipherOrder` : When choosing a cipher, use the server's preferences + instead of the client preferences. + + Note that if SSLv2 is used, the server will send its list of preferences + to the client, and the client chooses the cipher. + + Although, this option is disabled by default, it is *recommended* that you + use this option in conjunction with the `ciphers` option to mitigate + BEAST attacks. - `requestCert`: If `true` the server will request a certificate from clients that connect and attempt to verify that certificate. Default: @@ -488,6 +498,8 @@ The string representation of the remote IP address. For example, The numeric representation of the remote port. For example, `443`. +[OpenSSL cipher list format documentation]: http://www.openssl.org/docs/apps/ciphers.html#CIPHER_LIST_FORMAT +[BEAST attacks]: http://blog.ivanristic.com/2011/10/mitigating-the-beast-attack-on-tls.html [CleartextStream]: #tls_class_tls_cleartextstream [net.Server.address()]: net.html#net_server_address ['secureConnect']: #tls_event_secureconnect diff --git a/lib/tls.js b/lib/tls.js index 71a2724e149..aaafd526d35 100644 --- a/lib/tls.js +++ b/lib/tls.js @@ -29,6 +29,9 @@ var END_OF_FILE = 42; var assert = require('assert').ok; var constants = require('constants'); +var DEFAULT_CIPHERS = 'ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:' + // TLS 1.2 + 'RC4:HIGH:!MD5:!aNULL:!EDH' // TLS 1.0 + // Allow {CLIENT_RENEG_LIMIT} client-initiated session renegotiations // every {CLIENT_RENEG_WINDOW} seconds. An error event is emitted if more // renegotations are seen. The settings are applied to all remote client @@ -1031,7 +1034,7 @@ function Server(/* [options], listener */) { passphrase: self.passphrase, cert: self.cert, ca: self.ca, - ciphers: self.ciphers || 'RC4-SHA:AES128-SHA:AES256-SHA', + ciphers: self.ciphers || DEFAULT_CIPHERS, secureProtocol: self.secureProtocol, secureOptions: self.secureOptions, crl: self.crl, From 2bcb9ab7bcd474590f109bd04c43ba8e39a90dfa Mon Sep 17 00:00:00 2001 From: isaacs Date: Tue, 21 Aug 2012 15:29:03 -0700 Subject: [PATCH 09/35] npm: Upgrade to 1.1.55 --- deps/npm/.travis.yml | 4 - deps/npm/AUTHORS | 2 + deps/npm/doc/cli/dedupe.md | 53 +++ deps/npm/doc/cli/index.md | 4 + deps/npm/html/api/bin.html | 2 +- deps/npm/html/api/bugs.html | 2 +- deps/npm/html/api/commands.html | 2 +- deps/npm/html/api/config.html | 2 +- deps/npm/html/api/deprecate.html | 2 +- deps/npm/html/api/docs.html | 2 +- deps/npm/html/api/edit.html | 2 +- deps/npm/html/api/explore.html | 2 +- deps/npm/html/api/help-search.html | 2 +- deps/npm/html/api/init.html | 2 +- deps/npm/html/api/install.html | 2 +- deps/npm/html/api/link.html | 2 +- deps/npm/html/api/load.html | 2 +- deps/npm/html/api/ls.html | 2 +- deps/npm/html/api/npm.html | 4 +- deps/npm/html/api/outdated.html | 2 +- deps/npm/html/api/owner.html | 2 +- deps/npm/html/api/pack.html | 2 +- deps/npm/html/api/prefix.html | 2 +- deps/npm/html/api/prune.html | 2 +- deps/npm/html/api/publish.html | 2 +- deps/npm/html/api/rebuild.html | 2 +- deps/npm/html/api/restart.html | 2 +- deps/npm/html/api/root.html | 2 +- deps/npm/html/api/run-script.html | 2 +- deps/npm/html/api/search.html | 2 +- deps/npm/html/api/shrinkwrap.html | 2 +- deps/npm/html/api/start.html | 2 +- deps/npm/html/api/stop.html | 2 +- deps/npm/html/api/submodule.html | 2 +- deps/npm/html/api/tag.html | 2 +- deps/npm/html/api/test.html | 2 +- deps/npm/html/api/uninstall.html | 2 +- deps/npm/html/api/unpublish.html | 2 +- deps/npm/html/api/update.html | 2 +- deps/npm/html/api/version.html | 2 +- deps/npm/html/api/view.html | 2 +- deps/npm/html/api/whoami.html | 2 +- deps/npm/html/doc/README.html | 2 +- deps/npm/html/doc/adduser.html | 2 +- deps/npm/html/doc/bin.html | 2 +- deps/npm/html/doc/bugs.html | 2 +- deps/npm/html/doc/build.html | 2 +- deps/npm/html/doc/bundle.html | 2 +- deps/npm/html/doc/cache.html | 2 +- deps/npm/html/doc/changelog.html | 2 +- deps/npm/html/doc/coding-style.html | 2 +- deps/npm/html/doc/completion.html | 2 +- deps/npm/html/doc/config.html | 2 +- deps/npm/html/doc/dedupe.html | 92 +++++ deps/npm/html/doc/deprecate.html | 2 +- deps/npm/html/doc/developers.html | 2 +- deps/npm/html/doc/disputes.html | 2 +- deps/npm/html/doc/docs.html | 2 +- deps/npm/html/doc/edit.html | 2 +- deps/npm/html/doc/explore.html | 2 +- deps/npm/html/doc/faq.html | 2 +- deps/npm/html/doc/folders.html | 2 +- deps/npm/html/doc/help-search.html | 2 +- deps/npm/html/doc/help.html | 2 +- deps/npm/html/doc/index.html | 6 +- deps/npm/html/doc/init.html | 2 +- deps/npm/html/doc/install.html | 2 +- deps/npm/html/doc/json.html | 2 +- deps/npm/html/doc/link.html | 2 +- deps/npm/html/doc/list.html | 4 +- deps/npm/html/doc/npm.html | 4 +- deps/npm/html/doc/outdated.html | 2 +- deps/npm/html/doc/owner.html | 2 +- deps/npm/html/doc/pack.html | 2 +- deps/npm/html/doc/prefix.html | 2 +- deps/npm/html/doc/prune.html | 2 +- deps/npm/html/doc/publish.html | 2 +- deps/npm/html/doc/rebuild.html | 2 +- deps/npm/html/doc/registry.html | 2 +- deps/npm/html/doc/removing-npm.html | 2 +- deps/npm/html/doc/restart.html | 2 +- deps/npm/html/doc/root.html | 2 +- deps/npm/html/doc/run-script.html | 2 +- deps/npm/html/doc/scripts.html | 2 +- deps/npm/html/doc/search.html | 2 +- deps/npm/html/doc/semver.html | 2 +- deps/npm/html/doc/shrinkwrap.html | 2 +- deps/npm/html/doc/star.html | 2 +- deps/npm/html/doc/start.html | 2 +- deps/npm/html/doc/stop.html | 2 +- deps/npm/html/doc/submodule.html | 2 +- deps/npm/html/doc/tag.html | 2 +- deps/npm/html/doc/test.html | 2 +- deps/npm/html/doc/uninstall.html | 2 +- deps/npm/html/doc/unpublish.html | 2 +- deps/npm/html/doc/update.html | 2 +- deps/npm/html/doc/version.html | 2 +- deps/npm/html/doc/view.html | 2 +- deps/npm/html/doc/whoami.html | 2 +- deps/npm/lib/dedupe.js | 334 ++++++++++++++++++ deps/npm/lib/npm.js | 44 +-- deps/npm/lib/publish.js | 15 +- deps/npm/lib/utils/error-handler.js | 6 + deps/npm/lib/utils/fetch.js | 7 +- deps/npm/lib/utils/find-prefix.js | 1 - deps/npm/lib/view.js | 2 +- deps/npm/man/man1/dedupe.1 | 90 +++++ deps/npm/man/man1/index.1 | 3 + deps/npm/man/man1/list.1 | 2 +- deps/npm/man/man1/npm.1 | 2 +- deps/npm/man/man3/npm.3 | 2 +- .../node_modules/couch-login/couch-login.js | 2 +- .../npm/node_modules/couch-login/package.json | 6 +- deps/npm/node_modules/mkdirp/.gitignore.orig | 2 - deps/npm/node_modules/mkdirp/.gitignore.rej | 5 - .../node_modules/mkdirp/examples/pow.js.orig | 6 - .../node_modules/mkdirp/examples/pow.js.rej | 19 - deps/npm/node_modules/mkdirp/index.js | 28 +- deps/npm/node_modules/mkdirp/package.json | 19 +- deps/npm/node_modules/node-gyp/addon.gypi | 3 + deps/npm/node_modules/node-gyp/lib/build.js | 6 +- .../npm/node_modules/node-gyp/lib/node-gyp.js | 1 + deps/npm/node_modules/node-gyp/package.json | 4 +- deps/npm/node_modules/node-uuid/.npmignore | 2 - deps/npm/node_modules/node-uuid/LICENSE.md | 3 - deps/npm/node_modules/node-uuid/README.md | 199 ----------- deps/npm/node_modules/node-uuid/package.json | 14 - deps/npm/node_modules/node-uuid/uuid.js | 249 ------------- .../npm-registry-client/README.md | 32 +- .../node_modules/npm-registry-client/index.js | 82 ++--- .../npm-registry-client/lib/adduser.js | 44 +-- .../npm-registry-client/lib/get.js | 24 +- .../npm-registry-client/lib/publish.js | 18 +- .../npm-registry-client/lib/request.js | 55 +-- .../npm-registry-client/lib/star.js | 6 +- .../npm-registry-client/package.json | 9 +- .../npm-registry-client/test/retries.js | 6 +- deps/npm/node_modules/npmconf/npmconf.js | 18 +- deps/npm/node_modules/npmconf/package.json | 8 +- .../node_modules/read-installed/package.json | 6 +- .../read-installed/read-installed.js | 2 + .../read-package-json/package.json | 6 +- .../read-package-json/read-json.js | 2 +- deps/npm/node_modules/read/README.md | 15 + deps/npm/node_modules/read/lib/read.js | 15 +- .../read/node_modules/mute-stream/mute.js | 15 + .../node_modules/mute-stream/package.json | 7 +- .../node_modules/mute-stream/test/basic.js | 12 + deps/npm/node_modules/read/package.json | 8 +- deps/npm/node_modules/read/test/basic.js | 7 +- deps/npm/node_modules/read/test/defaults.js | 7 +- deps/npm/node_modules/read/test/many.js | 7 +- deps/npm/node_modules/request/README.md | 2 +- deps/npm/node_modules/request/aws2.js | 128 ------- deps/npm/node_modules/request/main.js | 148 +++++++- deps/npm/node_modules/request/package.json | 6 +- deps/npm/node_modules/request/tests/server.js | 14 +- .../node_modules/request/tests/test-body.js | 39 +- .../request/tests/test-defaults.js | 35 +- .../request/tests/test-follow-all-303.js | 30 ++ .../request/tests/test-follow-all.js | 35 ++ .../request/tests/test-https-strict.js | 6 +- .../node_modules/request/tests/test-https.js | 6 +- .../node_modules/request/tests/test-params.js | 6 +- .../tests/test-protocol-changing-redirect.js | 60 ++++ .../npm/node_modules/request/tests/test-s3.js | 13 - .../node_modules/request/tests/test-tunnel.js | 6 +- deps/npm/node_modules/request/tunnel.js | 1 + deps/npm/package.json | 10 +- deps/npm/test/tap/publish-config.js | 41 +++ 170 files changed, 1376 insertions(+), 1050 deletions(-) delete mode 100644 deps/npm/.travis.yml create mode 100644 deps/npm/doc/cli/dedupe.md create mode 100644 deps/npm/html/doc/dedupe.html create mode 100644 deps/npm/lib/dedupe.js create mode 100644 deps/npm/man/man1/dedupe.1 delete mode 100644 deps/npm/node_modules/mkdirp/.gitignore.orig delete mode 100644 deps/npm/node_modules/mkdirp/.gitignore.rej delete mode 100644 deps/npm/node_modules/mkdirp/examples/pow.js.orig delete mode 100644 deps/npm/node_modules/mkdirp/examples/pow.js.rej delete mode 100644 deps/npm/node_modules/node-uuid/.npmignore delete mode 100644 deps/npm/node_modules/node-uuid/LICENSE.md delete mode 100644 deps/npm/node_modules/node-uuid/README.md delete mode 100644 deps/npm/node_modules/node-uuid/package.json delete mode 100644 deps/npm/node_modules/node-uuid/uuid.js delete mode 100644 deps/npm/node_modules/request/aws2.js create mode 100644 deps/npm/node_modules/request/tests/test-follow-all-303.js create mode 100644 deps/npm/node_modules/request/tests/test-follow-all.js create mode 100644 deps/npm/node_modules/request/tests/test-protocol-changing-redirect.js delete mode 100644 deps/npm/node_modules/request/tests/test-s3.js create mode 100644 deps/npm/test/tap/publish-config.js diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml deleted file mode 100644 index a385519bd15..00000000000 --- a/deps/npm/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -before_install: "make &>out || cat out; rm out" -node_js: - - 0.8 diff --git a/deps/npm/AUTHORS b/deps/npm/AUTHORS index 57fdf6afa89..d1306adb7da 100644 --- a/deps/npm/AUTHORS +++ b/deps/npm/AUTHORS @@ -75,3 +75,5 @@ Don Park Kei Son Nicolas Morel Mark Dube +Maxim Bogushevich +Justin Beckwith diff --git a/deps/npm/doc/cli/dedupe.md b/deps/npm/doc/cli/dedupe.md new file mode 100644 index 00000000000..220329acb8c --- /dev/null +++ b/deps/npm/doc/cli/dedupe.md @@ -0,0 +1,53 @@ +npm-dedupe(1) -- Reduce duplication +=================================== + +## SYNOPSIS + + npm dedupe [package names...] + +## DESCRIPTION + +Searches the local package tree and attempts to simplify the overall +structure by moving dependencies further up the tree, where they can +be more effectively shared by multiple dependent packages. + +For example, consider this dependency graph: + + a + +-- b <-- depends on c@1.0.x + | `-- c@1.0.3 + `-- d <-- depends on c@~1.0.9 + `-- c@1.0.10 + +In this case, `npm-dedupe(1)` will transform the tree to: + + a + +-- b + +-- d + `-- c@1.0.10 + +Because of the hierarchical nature of node's module lookup, b and d +will both get their dependency met by the single c package at the root +level of the tree. + +If a suitable version exists at the target location in the tree +already, then it will be left untouched, but the other duplicates will +be deleted. + +If no suitable version can be found, then a warning is printed, and +nothing is done. + +If any arguments are supplied, then they are filters, and only the +named packages will be touched. + +Note that this operation transforms the dependency tree, and may +result in packages getting updated versions, perhaps from the npm +registry. + +This feature is experimental, and may change in future versions. + +## SEE ALSO + +* npm-ls(1) +* npm-update(1) +* npm-install(1) diff --git a/deps/npm/doc/cli/index.md b/deps/npm/doc/cli/index.md index ee88f3d8f37..b2ffd131797 100644 --- a/deps/npm/doc/cli/index.md +++ b/deps/npm/doc/cli/index.md @@ -46,6 +46,10 @@ npm-index(1) -- Index of all npm documentation Manage the npm configuration file +## npm-dedupe(1) + + Reduce duplication + ## npm-deprecate(1) Deprecate a version of a package diff --git a/deps/npm/html/api/bin.html b/deps/npm/html/api/bin.html index d3650c27777..8aa2d9572c8 100644 --- a/deps/npm/html/api/bin.html +++ b/deps/npm/html/api/bin.html @@ -19,7 +19,7 @@

This function should not be used programmatically. Instead, just refer to the npm.bin member.

- + + diff --git a/deps/npm/html/doc/deprecate.html b/deps/npm/html/doc/deprecate.html index 68f7d3013e9..b21e768a5c3 100644 --- a/deps/npm/html/doc/deprecate.html +++ b/deps/npm/html/doc/deprecate.html @@ -29,7 +29,7 @@ something like this:

- + -``` - -Or in node.js: - -``` -npm install node-uuid -``` - -```javascript -var uuid = require('node-uuid'); -``` - -Then create some ids ... - -```javascript -// Generate a v1 (time-based) id -uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' - -// Generate a v4 (random) id -uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1' -``` - -## API - -### uuid.v1([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v1 (timestamp-based) UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomnly generated ID. See note 1. - * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. - * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used. - * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Notes: - -1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date('2011-11-01').getTime(), - nsecs: 5678 -}); // -> "710b962e-041c-11e1-9234-0123456789ab" -``` - -Example: In-place generation of two binary IDs - -```javascript -// Generate two ids in an array -var arr = new Array(32); // -> [] -uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15] -uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15] - -// Optionally use uuid.unparse() to get stringify the ids -uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115' -uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115' -``` - -### uuid.v4([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v4 UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values - * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v4({ - random: [ - 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, - 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 - ] -}); -// -> "109156be-c4fb-41ea-b1b4-efe1671c5836" -``` - -Example: Generate two IDs in a single buffer - -```javascript -var buffer = new Array(32); // (or 'new Buffer' in node.js) -uuid.v4(null, buffer, 0); -uuid.v4(null, buffer, 16); -``` - -### uuid.parse(id[, buffer[, offset]]) -### uuid.unparse(buffer[, offset]) - -Parse and unparse UUIDs - - * `id` - (String) UUID(-like) string - * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used - * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0 - -Example parsing and unparsing a UUID string - -```javascript -var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> -var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10' -``` - -### uuid.noConflict() - -(Browsers only) Set `uuid` property back to it's previous value. - -Returns the node-uuid object. - -Example: - -```javascript -var myUuid = uuid.noConflict(); -myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' -``` - -## Deprecated APIs - -Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version. - -### uuid([format [, buffer [, offset]]]) - -uuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary). - -### uuid.BufferClass - -The class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API. - -## Testing - -In node.js - -``` -> cd test -> node uuid.js -``` - -In Browser - -``` -open test/test.html -``` - -### Benchmarking - -Requires node.js - -``` -npm install uuid uuid-js -node test/benchmark.js -``` - -For a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark) - -For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance). - -## Release notes - -v1.3.2: -* Improve tests and handling of v1() options (Issue #24) -* Expose RNG option to allow for perf testing with different generators - -v1.3: -* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! -* Support for node.js crypto API -* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code diff --git a/deps/npm/node_modules/node-uuid/package.json b/deps/npm/node_modules/node-uuid/package.json deleted file mode 100644 index 9df0da985d0..00000000000 --- a/deps/npm/node_modules/node-uuid/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name" : "node-uuid", - "description" : "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", - "url" : "http://github.com/broofa/node-uuid", - "keywords" : ["uuid", "guid", "rfc4122"], - "author" : "Robert Kieffer ", - "contributors" : [ - {"name": "Christoph Tavan ", "github": "https://github.com/ctavan"} - ], - "dependencies" : {}, - "lib" : ".", - "main" : "./uuid.js", - "version" : "1.3.3" -} diff --git a/deps/npm/node_modules/node-uuid/uuid.js b/deps/npm/node_modules/node-uuid/uuid.js deleted file mode 100644 index 27f1d1272de..00000000000 --- a/deps/npm/node_modules/node-uuid/uuid.js +++ /dev/null @@ -1,249 +0,0 @@ -// node-uuid/uuid.js -// -// Copyright (c) 2010 Robert Kieffer -// Dual licensed under the MIT and GPL licenses. -// Documentation and details at https://github.com/broofa/node-uuid -(function() { - var _global = this; - - // Unique ID creation requires a high quality random # generator, but - // Math.random() does not guarantee "cryptographic quality". So we feature - // detect for more robust APIs, normalizing each method to return 128-bits - // (16 bytes) of random data. - var mathRNG, nodeRNG, whatwgRNG; - - // Math.random()-based RNG. All platforms, very fast, unknown quality - var _rndBytes = new Array(16); - mathRNG = function() { - var r, b = _rndBytes, i = 0; - - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) == 0) r = Math.random() * 0x100000000; - b[i] = r >>> ((i & 0x03) << 3) & 0xff; - } - - return b; - } - - // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto - // WebKit only (currently), moderately fast, high quality - if (_global.crypto && crypto.getRandomValues) { - var _rnds = new Uint32Array(4); - whatwgRNG = function() { - crypto.getRandomValues(_rnds); - - for (var c = 0 ; c < 16; c++) { - _rndBytes[c] = _rnds[c >> 2] >>> ((c & 0x03) * 8) & 0xff; - } - return _rndBytes; - } - } - - // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html - // Node.js only, moderately fast, high quality - try { - var _rb = require('crypto').randomBytes; - nodeRNG = _rb && function() { - return _rb(16); - }; - } catch (e) {} - - // Select RNG with best quality - var _rng = nodeRNG || whatwgRNG || mathRNG; - - // Buffer class to use - var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array; - - // Maps for number <-> hex string conversion - var _byteToHex = []; - var _hexToByte = {}; - for (var i = 0; i < 256; i++) { - _byteToHex[i] = (i + 0x100).toString(16).substr(1); - _hexToByte[_byteToHex[i]] = i; - } - - // **`parse()` - Parse a UUID into it's component bytes** - function parse(s, buf, offset) { - var i = (buf && offset) || 0, ii = 0; - - buf = buf || []; - s.toLowerCase().replace(/[0-9a-f]{2}/g, function(byte) { - if (ii < 16) { // Don't overflow! - buf[i + ii++] = _hexToByte[byte]; - } - }); - - // Zero out remaining bytes if string was short - while (ii < 16) { - buf[i + ii++] = 0; - } - - return buf; - } - - // **`unparse()` - Convert UUID byte array (ala parse()) into a string** - function unparse(buf, offset) { - var i = offset || 0, bth = _byteToHex; - return bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]]; - } - - // **`v1()` - Generate time-based UUID** - // - // Inspired by https://github.com/LiosK/UUID.js - // and http://docs.python.org/library/uuid.html - - // random #'s we need to init node and clockseq - var _seedBytes = _rng(); - - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - var _nodeId = [ - _seedBytes[0] | 0x01, - _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] - ]; - - // Per 4.2.2, randomize (14 bit) clockseq - var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; - - // Previous uuid creation time - var _lastMSecs = 0, _lastNSecs = 0; - - // See https://github.com/broofa/node-uuid for API details - function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - - options = options || {}; - - var clockseq = options.clockseq != null ? options.clockseq : _clockseq; - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = options.msecs != null ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) - var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq == null) { - clockseq = clockseq + 1 & 0x3fff; - } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) { - nsecs = 0; - } - - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; - - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; - - // `time_mid` - var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; - - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` - b[i++] = clockseq & 0xff; - - // `node` - var node = options.node || _nodeId; - for (var n = 0; n < 6; n++) { - b[i + n] = node[n]; - } - - return buf ? buf : unparse(b); - } - - // **`v4()` - Generate random UUID** - - // See https://github.com/broofa/node-uuid for API details - function v4(options, buf, offset) { - // Deprecated - 'format' argument, as supported in v1.2 - var i = buf && offset || 0; - - if (typeof(options) == 'string') { - buf = options == 'binary' ? new BufferClass(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || _rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ii++) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || unparse(rnds); - } - - // Export public API - var uuid = v4; - uuid.v1 = v1; - uuid.v4 = v4; - uuid.parse = parse; - uuid.unparse = unparse; - uuid.BufferClass = BufferClass; - - // Export RNG options - uuid.mathRNG = mathRNG; - uuid.nodeRNG = nodeRNG; - uuid.whatwgRNG = whatwgRNG; - - if (typeof(module) != 'undefined') { - // Play nice with node.js - module.exports = uuid; - } else { - // Play nice with browsers - var _previousRoot = _global.uuid; - - // **`noConflict()` - (browser only) to reset global 'uuid' var** - uuid.noConflict = function() { - _global.uuid = _previousRoot; - return uuid; - } - _global.uuid = uuid; - } -}()); diff --git a/deps/npm/node_modules/npm-registry-client/README.md b/deps/npm/node_modules/npm-registry-client/README.md index dbeb94422b4..4b180a02999 100644 --- a/deps/npm/node_modules/npm-registry-client/README.md +++ b/deps/npm/node_modules/npm-registry-client/README.md @@ -8,7 +8,7 @@ It handles all the caching and HTTP calls. ```javascript var RegClient = require('npm-registry-client') -var client = new RegClient(options) +var client = new RegClient(config) client.get("npm", "latest", 1000, function (er, data, raw, res) { // error is an error if there was a problem. @@ -18,29 +18,43 @@ client.get("npm", "latest", 1000, function (er, data, raw, res) { }) ``` -# Options +# Configuration + +This program is designed to work with +[npmconf](https://npmjs.org/package/npmconf), but you can also pass in +a plain-jane object with the appropriate configs, and it'll shim it +for you. Any configuration thingie that has get/set/del methods will +also be accepted. * `registry` **Required** {String} URL to the registry * `cache` **Required** {String} Path to the cache folder -* `alwaysAuth` {Boolean} Auth even for GET requests. +* `always-auth` {Boolean} Auth even for GET requests. * `auth` {String} A base64-encoded `username:password` * `email` {String} User's email address * `tag` {String} The default tag to use when publishing new packages. Default = `"latest"` * `ca` {String} Cerficate signing authority certificates to trust. -* `strictSSL` {Boolean} Whether or not to be strict with SSL +* `strict-ssl` {Boolean} Whether or not to be strict with SSL certificates. Default = `true` -* `userAgent` {String} User agent header to send. Default = +* `user-agent` {String} User agent header to send. Default = `"node/{process.version}"` * `log` {Object} The logger to use. Defaults to `require("npmlog")` if that works, otherwise logs are disabled. -* `retries` {Number} Number of times to retry on GET failures. +* `fetch-retries` {Number} Number of times to retry on GET failures. Default=2 -* `retryFactor` {Number} `factor` setting for `node-retry`. Default=10 -* `retryMinTimeout` {Number} `minTimeout` setting for `node-retry`. +* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10 +* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`. Default=10000 (10 seconds) -* `retryMaxTimeout` {Number} `maxTimeout` setting for `node-retry`. +* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`. Default=60000 (60 seconds) +* `proxy` {URL} The url to proxy requests through. +* `https-proxy` {URL} The url to proxy https requests through. + Defaults to be the same as `proxy` if unset. +* `_auth` {String} The base64-encoded authorization header. +* `username` `_password` {String} Username/password to use to generate + `_auth` if not supplied. +* `_token` {Object} A token for use with + [couch-login](https://npmjs.org/package/couch-login) # client.request(method, where, [what], [etag], [nofollow], cb) diff --git a/deps/npm/node_modules/npm-registry-client/index.js b/deps/npm/node_modules/npm-registry-client/index.js index 377f787f4ea..8d321b86992 100644 --- a/deps/npm/node_modules/npm-registry-client/index.js +++ b/deps/npm/node_modules/npm-registry-client/index.js @@ -19,78 +19,48 @@ try { function noop () {} -function RegClient (options) { +function RegClient (conf) { + // accept either a plain-jane object, or a npmconf object + // with a "get" method. + if (typeof conf.get !== 'function') { + var data = conf + conf = { get: function (k) { return data[k] } + , set: function (k, v) { data[k] = v } + , del: function (k) { delete data[k] } } + } + + this.conf = conf + // if provided, then the registry needs to be a url. // if it's not provided, then we're just using the cache only. - var registry = options.registry + var registry = conf.get('registry') if (registry) { registry = url.parse(registry) if (!registry.protocol) throw new Error( 'Invalid registry: ' + registry.url) - this.registry = registry.href - if (this.registry.slice(-1) !== '/') { - this.registry += '/' + registry = registry.href + if (registry.slice(-1) !== '/') { + registry += '/' } + this.conf.set('registry', registry) } else { - this.registry = null + registry = null } - this.retries = options.retries || 2 - this.retryFactor = options.retryFactor || 10 - this.retryMinTimeout = options.retryMinTimeout || 10000 - this.retryMaxTimeout = options.retryMaxTimeout || 60000 + if (!conf.get('cache')) throw new Error("Cache dir is required") - this.cache = options.cache - if (!this.cache) throw new Error("Cache dir is required") - - this.alwaysAuth = options.alwaysAuth || false - - this.auth = options.auth || null - if (this.auth) { - var a = new Buffer(this.auth, "base64").toString() - a = a.split(":") - this.username = a.shift() - this.password = a.join(":") - } else { - this.username = options.username - this.password = options.password - - // if username and password are set, but auth isn't, use them. - if (this.username && this.password) { - var a = this.username + ":" + this.password - this.auth = new Buffer(a, "utf8").toString("base64") - } - } - - if (this.auth && !this.alwaysAuth && this.registry) { + var auth = this.conf.get('_auth') + var alwaysAuth = this.conf.get('always-auth') + if (auth && !alwaysAuth && registry) { // if we're always authing, then we just send the // user/pass on every thing. otherwise, create a // session, and use that. - this.token = options.token - this.couchLogin = new CouchLogin(this.registry, this.token) - this.couchLogin.proxy = this.proxy + var token = this.conf.get('_token') + this.couchLogin = new CouchLogin(registry, token) + this.couchLogin.proxy = this.conf.get('proxy') } - this.email = options.email || null - this.defaultTag = options.tag || "latest" - - this.ca = options.ca || null - - this.strictSSL = options.strictSSL - if (this.strictSSL === undefined) this.strictSSL = true - - this.userAgent = options.userAgent - if (this.userAgent === undefined) { - this.userAgent = 'node/' + process.version - } - - this.cacheMin = options.cacheMin || 0 - this.cacheMax = options.cacheMax || Infinity - - this.proxy = options.proxy - this.httpsProxy = options.httpsProxy || options.proxy - - this.log = options.log || npmlog + this.log = conf.log || conf.get('log') || npmlog } require('fs').readdirSync(__dirname + "/lib").forEach(function (f) { diff --git a/deps/npm/node_modules/npm-registry-client/lib/adduser.js b/deps/npm/node_modules/npm-registry-client/lib/adduser.js index f940ca1ca5e..7106e444d7e 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/adduser.js +++ b/deps/npm/node_modules/npm-registry-client/lib/adduser.js @@ -1,18 +1,12 @@ - module.exports = adduser -var uuid = require("node-uuid") - , crypto - -try { -} catch (ex) {} +var crypto = require('crypto') function sha (s) { return crypto.createHash("sha1").update(s).digest("hex") } function adduser (username, password, email, cb) { - if (!crypto) crypto = require("crypto") password = ("" + (password || "")).trim() if (!password) return cb(new Error("No password supplied.")) @@ -27,7 +21,7 @@ function adduser (username, password, email, cb) { "Sorry, ':' chars are not allowed in passwords.\n"+ "See for why.")) - var salt = uuid() + var salt = crypto.randomBytes(30).toString('hex') , userobj = { name : username , salt : salt @@ -41,18 +35,18 @@ function adduser (username, password, email, cb) { // pluck off any other username/password/token. it needs to be the // same as the user we're becoming now. replace them on error. - var pre = { username: this.username - , password: this.password - , auth: this.auth - , token: this.token } + var pre = { username: this.conf.get('username') + , password: this.conf.get('_password') + , auth: this.conf.get('_auth') + , token: this.conf.get('_token') } - this.token = null + this.conf.del('_token') + this.conf.del('username') + this.conf.del('_auth') + this.conf.del('_password') if (this.couchLogin) { this.couchLogin.token = null } - this.username = null - this.password = null - this.auth = null cb = done.call(this, cb, pre) @@ -72,13 +66,13 @@ function adduser (username, password, email, cb) { , function (error, data, json, response) { // if it worked, then we just created a new user, and all is well. // but if we're updating a current record, then it'll 409 first - if (error && !this.auth) { + if (error && !this.conf.get('_auth')) { // must be trying to re-auth on a new machine. // use this info as auth var b = new Buffer(username + ":" + password) - this.auth = b.toString("base64") - this.username = username - this.password = password + this.conf.set('_auth', b.toString("base64")) + this.conf.set('username', username) + this.conf.set('_password', password) } if (!error || !response || response.statusCode !== 409) { @@ -114,16 +108,16 @@ function done (cb, pre) { } // there was some kind of error, re-instate previous auth/token/etc. - this.token = pre.token + this.conf.set('_token', pre.token) if (this.couchLogin) { - this.couchLogin.token = this.token + this.couchLogin.token = pre.token if (this.couchLogin.tokenSet) { this.couchLogin.tokenSet(pre.token) } } - this.username = pre.username - this.password = pre.password - this.auth = pre.auth + this.conf.set('username', pre.username) + this.conf.set('_password', pre.password) + this.conf.set('_auth', pre.auth) this.log.verbose("adduser", "back", [error, data, json]) if (!error) { diff --git a/deps/npm/node_modules/npm-registry-client/lib/get.js b/deps/npm/node_modules/npm-registry-client/lib/get.js index 835eb4ce516..584a986b580 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/get.js +++ b/deps/npm/node_modules/npm-registry-client/lib/get.js @@ -12,10 +12,10 @@ function get (uri, timeout, nofollow, staleOk, cb) { if (typeof cb !== "function") cb = timeout, timeout = -1 if (typeof cb !== "function") cb = version, version = null - timeout = Math.min(timeout, this.cacheMax) - timeout = Math.max(timeout, this.cacheMin) + timeout = Math.min(timeout, this.conf.get('cache-max') || 0) + timeout = Math.max(timeout, this.conf.get('cache-min') || Infinity) - if (!this.registry) timeout = Infinity + if (!this.conf.get('registry')) timeout = Infinity if ( process.env.COMP_CWORD !== undefined && process.env.COMP_LINE !== undefined @@ -29,7 +29,7 @@ function get (uri, timeout, nofollow, staleOk, cb) { return requestAll.call(this, cb) } - var cache = path.join(this.cache, uri, ".cache.json") + var cache = path.join(this.conf.get('cache'), uri, ".cache.json") fs.stat(cache, function (er, stat) { if (!er) fs.readFile(cache, function (er, data) { try { data = JSON.parse(data) } @@ -41,9 +41,9 @@ function get (uri, timeout, nofollow, staleOk, cb) { } function requestAll (cb) { - var cache = path.join(this.cache, "/-/all", ".cache.json") + var cache = path.join(this.conf.get('cache'), "/-/all", ".cache.json") - mkdir(path.join(this.cache, "-", "all"), function (er) { + mkdir(path.join(this.conf.get('cache'), "-", "all"), function (er) { fs.readFile(cache, function (er, data) { if (er) return requestAll_.call(this, 0, {}, cb) try { @@ -74,7 +74,7 @@ function requestAll_ (c, data, cb) { uri = "/-/all" } - var cache = path.join(this.cache, "-/all", ".cache.json") + var cache = path.join(this.conf.get('cache'), "-/all", ".cache.json") this.request('GET', uri, function (er, updates, _, res) { if (er) return cb(er, data) var headers = res.headers @@ -143,20 +143,20 @@ function get_ (uri, timeout, cache, stat, data, nofollow, staleOk, cb) { } function saveToCache (cache, data, saved) { - if (this.cacheStat) { - var cs = this.cacheStat + if (this._cacheStat) { + var cs = this._cacheStat return saveToCache_.call(this, cache, data, cs.uid, cs.gid, saved) } - fs.stat(this.cache, function (er, st) { + fs.stat(this.conf.get('cache'), function (er, st) { if (er) { return fs.stat(process.env.HOME || "", function (er, st) { // if this fails, oh well. if (er) return saved() - this.cacheStat = st + this._cacheStat = st return saveToCache.call(this, cache, data, saved) }.bind(this)) } - this.cacheStat = st || { uid: null, gid: null } + this._cacheStat = st || { uid: null, gid: null } return saveToCache.call(this, cache, data, saved) }.bind(this)) } diff --git a/deps/npm/node_modules/npm-registry-client/lib/publish.js b/deps/npm/node_modules/npm-registry-client/lib/publish.js index 11aa599e617..b44b801b3a8 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/publish.js +++ b/deps/npm/node_modules/npm-registry-client/lib/publish.js @@ -6,8 +6,14 @@ var path = require("path") function publish (data, tarball, cb) { - if (!this.email || !this.auth || !this.username) { - return cb(new Error("auth and email required for publishing")) + var email = this.conf.get('email') + var auth = this.conf.get('_auth') + var username = this.conf.get('username') + + if (!email || !auth || !username) { + var er = new Error("auth and email required for publishing") + er.code = 'ENEEDAUTH' + return cb(er) } // add the dist-url to the data, pointing at the tarball. @@ -15,7 +21,7 @@ function publish (data, tarball, cb) { // if the {version} is already there, then fail. // then: // PUT the data to {config.registry}/{data.name}/{data.version} - var registry = this.registry + var registry = this.conf.get('registry') var fullData = { _id : data.name @@ -25,8 +31,8 @@ function publish (data, tarball, cb) { , versions : {} , readme: data.readme || "" , maintainers : - [ { name : this.username - , email : this.email + [ { name : username + , email : email } ] } @@ -58,7 +64,7 @@ function publish (data, tarball, cb) { var dataURI = encodeURIComponent(data.name) + "/" + encodeURIComponent(data.version) - var tag = data.tag || this.defaultTag || "latest" + var tag = data.tag || this.conf.get('tag') || "latest" dataURI += "/-tag/" + tag // let's see what versions are already published. diff --git a/deps/npm/node_modules/npm-registry-client/lib/request.js b/deps/npm/node_modules/npm-registry-client/lib/request.js index 486226a7126..8d90572c668 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/request.js +++ b/deps/npm/node_modules/npm-registry-client/lib/request.js @@ -13,7 +13,8 @@ function regRequest (method, where, what, etag, nofollow, cb_) { if (typeof cb_ !== "function") cb_ = etag, etag = null if (typeof cb_ !== "function") cb_ = what, what = null - if (!this.registry) return cb(new Error( + var registry = this.conf.get('registry') + if (!registry) return cb(new Error( "No registry url provided: " + method + " " + where)) // Since there are multiple places where an error could occur, @@ -29,13 +30,11 @@ function regRequest (method, where, what, etag, nofollow, cb_) { return cb(new Error("favicon.ico isn't a package, it's a picture.")) } - var registry = this.registry - var adduserChange = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)\/-rev/ , adduserNew = /^\/?-\/user\/org\.couchdb\.user:([^\/]+)/ , nu = where.match(adduserNew) , uc = where.match(adduserChange) - , isUpload = what || this.alwaysAuth + , isUpload = what || this.conf.get('always-auth') , isDel = method === "DELETE" , authRequired = isUpload && !nu || uc || isDel @@ -62,27 +61,30 @@ function regRequest (method, where, what, etag, nofollow, cb_) { } var remote = url.parse(where) - , auth = this.auth + , auth = this.conf.get('_auth') - if (authRequired && !this.alwaysAuth) { + if (authRequired && !this.conf.get('always-auth')) { var couch = this.couchLogin - , token = couch && (this.token || couch.token) + , token = couch && (this.conf.get('_token') || couch.token) , validToken = token && couch.valid(token) if (!validToken) token = null - else this.token = token + else this.conf.set('_token', token) if (couch && !token) { // login to get a valid token - var a = { name: this.username, password: this.password } + var a = { name: this.conf.get('username'), + password: this.conf.get('_password') } var args = arguments return this.couchLogin.login(a, function (er, cr, data) { if (er || !couch.valid(couch.token)) { er = er || new Error('login error') return cb(er, cr, data) } - this.token = this.couchLogin.token - return regRequest.call(this, method, where, what, etag, nofollow, cb_) + this.conf.set('_token', this.couchLogin.token) + return regRequest.call(this, + method, where, what, + etag, nofollow, cb_) }.bind(this)) } } @@ -101,11 +103,12 @@ function regRequest (method, where, what, etag, nofollow, cb_) { // Tuned to spread 3 attempts over about a minute. // See formula at . var operation = retry.operation({ - retries: this.retries, - factor: this.retryFactor, - minTimeout: this.retryMinTimeout, - maxTimeout: this.retryMaxTimeout + retries: this.conf.get('fetch-retries') || 2, + factor: this.conf.get('fetch-retry-factor'), + minTimeout: this.conf.get('fetch-retry-mintimeout') || 10000, + maxTimeout: this.conf.get('fetch-retry-maxtimeout') || 60000 }) + var self = this operation.attempt(function (currentAttempt) { self.log.info("retry", "registry request attempt " + currentAttempt @@ -118,8 +121,8 @@ function regRequest (method, where, what, etag, nofollow, cb_) { var timeout = statusCode === 408 var serverError = statusCode >= 500 var statusRetry = !statusCode || timeout || serverError - if (reauth && this.auth && this.token) { - this.token = null + if (reauth && this.conf.get('_auth') && this.conf.get('_token')) { + this.conf.del('_token') this.couchLogin.token = null return regRequest.call(this, method, where, what, etag, nofollow, cb_) } @@ -140,10 +143,12 @@ function makeRequest (method, remote, where, what, etag, nofollow, tok, cb_) { cb_.apply(null, arguments) } + var strict = this.conf.get('strict-ssl') + if (strict === undefined) strict = true var opts = { url: remote , method: method - , ca: this.ca - , strictSSL: this.strictSSL } + , ca: this.conf.get('ca') + , strictSSL: strict } , headers = opts.headers = {} if (etag) { this.log.verbose("etag", etag) @@ -156,10 +161,12 @@ function makeRequest (method, remote, where, what, etag, nofollow, tok, cb_) { headers.accept = "application/json" - headers["user-agent"] = this.userAgent + headers["user-agent"] = this.conf.get('user-agent') || + 'node/' + process.version - opts.proxy = remote.protocol === "https:" - ? this.httpsProxy : this.proxy + var p = this.conf.get('proxy') + var sp = this.conf.get('https-proxy') || p + opts.proxy = remote.protocol === "https:" ? sp : p // figure out wth 'what' is if (what) { @@ -259,7 +266,7 @@ function requestDone (method, where, cb) { , caches = p.map(function (part) { return _ = path.join(_, part) }).map(function (cache) { - return path.join(this.cache, cache, ".cache.json") + return path.join(this.conf.get('cache'), cache, ".cache.json") }, this) // if the method is DELETE, then also remove the thing itself. @@ -267,7 +274,7 @@ function requestDone (method, where, cb) { // That's what you get for deleting stuff. Don't do that. if (method === "DELETE") { p = p.slice(0, p.indexOf("-rev")) - caches.push(path.join(this.cache, p.join("/"))) + caches.push(path.join(this.conf.get('cache'), p.join("/"))) } asyncMap(caches, rm, function () {}) diff --git a/deps/npm/node_modules/npm-registry-client/lib/star.js b/deps/npm/node_modules/npm-registry-client/lib/star.js index 36a66127e50..5b7ab4afe90 100644 --- a/deps/npm/node_modules/npm-registry-client/lib/star.js +++ b/deps/npm/node_modules/npm-registry-client/lib/star.js @@ -2,7 +2,7 @@ module.exports = star function star (package, starred, cb) { - if (!this.username) return cb(new Error( + if (!this.conf.get('username')) return cb(new Error( "Must be logged in to star/unstar packages")) var users = {} @@ -16,10 +16,10 @@ function star (package, starred, cb) { if (starred) { this.log.info("starring", fullData._id) - fullData.users[this.username] = true + fullData.users[this.conf.get('username')] = true this.log.verbose("starring", fullData) } else { - delete fullData.users[this.username] + delete fullData.users[this.conf.get('username')] this.log.info("unstarring", fullData._id) this.log.verbose("unstarring", fullData) } diff --git a/deps/npm/node_modules/npm-registry-client/package.json b/deps/npm/node_modules/npm-registry-client/package.json index 709027af4cb..7ee3487908d 100644 --- a/deps/npm/node_modules/npm-registry-client/package.json +++ b/deps/npm/node_modules/npm-registry-client/package.json @@ -6,7 +6,7 @@ }, "name": "npm-registry-client", "description": "Client for the npm registry", - "version": "0.1.4", + "version": "0.2.5", "repository": { "url": "git://github.com/isaacs/npm-registry-client" }, @@ -15,7 +15,6 @@ "test": "tap test/*.js" }, "dependencies": { - "node-uuid": "~1.3.3", "request": "~2.9.202", "graceful-fs": "~1.1.8", "semver": "~1.0.14", @@ -34,7 +33,7 @@ "npmlog": "" }, "license": "BSD", - "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(options)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Options\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `alwaysAuth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strictSSL` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `userAgent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `retryFactor` {Number} `factor` setting for `node-retry`. Default=10\n* `retryMinTimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `retryMaxTimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n", - "_id": "npm-registry-client@0.1.4", - "_from": "npm-registry-client@latest" + "readme": "# npm-registry-client\n\nThe code that npm uses to talk to the registry.\n\nIt handles all the caching and HTTP calls.\n\n## Usage\n\n```javascript\nvar RegClient = require('npm-registry-client')\nvar client = new RegClient(config)\n\nclient.get(\"npm\", \"latest\", 1000, function (er, data, raw, res) {\n // error is an error if there was a problem.\n // data is the parsed data object\n // raw is the json string\n // res is the response from couch\n})\n```\n\n# Configuration\n\nThis program is designed to work with\n[npmconf](https://npmjs.org/package/npmconf), but you can also pass in\na plain-jane object with the appropriate configs, and it'll shim it\nfor you. Any configuration thingie that has get/set/del methods will\nalso be accepted.\n\n* `registry` **Required** {String} URL to the registry\n* `cache` **Required** {String} Path to the cache folder\n* `always-auth` {Boolean} Auth even for GET requests.\n* `auth` {String} A base64-encoded `username:password`\n* `email` {String} User's email address\n* `tag` {String} The default tag to use when publishing new packages.\n Default = `\"latest\"`\n* `ca` {String} Cerficate signing authority certificates to trust.\n* `strict-ssl` {Boolean} Whether or not to be strict with SSL\n certificates. Default = `true`\n* `user-agent` {String} User agent header to send. Default =\n `\"node/{process.version}\"`\n* `log` {Object} The logger to use. Defaults to `require(\"npmlog\")` if\n that works, otherwise logs are disabled.\n* `fetch-retries` {Number} Number of times to retry on GET failures.\n Default=2\n* `fetch-retry-factor` {Number} `factor` setting for `node-retry`. Default=10\n* `fetch-retry-mintimeout` {Number} `minTimeout` setting for `node-retry`.\n Default=10000 (10 seconds)\n* `fetch-retry-maxtimeout` {Number} `maxTimeout` setting for `node-retry`.\n Default=60000 (60 seconds)\n* `proxy` {URL} The url to proxy requests through.\n* `https-proxy` {URL} The url to proxy https requests through.\n Defaults to be the same as `proxy` if unset.\n* `_auth` {String} The base64-encoded authorization header.\n* `username` `_password` {String} Username/password to use to generate\n `_auth` if not supplied.\n* `_token` {Object} A token for use with\n [couch-login](https://npmjs.org/package/couch-login)\n\n# client.request(method, where, [what], [etag], [nofollow], cb)\n\n* `method` {String} HTTP method\n* `where` {String} Path to request on the server\n* `what` {Stream | Buffer | String | Object} The request body. Objects\n that are not Buffers or Streams are encoded as JSON.\n* `etag` {String} The cached ETag\n* `nofollow` {Boolean} Prevent following 302/301 responses\n* `cb` {Function}\n * `error` {Error | null}\n * `data` {Object} the parsed data object\n * `raw` {String} the json\n * `res` {Response Object} response from couch\n\nMake a request to the registry. All the other methods are wrappers\naround this. one.\n\n# client.adduser(username, password, email, cb)\n\n* `username` {String}\n* `password` {String}\n* `email` {String}\n* `cb` {Function}\n\nAdd a user account to the registry, or verify the credentials.\n\n# client.get(url, [timeout], [nofollow], [staleOk], cb)\n\n* `url` {String} The url path to fetch\n* `timeout` {Number} Number of seconds old that a cached copy must be\n before a new request will be made.\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `staleOk` {Boolean} If there's cached data available, then return that\n to the callback quickly, and update the cache the background.\n\nFetches data from the registry via a GET request, saving it in\nthe cache folder with the ETag.\n\n# client.publish(data, tarball, [readme], cb)\n\n* `data` {Object} Package data\n* `tarball` {String | Stream} Filename or stream of the package tarball\n* `readme` {String} Contents of the README markdown file\n* `cb` {Function}\n\nPublish a package to the registry.\n\nNote that this does not create the tarball from a folder. However, it\ncan accept a gzipped tar stream or a filename to a tarball.\n\n# client.star(package, starred, cb)\n\n* `package` {String} Name of the package to star\n* `starred` {Boolean} True to star the package, false to unstar it.\n* `cb` {Function}\n\nStar or unstar a package.\n\nNote that the user does not have to be the package owner to star or\nunstar a package, though other writes do require that the user be the\npackage owner.\n\n# client.tag(project, version, tag, cb)\n\n* `project` {String} Project name\n* `version` {String} Version to tag\n* `tag` {String} Tag name to apply\n* `cb` {Function}\n\nMark a version in the `dist-tags` hash, so that `pkg@tag`\nwill fetch the specified version.\n\n# client.unpublish(name, [ver], cb)\n\n* `name` {String} package name\n* `ver` {String} version to unpublish. Leave blank to unpublish all\n versions.\n* `cb` {Function}\n\nRemove a version of a package (or all versions) from the registry. When\nthe last version us unpublished, the entire document is removed from the\ndatabase.\n\n# client.upload(where, file, [etag], [nofollow], cb)\n\n* `where` {String} URL path to upload to\n* `file` {String | Stream} Either the filename or a readable stream\n* `etag` {String} Cache ETag\n* `nofollow` {Boolean} Do not follow 301/302 responses\n* `cb` {Function}\n\nUpload an attachment. Mostly used by `client.publish()`.\n", + "_id": "npm-registry-client@0.2.5", + "_from": "npm-registry-client@~0.2.4" } diff --git a/deps/npm/node_modules/npm-registry-client/test/retries.js b/deps/npm/node_modules/npm-registry-client/test/retries.js index 500abf29d95..8f0e63f721c 100644 --- a/deps/npm/node_modules/npm-registry-client/test/retries.js +++ b/deps/npm/node_modules/npm-registry-client/test/retries.js @@ -5,9 +5,9 @@ var pkg = { _id: 'some-package@1.2.3', name: 'some-package', version: '1.2.3' } var client = new RC({ - retries: 6 - , retryMinTimeout: 10 - , retryMaxTimeout: 100 + 'fetch-retries': 6 + , 'fetch-retry-mintimeout': 10 + , 'fetch-retry-maxtimeout': 100 , cache: __dirname + '/fixtures/cache' , registry: 'http://localhost:' + server.port }) diff --git a/deps/npm/node_modules/npmconf/npmconf.js b/deps/npm/node_modules/npmconf/npmconf.js index da4b4229072..41ba2514233 100644 --- a/deps/npm/node_modules/npmconf/npmconf.js +++ b/deps/npm/node_modules/npmconf/npmconf.js @@ -9,6 +9,7 @@ var path = require('path') var nopt = require('nopt') var ini = require('ini') var Octal = configDefs.Octal +var mkdirp = require('mkdirp') exports.load = load exports.Conf = Conf @@ -174,18 +175,23 @@ Conf.prototype.save = function (where, cb) { then = then.bind(this) done = done.bind(this) this._saving ++ + var mode = where === 'user' ? 0600 : 0666 if (!data.trim()) fs.unlink(target.path, done) else { - fs.writeFile(target.path, data, 'utf8', function (er) { + mkdirp(path.dirname(target.path), function (er) { if (er) return then(er) - if (where === 'user' && myUid && myGid) - fs.chown(target.path, +myUid, +myGid, then) - else - then() - }.bind(this)) + fs.writeFile(target.path, data, 'utf8', function (er) { + if (er) + return then(er) + if (where === 'user' && myUid && myGid) + fs.chown(target.path, +myUid, +myGid, then) + else + then() + }) + }) } function then (er) { diff --git a/deps/npm/node_modules/npmconf/package.json b/deps/npm/node_modules/npmconf/package.json index 3a50fe9a4d2..8995ddfc04c 100644 --- a/deps/npm/node_modules/npmconf/package.json +++ b/deps/npm/node_modules/npmconf/package.json @@ -1,6 +1,6 @@ { "name": "npmconf", - "version": "0.0.6", + "version": "0.0.8", "description": "The config thing npm uses", "main": "npmconf.js", "directories": { @@ -10,6 +10,8 @@ "config-chain": "~1.1.1", "inherits": "~1.0.0", "once": "~1.1.1", + "mkdirp": "~0.3.3", + "osenv": "0.0.3", "nopt": "~2.0.0" }, "devDependencies": {}, @@ -37,6 +39,6 @@ "nopt": "~2.0.0" }, "readme": "# npmconf\n\nThe config thing npm uses\n\nIf you are interested in interacting with the config settings that npm\nuses, then use this module.\n\nHowever, if you are writing a new Node.js program, and want\nconfiguration functionality similar to what npm has, but for your\nown thing, then I'd recommend using [rc](https://github.com/dominictarr/rc),\nwhich is probably what you want.\n\nIf I were to do it all over again, that's what I'd do for npm. But,\nalas, there are many systems depending on many of the particulars of\nnpm's configuration setup, so it's not worth the cost of changing.\n\n## USAGE\n\n```javascript\nvar npmconf = require('npmconf')\n\n// pass in the cli options that you read from the cli\n// or whatever top-level configs you want npm to use for now.\nnpmconf.load({some:'configs'}, function (er, conf) {\n // do stuff with conf\n conf.get('some', 'cli') // 'configs'\n conf.get('username') // 'joebobwhatevers'\n conf.set('foo', 'bar', 'user')\n conf.save('user', function (er) {\n // foo = bar is now saved to ~/.npmrc or wherever\n })\n})\n```\n", - "_id": "npmconf@0.0.6", - "_from": "npmconf@latest" + "_id": "npmconf@0.0.8", + "_from": "npmconf@~0.0.6" } diff --git a/deps/npm/node_modules/read-installed/package.json b/deps/npm/node_modules/read-installed/package.json index 3e703bf9071..b122b54afe4 100644 --- a/deps/npm/node_modules/read-installed/package.json +++ b/deps/npm/node_modules/read-installed/package.json @@ -1,7 +1,7 @@ { "name": "read-installed", "description": "Read all the installed packages in a folder, and return a tree structure with all the data.", - "version": "0.0.1", + "version": "0.0.2", "repository": { "type": "git", "url": "git://github.com/isaacs/read-installed" @@ -27,6 +27,6 @@ "url": "http://blog.izs.me/" }, "readme": "# read-installed\n\nRead all the installed packages in a folder, and return a tree\nstructure with all the data.\n\nnpm uses this.\n\n## Usage\n\n```javascript\nvar readInstalled = require(\"read-installed\")\n// depth is optional, defaults to Infinity\nreadInstalled(folder, depth, function (er, data) {\n ...\n})\n```\n", - "_id": "read-installed@0.0.1", - "_from": "read-installed" + "_id": "read-installed@0.0.2", + "_from": "read-installed@0" } diff --git a/deps/npm/node_modules/read-installed/read-installed.js b/deps/npm/node_modules/read-installed/read-installed.js index be394225b87..cb77dba33df 100644 --- a/deps/npm/node_modules/read-installed/read-installed.js +++ b/deps/npm/node_modules/read-installed/read-installed.js @@ -286,6 +286,8 @@ function findUnmet (obj) { +found.path+",\nwhich is version "+found.version ) found.invalid = true + } else { + found.extraneous = false } deps[d] = found } diff --git a/deps/npm/node_modules/read-package-json/package.json b/deps/npm/node_modules/read-package-json/package.json index 42d06112729..8e56b11e32e 100644 --- a/deps/npm/node_modules/read-package-json/package.json +++ b/deps/npm/node_modules/read-package-json/package.json @@ -1,6 +1,6 @@ { "name": "read-package-json", - "version": "0.1.3", + "version": "0.1.4", "author": { "name": "Isaac Z. Schlueter", "email": "i@izs.me", @@ -31,6 +31,6 @@ "graceful-fs": "~1.1.8" }, "readme": "# read-package-json\n\nThis is the thing that npm uses to read package.json files. It\nvalidates some stuff, and loads some default things.\n\nIt keeps a cache of the files you've read, so that you don't end\nup reading the same package.json file multiple times.\n\nNote that if you just want to see what's literally in the package.json\nfile, you can usually do `var data = require('some-module/package.json')`.\n\nThis module is basically only needed by npm, but it's handy to see what\nnpm will see when it looks at your package.\n\n## Usage\n\n```javascript\nvar readJson = require('read-package-json')\n\nreadJson('/path/to/package.json', function (er, data) {\n if (er) {\n console.error(\"There was an error reading the file\")\n return\n }\n\n console.error('the package data is', data)\n}\n```\n\n## readJson(file, cb)\n\n* `file` {String} The path to the package.json file\n* `cb` {Function}\n\nReads the JSON file and does the things.\n\n## `package.json` Fields\n\nSee `man 5 package.json` or `npm help json`.\n\n## readJson.log\n\nBy default this is a reference to the `npmlog` module. But if that\nmodule can't be found, then it'll be set to just a dummy thing that does\nnothing.\n\nReplace with your own `{log,warn,error}` object for fun loggy time.\n\n## readJson.extras(file, data, cb)\n\nRun all the extra stuff relative to the file, with the parsed data.\n\nModifies the data as it does stuff. Calls the cb when it's done.\n\n## readJson.extraSet = [fn, fn, ...]\n\nArray of functions that are called by `extras`. Each one receives the\narguments `fn(file, data, cb)` and is expected to call `cb(er, data)`\nwhen done or when an error occurs.\n\nOrder is indeterminate, so each function should be completely\nindependent.\n\nMix and match!\n\n## readJson.cache\n\nThe `lru-cache` object that readJson uses to not read the same file over\nand over again. See\n[lru-cache](https://github.com/isaacs/node-lru-cache) for details.\n\n## Other Relevant Files Besides `package.json`\n\nSome other files have an effect on the resulting data object, in the\nfollowing ways:\n\n### `README?(.*)`\n\nIf there is a `README` or `README.*` file present, then npm will attach\na `readme` field to the data with the contents of this file.\n\nOwing to the fact that roughly 100% of existing node modules have\nMarkdown README files, it will generally be assumed to be Markdown,\nregardless of the extension. Please plan accordingly.\n\n### `server.js`\n\nIf there is a `server.js` file, and there is not already a\n`scripts.start` field, then `scripts.start` will be set to `node\nserver.js`.\n\n### `AUTHORS`\n\nIf there is not already a `contributors` field, then the `contributors`\nfield will be set to the contents of the `AUTHORS` file, split by lines,\nand parsed.\n\n### `bindings.gyp`\n\nIf a bindings.gyp file exists, and there is not already a\n`scripts.install` field, then the `scripts.install` field will be set to\n`node-gyp rebuild`.\n\n### `wscript`\n\nIf a wscript file exists, and there is not already a `scripts.install`\nfield, then the `scripts.install` field will be set to `node-waf clean ;\nnode-waf configure build`.\n\nNote that the `bindings.gyp` file supercedes this, since node-waf has\nbeen deprecated in favor of node-gyp.\n\n### `index.js`\n\nIf the json file does not exist, but there is a `index.js` file\npresent instead, and that file has a package comment, then it will try\nto parse the package comment, and use that as the data instead.\n\nA package comment looks like this:\n\n```javascript\n/**package\n * { \"name\": \"my-bare-module\"\n * , \"version\": \"1.2.3\"\n * , \"description\": \"etc....\" }\n **/\n\n// or...\n\n/**package\n{ \"name\": \"my-bare-module\"\n, \"version\": \"1.2.3\"\n, \"description\": \"etc....\" }\n**/\n```\n\nThe important thing is that it starts with `/**package`, and ends with\n`**/`. If the package.json file exists, then the index.js is not\nparsed.\n\n### `{directories.man}/*.[0-9]`\n\nIf there is not already a `man` field defined as an array of files or a\nsingle file, and\nthere is a `directories.man` field defined, then that directory will\nbe searched for manpages.\n\nAny valid manpages found in that directory will be assigned to the `man`\narray, and installed in the appropriate man directory at package install\ntime, when installed globally on a Unix system.\n\n### `{directories.bin}/*`\n\nIf there is not already a `bin` field defined as a string filename or a\nhash of ` : ` pairs, then the `directories.bin`\ndirectory will be searched and all the files within it will be linked as\nexecutables at install time.\n\nWhen installing locally, npm links bins into `node_modules/.bin`, which\nis in the `PATH` environ when npm runs scripts. When\ninstalling globally, they are linked into `{prefix}/bin`, which is\npresumably in the `PATH` environment variable.\n", - "_id": "read-package-json@0.1.3", - "_from": "read-package-json@~0.1.1" + "_id": "read-package-json@0.1.4", + "_from": "read-package-json@~0.1.3" } diff --git a/deps/npm/node_modules/read-package-json/read-json.js b/deps/npm/node_modules/read-package-json/read-json.js index 837c6b7c4a8..17e8b4320d6 100644 --- a/deps/npm/node_modules/read-package-json/read-json.js +++ b/deps/npm/node_modules/read-package-json/read-json.js @@ -254,7 +254,7 @@ function mans (file, data, cb) { function mans_ (file, data, mans, cb) { var m = data.directories && data.directories.man data.man = mans.map(function (mf) { - return path.resolve(m, mf) + return path.resolve(path.dirname(file), m, mf) }) return cb(null, data) } diff --git a/deps/npm/node_modules/read/README.md b/deps/npm/node_modules/read/README.md index 01aa8e76bd4..2edefdf473e 100644 --- a/deps/npm/node_modules/read/README.md +++ b/deps/npm/node_modules/read/README.md @@ -33,6 +33,21 @@ Every option is optional. If silent is true, and the input is a TTY, then read will set raw mode, and read character by character. +## COMPATIBILITY + +This module works sort of with node 0.6. It does not work with node +versions less than 0.6. It is best on node 0.8. + +On node version 0.6, it will remove all listeners on the input +stream's `data` and `keypress` events, because the readline module did +not fully clean up after itself in that version of node, and did not +make it possible to clean up after it in a way that has no potential +for side effects. + +Additionally, some of the readline options (like `terminal`) will not +function in versions of node before 0.8, because they were not +implemented in the builtin readline module. + ## CONTRIBUTING Patches welcome. diff --git a/deps/npm/node_modules/read/lib/read.js b/deps/npm/node_modules/read/lib/read.js index 4b0e303f6ce..4b8a422d9b3 100644 --- a/deps/npm/node_modules/read/lib/read.js +++ b/deps/npm/node_modules/read/lib/read.js @@ -23,7 +23,13 @@ function read (opts, cb) { var def = opts.default || '' var terminal = !!(opts.terminal || output.isTTY) var rlOpts = { input: input, output: output, terminal: terminal } - var rl = readline.createInterface(rlOpts) + + if (process.version.match(/^v0\.6/)) { + var rl = readline.createInterface(rlOpts.input, rlOpts.output) + } else { + var rl = readline.createInterface(rlOpts) + } + var prompt = (opts.prompt || '').trim() + ' ' var silent = opts.silent var editDef = false @@ -69,6 +75,13 @@ function read (opts, cb) { function done () { called = true rl.close() + + if (process.version.match(/^v0\.6/)) { + rl.input.removeAllListeners('data') + rl.input.removeAllListeners('keypress') + rl.input.pause() + } + clearTimeout(timer) output.mute() output.end() diff --git a/deps/npm/node_modules/read/node_modules/mute-stream/mute.js b/deps/npm/node_modules/read/node_modules/mute-stream/mute.js index f0c3550fe10..7746618a129 100644 --- a/deps/npm/node_modules/read/node_modules/mute-stream/mute.js +++ b/deps/npm/node_modules/read/node_modules/mute-stream/mute.js @@ -63,6 +63,21 @@ function setIsTTY (isTTY) { }) } +Object.defineProperty(MuteStream.prototype, 'rows', { + get: function () { + return( this._dest ? this._dest.rows + : this._src ? this._src.rows + : undefined ) + }, enumerable: true, configurable: true }) + +Object.defineProperty(MuteStream.prototype, 'columns', { + get: function () { + return( this._dest ? this._dest.columns + : this._src ? this._src.columns + : undefined ) + }, enumerable: true, configurable: true }) + + MuteStream.prototype.pipe = function (dest) { this._dest = dest return Stream.prototype.pipe.call(this, dest) diff --git a/deps/npm/node_modules/read/node_modules/mute-stream/package.json b/deps/npm/node_modules/read/node_modules/mute-stream/package.json index ff942b853e8..629b5be6722 100644 --- a/deps/npm/node_modules/read/node_modules/mute-stream/package.json +++ b/deps/npm/node_modules/read/node_modules/mute-stream/package.json @@ -1,6 +1,6 @@ { "name": "mute-stream", - "version": "0.0.2", + "version": "0.0.3", "main": "mute.js", "directories": { "test": "test" @@ -28,9 +28,6 @@ "license": "BSD", "description": "Bytes go in, but they don't come out (when muted).", "readme": "# mute-stream\n\nBytes go in, but they don't come out (when muted).\n\nThis is a basic pass-through stream, but when muted, the bytes are\nsilently dropped, rather than being passed through.\n\n## Usage\n\n```javascript\nvar MuteStream = require('mute-stream')\n\nvar ms = new MuteStream(options)\n\nms.pipe(process.stdout)\nms.write('foo') // writes 'foo' to stdout\nms.mute()\nms.write('bar') // does not write 'bar'\nms.unmute()\nms.write('baz') // writes 'baz' to stdout\n\n// can also be used to mute incoming data\nvar ms = new MuteStream\ninput.pipe(ms)\n\nms.on('data', function (c) {\n console.log('data: ' + c)\n})\n\ninput.emit('data', 'foo') // logs 'foo'\nms.mute()\ninput.emit('data', 'bar') // does not log 'bar'\nms.unmute()\ninput.emit('data', 'baz') // logs 'baz'\n```\n\n## Options\n\nAll options are optional.\n\n* `replace` Set to a string to replace each character with the\n specified string when muted. (So you can show `****` instead of the\n password, for example.)\n\n## ms.mute()\n\nSet `muted` to `true`. Turns `.write()` into a no-op.\n\n## ms.unmute()\n\nSet `muted` to `false`\n\n## ms.isTTY\n\nTrue if the pipe destination is a TTY, or if the incoming pipe source is\na TTY.\n\n## Other stream methods...\n\nThe other standard readable and writable stream methods are all\navailable. The MuteStream object acts as a facade to its pipe source\nand destination.\n", - "_id": "mute-stream@0.0.2", - "dist": { - "shasum": "75d4466df24a57e80fec806bda88561cd0560d2d" - }, + "_id": "mute-stream@0.0.3", "_from": "mute-stream@~0.0.2" } diff --git a/deps/npm/node_modules/read/node_modules/mute-stream/test/basic.js b/deps/npm/node_modules/read/node_modules/mute-stream/test/basic.js index 473f8279696..2d1f6aed301 100644 --- a/deps/npm/node_modules/read/node_modules/mute-stream/test/basic.js +++ b/deps/npm/node_modules/read/node_modules/mute-stream/test/basic.js @@ -89,17 +89,29 @@ tap.test('outgoing', function (t) { tap.test('isTTY', function (t) { var str = new PassThrough str.isTTY = true + str.columns=80 + str.rows=24 var ms = new MS t.equal(ms.isTTY, false) + t.equal(ms.columns, undefined) + t.equal(ms.rows, undefined) ms.pipe(str) t.equal(ms.isTTY, true) + t.equal(ms.columns, 80) + t.equal(ms.rows, 24) str.isTTY = false t.equal(ms.isTTY, false) + t.equal(ms.columns, 80) + t.equal(ms.rows, 24) str.isTTY = true t.equal(ms.isTTY, true) + t.equal(ms.columns, 80) + t.equal(ms.rows, 24) ms.isTTY = false t.equal(ms.isTTY, false) + t.equal(ms.columns, 80) + t.equal(ms.rows, 24) ms = new MS t.equal(ms.isTTY, false) diff --git a/deps/npm/node_modules/read/package.json b/deps/npm/node_modules/read/package.json index 79e5b7ce2c1..f76034e867a 100644 --- a/deps/npm/node_modules/read/package.json +++ b/deps/npm/node_modules/read/package.json @@ -1,6 +1,6 @@ { "name": "read", - "version": "1.0.3", + "version": "1.0.4", "main": "lib/read.js", "dependencies": { "mute-stream": "~0.0.2" @@ -25,7 +25,7 @@ "scripts": { "test": "tap test/*.js" }, - "readme": "## read\n\nFor reading user input from stdin.\n\nSimilar to the `readline` builtin's `question()` method, but with a\nfew more features.\n\n## USAGE\n\n```javascript\nvar read = require(\"read\")\nread(options, callback)\n```\n\nThe callback gets called with either the user input, or the default\nspecified, or an error, as `callback(error, result, isDefault)`\nnode style.\n\n## OPTIONS\n\nEvery option is optional.\n\n* `prompt` What to write to stdout before reading input.\n* `silent` Don't echo the output as the user types it.\n* `replace` Replace silenced characters with the supplied character value.\n* `timeout` Number of ms to wait for user input before giving up.\n* `default` The default value if the user enters nothing.\n* `edit` Allow the user to edit the default value.\n* `terminal` Treat the output as a TTY, whether it is or not.\n* `stdin` Readable stream to get input data from. (default `process.stdin`)\n* `stdout` Writeable stream to write prompts to. (default: `process.stdout`)\n\nIf silent is true, and the input is a TTY, then read will set raw\nmode, and read character by character.\n\n## CONTRIBUTING\n\nPatches welcome.\n", - "_id": "read@1.0.3", - "_from": "read@~1" + "readme": "## read\n\nFor reading user input from stdin.\n\nSimilar to the `readline` builtin's `question()` method, but with a\nfew more features.\n\n## USAGE\n\n```javascript\nvar read = require(\"read\")\nread(options, callback)\n```\n\nThe callback gets called with either the user input, or the default\nspecified, or an error, as `callback(error, result, isDefault)`\nnode style.\n\n## OPTIONS\n\nEvery option is optional.\n\n* `prompt` What to write to stdout before reading input.\n* `silent` Don't echo the output as the user types it.\n* `replace` Replace silenced characters with the supplied character value.\n* `timeout` Number of ms to wait for user input before giving up.\n* `default` The default value if the user enters nothing.\n* `edit` Allow the user to edit the default value.\n* `terminal` Treat the output as a TTY, whether it is or not.\n* `stdin` Readable stream to get input data from. (default `process.stdin`)\n* `stdout` Writeable stream to write prompts to. (default: `process.stdout`)\n\nIf silent is true, and the input is a TTY, then read will set raw\nmode, and read character by character.\n\n## COMPATIBILITY\n\nThis module works sort of with node 0.6. It does not work with node\nversions less than 0.6. It is best on node 0.8.\n\nOn node version 0.6, it will remove all listeners on the input\nstream's `data` and `keypress` events, because the readline module did\nnot fully clean up after itself in that version of node, and did not\nmake it possible to clean up after it in a way that has no potential\nfor side effects.\n\nAdditionally, some of the readline options (like `terminal`) will not\nfunction in versions of node before 0.8, because they were not\nimplemented in the builtin readline module.\n\n## CONTRIBUTING\n\nPatches welcome.\n", + "_id": "read@1.0.4", + "_from": "read@~1.0.3" } diff --git a/deps/npm/node_modules/read/test/basic.js b/deps/npm/node_modules/read/test/basic.js index c90c41036c7..f5324b4aa68 100644 --- a/deps/npm/node_modules/read/test/basic.js +++ b/deps/npm/node_modules/read/test/basic.js @@ -5,6 +5,11 @@ if (process.argv[2] === 'child') { return child() } +var CLOSE = 'close' +if (process.version.match(/^v0\.6/)) { + CLOSE = 'exit' +} + var spawn = require('child_process').spawn tap.test('basic', function (t) { @@ -31,7 +36,7 @@ tap.test('basic', function (t) { console.error('result %j', c.toString()) }) - child.on('close', function () { + child.on(CLOSE, function () { result = JSON.parse(result) t.same(result, {"user":"a user","pass":"a password","verify":"a password","passMatch":true}) t.equal(output, 'Username: (test-user) Password: (