Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
{
"version": "1.3.5",
"version": "1.3.6",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
@@ -134,10 +134,5 @@
"dumpconf": "env | grep npm | sort | uniq",
"echo": "node bin/npm-cli.js"
},
"licenses": [
{
"type": "MIT +no-false-attribs",
"url": "https://github.com/isaacs/npm/raw/master/LICENSE"
}
]
"license": "Artistic-2.0"
}
@@ -384,6 +384,40 @@ with a single error handler in a single place.
// with the normal line number and stack message.
});

### domain.enter()

The `enter` method is plumbing used by the `run`, `bind`, and `intercept`
methods to set the active domain. It sets `domain.active` and `process.domain`
to the domain, and implicitly pushes the domain onto the domain stack managed
by the domain module (see `domain.exit()` for details on the domain stack). The
call to `enter` delimits the beginning of a chain of asynchronous calls and I/O
operations bound to a domain.

Calling `enter` changes only the active domain, and does not alter the domain
itself. `Enter` and `exit` can be called an arbitrary number of times on a
single domain.

If the domain on which `enter` is called has been disposed, `enter` will return
without setting the domain.

### domain.exit()

The `exit` method exits the current domain, popping it off the domain stack.
Any time execution is going to switch to the context of a different chain of
asynchronous calls, it's important to ensure that the current domain is exited.
The call to `exit` delimits either the end of or an interruption to the chain
of asynchronous calls and I/O operations bound to a domain.

If there are multiple, nested domains bound to the current execution context,
`exit` will exit any domains nested within this domain.

Calling `exit` changes only the active domain, and does not alter the domain
itself. `Enter` and `exit` can be called an arbitrary number of times on a
single domain.

If the domain on which `exit` is called has been disposed, `exit` will return
without exiting the domain.

### domain.dispose()

The dispose method destroys a domain, and makes a best effort attempt to
@@ -311,7 +311,7 @@ An exception occurs if the file does not exist.

This is primarily useful for opening files on NFS mounts as it allows you to
skip the potentially stale local cache. It has a very real impact on I/O
performance so don't use this mode unless you need it.
performance so don't use this flag unless you need it.

Note that this doesn't turn `fs.open()` into a synchronous blocking call.
If that's what you want then you should be using `fs.openSync()`
@@ -322,36 +322,40 @@ An exception occurs if the file does not exist.
* `'w'` - Open file for writing.
The file is created (if it does not exist) or truncated (if it exists).

* `'wx'` - Like `'w'` but opens the file in exclusive mode.
* `'wx'` - Like `'w'` but fails if `path` exists.

* `'w+'` - Open file for reading and writing.
The file is created (if it does not exist) or truncated (if it exists).

* `'wx+'` - Like `'w+'` but opens the file in exclusive mode.
* `'wx+'` - Like `'w+'` but fails if `path` exists.

* `'a'` - Open file for appending.
The file is created if it does not exist.

* `'ax'` - Like `'a'` but opens the file in exclusive mode.
* `'ax'` - Like `'a'` but fails if `path` exists.

* `'a+'` - Open file for reading and appending.
The file is created if it does not exist.

* `'ax+'` - Like `'a+'` but opens the file in exclusive mode.
* `'ax+'` - Like `'a+'` but fails if `path` exists.

`mode` defaults to `0666`. The callback gets two arguments `(err, fd)`.
`mode` sets the file mode (permission and sticky bits), but only if the file was
created. It defaults to `0666`, readable and writeable.

Exclusive mode (`O_EXCL`) ensures that `path` is newly created. `fs.open()`
fails if a file by that name already exists. On POSIX systems, symlinks are
not followed. Exclusive mode may or may not work with network file systems.
The callback gets two arguments `(err, fd)`.

The exclusive flag `'x'` (`O_EXCL` flag in open(2)) ensures that `path` is newly
created. On POSIX systems, `path` is considered to exist even if it is a symlink
to a non-existent file. The exclusive flag may or may not work with network file
systems.

On Linux, positional writes don't work when the file is opened in append mode.
The kernel ignores the position argument and always appends the data to
the end of the file.

## fs.openSync(path, flags, [mode])

Synchronous open(2).
Synchronous version of `fs.open()`.

## fs.utimes(path, atime, mtime, callback)
## fs.utimesSync(path, atime, mtime)
@@ -315,7 +315,7 @@ Boolean (read-only). True if headers were sent, false otherwise.

### response.sendDate

When true, the Date header will be automatically generated and sent in
When true, the Date header will be automatically generated and sent in
the response if it is not already present in the headers. Defaults to true.

This should only be disabled for testing; HTTP requires the Date header
@@ -528,17 +528,17 @@ Alternatively, you could just opt out of pooling entirely using `agent:false`:

### agent.maxSockets

By default set to 5. Determines how many concurrent sockets the agent can have
By default set to 5. Determines how many concurrent sockets the agent can have
open per host.

### agent.sockets

An object which contains arrays of sockets currently in use by the Agent. Do not
An object which contains arrays of sockets currently in use by the Agent. Do not
modify.

### agent.requests

An object which contains queues of requests that have not yet been assigned to
An object which contains queues of requests that have not yet been assigned to
sockets. Do not modify.

## http.globalAgent
@@ -568,7 +568,9 @@ entirely discarded. However, if you add a `'response'` event handler,
then you **must** consume the data from the response object, either by
calling `response.read()` whenever there is a `'readable'` event, or
by adding a `'data'` handler, or by calling the `.resume()` method.
Until the data is consumed, the `'end'` event will not fire.
Until the data is consumed, the `'end'` event will not fire. Also, until
the data is read it will consume memory that can eventually lead to a
'process out of memory' error.

Note: Node does not check whether Content-Length and the length of the body
which has been transmitted are equal or not.
@@ -533,10 +533,12 @@ Readable.prototype.pipe = function(dest, pipeOpts) {

// if the dest has an error, then stop piping into it.
// however, don't suppress the throwing behavior for this.
// check for listeners before emit removes one-time listeners.
var errListeners = EE.listenerCount(dest, 'error');
function onerror(er) {
debug('onerror', er);
unpipe();
if (EE.listenerCount(dest, 'error') === 0)
if (errListeners === 0 && EE.listenerCount(dest, 'error') === 0)
dest.emit('error', er);
}
dest.once('error', onerror);
@@ -209,7 +209,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {

if (list === listener ||
(util.isFunction(list.listener) && list.listener === listener)) {
this._events[type] = undefined;
delete this._events[type];
if (this._events.removeListener)
this.emit('removeListener', type, listener);

@@ -227,7 +227,7 @@ EventEmitter.prototype.removeListener = function(type, listener) {

if (list.length === 1) {
list.length = 0;
this._events[type] = undefined;
delete this._events[type];
} else {
list.splice(position, 1);
}
@@ -250,7 +250,7 @@ EventEmitter.prototype.removeAllListeners = function(type) {
if (arguments.length === 0)
this._events = {};
else if (this._events[type])
this._events[type] = undefined;
delete this._events[type];
return this;
}

@@ -274,7 +274,7 @@ EventEmitter.prototype.removeAllListeners = function(type) {
while (listeners.length)
this.removeListener(type, listeners[listeners.length - 1]);
}
this._events[type] = undefined;
delete this._events[type];

return this;
};
@@ -28,9 +28,12 @@ var net = require('net');
assert(typeof gc === 'function', 'Run this test with --expose-gc');
net.createServer(function() {}).listen(common.PORT);

var before = 0;
(function() {
// 2**26 == 64M entries
gc();
for (var i = 0, junk = [0]; i < 26; ++i) junk = junk.concat(junk);
before = process.memoryUsage().rss;

net.createConnection(common.PORT, '127.0.0.1', function() {
assert(junk.length != 0); // keep reference alive
@@ -40,11 +43,10 @@ net.createServer(function() {}).listen(common.PORT);
})();

function done() {
var before = process.memoryUsage().rss;
gc();
var after = process.memoryUsage().rss;
var reclaimed = (before - after) / 1024;
console.log('%d kB reclaimed', reclaimed);
assert(reclaimed > 256 * 1024); // it's more like 512M on x64
assert(reclaimed > 128 * 1024); // It's around 256 MB on x64.
process.exit();
}
@@ -0,0 +1,44 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

// Flags: --expose-gc

// Add and remove a lot of different events to an EventEmitter, then check
// that we didn't leak the event names.
var common = require('../common');
var assert = require('assert');
var events = require('events');

assert.equal(typeof gc, 'function', 'Run this test with --expose-gc');
gc();

var before = process.memoryUsage().heapUsed;
var e = new events.EventEmitter();

for (var i = 0; i < 2.5e5; ++i) {
var name = 'a-pretty-long-event-name-' + i;
e.on(name, assert.fail);
e.removeListener(name, assert.fail);
}
gc();

var after = process.memoryUsage().heapUsed;
assert(after - before < 1024*1024, 'EventEmitter leaks event names.');
@@ -0,0 +1,64 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.


var common = require('../common.js');
var assert = require('assert');

var util = require('util');
var stream = require('stream');


var Read = function() {
stream.Readable.call(this);
};
util.inherits(Read, stream.Readable);

Read.prototype._read = function(size) {
this.push('x');
this.push(null);
};


var Write = function() {
stream.Writable.call(this);
};
util.inherits(Write, stream.Writable);

Write.prototype._write = function(buffer, encoding, cb) {
this.emit('error', new Error('boom'));
this.emit('alldone');
};

var read = new Read();
var write = new Write();

write.once('error', function(err) {});
write.once('alldone', function(err) {
console.log('ok');
});

process.on('exit', function(c) {
console.error('error thrown even with listener');
});

read.pipe(write);