@@ -1,5 +1,5 @@
{
"version": "1.3.11",
"version": "1.3.12",
"name": "npm",
"publishConfig": {
"proprietary-attribs": false
@@ -47,16 +47,16 @@
"tar": "~0.1.18",
"fstream": "~0.1.23",
"block-stream": "0.0.7",
"mkdirp": "~0.3.3",
"mkdirp": "~0.3.5",
"read": "~1.0.4",
"lru-cache": "~2.3.1",
"node-gyp": "~0.10.10",
"fstream-npm": "~0.1.3",
"fstream-npm": "~0.1.6",
"uid-number": "0",
"archy": "0",
"chownr": "0",
"npmlog": "0.0.4",
"ansi": "~0.1.2",
"npmlog": "0.0.6",
"ansi": "~0.2.1",
"npm-registry-client": "~0.2.28",
"read-package-json": "~1.1.3",
"read-installed": "~0.2.2",
@@ -65,16 +65,17 @@
"osenv": "0",
"lockfile": "~0.4.0",
"retry": "~0.6.0",
"once": "~1.1.1",
"npmconf": "~0.1.2",
"once": "~1.3.0",
"npmconf": "~0.1.5",
"opener": "~1.3.0",
"chmodr": "~0.1.0",
"cmd-shim": "~1.0.1",
"cmd-shim": "~1.1.1",
"sha": "~1.2.1",
"editor": "0.0.4",
"editor": "0.0.5",
"child-process-close": "~0.1.1",
"npm-user-validate": "0.0.3",
"github-url-from-git": "1.1.1"
"github-url-from-git": "1.1.1",
"github-url-from-username-repo": "0.0.2"
},
"bundleDependencies": [
"semver",
@@ -118,12 +119,13 @@
"child-process-close",
"editor",
"npm-user-validate",
"github-url-from-git"
"github-url-from-git",
"github-url-from-username-repo"
],
"devDependencies": {
"ronn": "~0.3.6",
"tap": "~0.4.0",
"npm-registry-mock": "~0.3.0"
"npm-registry-mock": "~0.5.3"
},
"engines": {
"node": ">=0.6",
@@ -132,7 +134,7 @@
"scripts": {
"test": "node ./test/run.js && tap test/tap/*.js",
"tap": "tap test/tap/*.js",
"prepublish": "node bin/npm-cli.js prune ; rm -rf test/*/*/node_modules ; make -j4 doc",
"prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rm -rf test/*/*/node_modules && make -j4 doc",
"dumpconf": "env | grep npm | sort | uniq",
"echo": "node bin/npm-cli.js"
},
@@ -1,8 +1,8 @@
{
"npm-test-peer-deps-file": {
"version": "1.2.3",
"from": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
"resolved": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js",
"from": "https://gist.github.com/domenic/3971128/raw/7472b26a013ceb174c2d726314e9fa97465729bb/index.js",
"resolved": "https://gist.github.com/domenic/3971128/raw/7472b26a013ceb174c2d726314e9fa97465729bb/index.js",
"dependencies": {
"opener": {
"version": "1.3.0",
@@ -3,7 +3,7 @@
"name": "npm-test-peer-deps",
"version": "0.0.0",
"dependencies": {
"npm-test-peer-deps-file": "https://raw.github.com/gist/3971128/3f6aa37b4fa1186c2f47da9b77dcc4ec496e3483/index.js"
"npm-test-peer-deps-file": "https://gist.github.com/domenic/3971128/raw/7472b26a013ceb174c2d726314e9fa97465729bb/index.js"
},
"scripts": {
"test": "node test.js"
@@ -3,7 +3,7 @@
"name": "npm-test-shrinkwrap",
"version": "0.0.0",
"dependencies": {
"npm-test-single-file": "https://raw.github.com/gist/1837112/index.js",
"npm-test-single-file": "https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js",
"glob": "git://github.com/isaacs/node-glob.git#npm-test",
"minimatch": "~0.1.0"
},

This file was deleted.

This file was deleted.

@@ -0,0 +1,12 @@
var test = require('tap').test
var spawn = require('child_process').spawn
var node = process.execPath
var npm = require.resolve('../../')
var args = [ npm, 'ls', 'ceci n’est pas une package' ]
test('ls exits non-zero when nothing found', function (t) {
var child = spawn(node, args)
child.on('exit', function (code) {
t.notEqual(code, 0)
t.end()
})
})
@@ -0,0 +1,23 @@
var test = require("tap").test
var npm = require("../../")

var mr = require("npm-registry-mock")

// config
var port = 1331
var address = "http://localhost:" + port
var pkg = __dirname + '/outdated-include-devdependencies'


test("includes devDependencies in outdated", function (t) {
process.chdir(pkg)
mr(port, function (s) {
npm.load({registry: address}, function () {
npm.outdated(function (er, d) {
t.equal("1.5.1", d[0][3])
s.close()
t.end()
})
})
})
})
@@ -0,0 +1,8 @@
{
"author": "Rocko Artischocko",
"name": "ignore-shrinkwrap",
"version": "0.0.0",
"devDependencies": {
"underscore": ">=1.3.1"
}
}
@@ -0,0 +1,38 @@
var test = require("tap").test
var npm = require("../../")
var mkdirp = require("mkdirp")
var rimraf = require("rimraf")


var mr = require("npm-registry-mock")

// config
var port = 1331
var address = "http://localhost:" + port
var pkg = __dirname + "/outdated-new-versions"
mkdirp.sync(pkg + "/cache")


test("dicovers new versions in outdated", function (t) {
process.chdir(pkg)
t.plan(2)
mr(port, function (s) {
npm.load({cache: pkg + "/cache", registry: address}, function () {
npm.outdated(function (er, d) {
for (var i = 0; i < d.length; i++) {
if (d[i][1] === "underscore")
t.equal("1.5.1", d[i][4])
if (d[i][1] === "request")
t.equal("2.27.0", d[i][4])
}
s.close()
t.end()
})
})
})
})

test("cleanup", function (t) {
rimraf.sync(pkg + "/cache")
t.end()
})
@@ -0,0 +1,11 @@
{
"name": "new-versions-with-outdated",
"author": "Rockbert",
"version": "0.0.0",
"dependencies": {
"underscore": "~1.3.1"
},
"devDependencies": {
"request": "~0.9.0"
}
}
@@ -0,0 +1,90 @@
// verify that prepublish runs on pack and publish
var test = require('tap').test
var npm = require('../../')
var fs = require('fs')
var pkg = __dirname + '/prepublish_package'
var tmp = pkg + '/tmp'
var cache = pkg + '/cache'
var mkdirp = require('mkdirp')
var rimraf = require('rimraf')
var path = require('path')
var os = require('os')

test('setup', function (t) {
var n = 0
mkdirp(pkg, then())
mkdirp(cache, then())
mkdirp(tmp, then())
function then (er) {
n ++
return function (er) {
if (er)
throw er
if (--n === 0)
next()
}
}

function next () {
fs.writeFile(pkg + '/package.json', JSON.stringify({
name: 'npm-test-prepublish',
version: '1.2.5',
scripts: { prepublish: 'echo ok' }
}), 'ascii', function (er) {
if (er)
throw er
t.pass('setup done')
t.end()
})
}
})

test('test', function (t) {
var spawn = require('child_process').spawn
var node = process.execPath
var npm = path.resolve(__dirname, '../../cli.js')
var env = {
npm_config_cache: cache,
npm_config_tmp: tmp,
npm_config_prefix: pkg,
npm_config_global: 'false'
}
for (var i in process.env) {
if (!/^npm_config_/.test(i))
env[i] = process.env[i]
}
var child = spawn(node, [npm, 'pack'], {
cwd: pkg,
env: env
})
child.stdout.setEncoding('utf8')
child.stderr.on('data', function(chunk) {
throw new Error('got stderr data: ' + JSON.stringify('' + chunk))
})
child.stdout.on('data', ondata)
child.on('close', onend)
var c = ''
function ondata (chunk) {
c += chunk
}
function onend () {
c = c.trim()
t.equal( c
, '> npm-test-prepublish@1.2.5 prepublish .' + os.EOL
+ '> echo ok' + os.EOL
+ os.EOL
+ 'ok' + os.EOL
+ 'npm-test-prepublish-1.2.5.tgz')
t.end()
}
})

test('cleanup', function (t) {
rimraf(pkg, function(er) {
if (er)
throw er
t.pass('cleaned up')
t.end()
})
})

@@ -1,5 +1,6 @@
var test = require('tap').test
var fs = require('fs')
var osenv = require('osenv')
var pkg = process.env.npm_config_tmp || '/tmp'
pkg += '/npm-test-publish-config'

@@ -41,7 +42,8 @@ test(function (t) {
npm_config_cache_lock_wait: 1000,
HOME: process.env.HOME,
Path: process.env.PATH,
PATH: process.env.PATH
PATH: process.env.PATH,
USERPROFILE: osenv.home()
}
})
})
@@ -0,0 +1,24 @@
var test = require("tap").test
, npm = require("../../")

test("returns a list of removed items", function (t) {
t.plan(1)

setup(function () {
npm.install(".", function (err) {
if (err) return t.fail(err)
npm.uninstall("once", "ini", "lala", function (err, d) {
if (err) return t.fail(err)
t.same(d.sort(), ["once", "ini"].sort())
t.end()
})
})
})
})

function setup (cb) {
process.chdir(__dirname + "/uninstall-package")
npm.load(function () {
cb()
})
}
@@ -0,0 +1,9 @@
{
"name": "beep",
"version": "0.0.0",
"main": "index.js",
"dependencies": {
"once": "*",
"ini": "*"
}
}
@@ -326,12 +326,13 @@ Then in `myobject.h` make your wrapper inherit from `node::ObjectWrap`:
static void Init(v8::Handle<v8::Object> exports);

private:
MyObject();
explicit MyObject(double value = 0);
~MyObject();

static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> PlusOne(const v8::Arguments& args);
double counter_;
static v8::Persistent<v8::Function> constructor;
double value_;
};

#endif
@@ -345,8 +346,13 @@ prototype:

using namespace v8;

MyObject::MyObject() {};
MyObject::~MyObject() {};
Persistent<Function> MyObject::constructor;

MyObject::MyObject(double value) : value_(value) {
}

MyObject::~MyObject() {
}

void MyObject::Init(Handle<Object> exports) {
Isolate* isolate = Isolate::GetCurrent();
@@ -370,21 +376,28 @@ prototype:
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

MyObject* obj = new MyObject();
obj->counter_ = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
obj->Wrap(args.This());

return args.This();
if (args.IsConstructCall()) {
// Invoked as constructor: `new MyObject(...)`
double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
MyObject* obj = new MyObject(value);
obj->Wrap(args.This());
return args.This();
} else {
// Invoked as plain function `MyObject(...)`, turn into construct call.
const int argc = 1;
Local<Value> argv[argc] = { args[0] };
return scope.Close(constructor->NewInstance(argc, argv));
}
}

Handle<Value> MyObject::PlusOne(const Arguments& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This());
obj->counter_ += 1;
obj->value_ += 1;

return scope.Close(Number::New(obj->counter_));
return scope.Close(Number::New(obj->value_));
}

Test it with:
@@ -441,13 +454,13 @@ care of instantiating the object (i.e. it does the job of `new` in JavaScript):
static v8::Handle<v8::Value> NewInstance(const v8::Arguments& args);

private:
MyObject();
explicit MyObject(double value = 0);
~MyObject();

static v8::Persistent<v8::Function> constructor;
static v8::Handle<v8::Value> New(const v8::Arguments& args);
static v8::Handle<v8::Value> PlusOne(const v8::Arguments& args);
double counter_;
static v8::Persistent<v8::Function> constructor;
double value_;
};

#endif
@@ -459,11 +472,14 @@ The implementation is similar to the above in `myobject.cc`:

using namespace v8;

MyObject::MyObject() {};
MyObject::~MyObject() {};

Persistent<Function> MyObject::constructor;

MyObject::MyObject(double value) : value_(value) {
}

MyObject::~MyObject() {
}

void MyObject::Init() {
Isolate* isolate = Isolate::GetCurrent();
// Prepare constructor template
@@ -474,19 +490,30 @@ The implementation is similar to the above in `myobject.cc`:
// Prototype
tpl->PrototypeTemplate()->Set(String::NewSymbol("plusOne"),
FunctionTemplate::New(PlusOne)->GetFunction());
<<<<<<< HEAD

constructor = Persistent<Function>::New(isolate, tpl->GetFunction());
=======
constructor = Persistent<Function>::New(tpl->GetFunction());
>>>>>>> upstream/v0.10
}
Handle<Value> MyObject::New(const Arguments& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

MyObject* obj = new MyObject();
obj->counter_ = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
obj->Wrap(args.This());

return args.This();
if (args.IsConstructCall()) {
// Invoked as constructor: `new MyObject(...)`
double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
MyObject* obj = new MyObject(value);
obj->Wrap(args.This());
return args.This();
} else {
// Invoked as plain function `MyObject(...)`, turn into construct call.
const int argc = 1;
Local<Value> argv[argc] = { args[0] };
return scope.Close(constructor->NewInstance(argc, argv));
}
}

Handle<Value> MyObject::NewInstance(const Arguments& args) {
@@ -505,9 +532,9 @@ The implementation is similar to the above in `myobject.cc`:
HandleScope scope(isolate);

MyObject* obj = ObjectWrap::Unwrap<MyObject>(args.This());
obj->counter_ += 1;
obj->value_ += 1;

return scope.Close(Number::New(obj->counter_));
return scope.Close(Number::New(obj->value_));
}

Test it with:
@@ -552,7 +579,7 @@ In the following `addon.cc` we introduce a function `add()` that can take on two
MyObject* obj2 = node::ObjectWrap::Unwrap<MyObject>(
args[1]->ToObject());

double sum = obj1->Val() + obj2->Val();
double sum = obj1->Value() + obj2->Value();
return scope.Close(Number::New(sum));
}

@@ -580,15 +607,15 @@ can probe private values after unwrapping the object:
public:
static void Init();
static v8::Handle<v8::Value> NewInstance(const v8::Arguments& args);
double Val() const { return val_; }
double Value() const { return value_; }

private:
MyObject();
explicit MyObject(double value = 0);
~MyObject();

static v8::Persistent<v8::Function> constructor;
static v8::Handle<v8::Value> New(const v8::Arguments& args);
double val_;
static v8::Persistent<v8::Function> constructor;
double value_;
};

#endif
@@ -600,31 +627,45 @@ The implementation of `myobject.cc` is similar as before:

using namespace v8;

MyObject::MyObject() {};
MyObject::~MyObject() {};

Persistent<Function> MyObject::constructor;

MyObject::MyObject(double value) : value_(value) {
}

MyObject::~MyObject() {
}

void MyObject::Init() {
Isolate* isolate = Isolate::GetCurrent();

// Prepare constructor template
Local<FunctionTemplate> tpl = FunctionTemplate::New(New);
tpl->SetClassName(String::NewSymbol("MyObject"));
tpl->InstanceTemplate()->SetInternalFieldCount(1);
<<<<<<< HEAD

constructor = Persistent<Function>::New(isolate, tpl->GetFunction());
=======
constructor = Persistent<Function>::New(tpl->GetFunction());
>>>>>>> upstream/v0.10
}
Handle<Value> MyObject::New(const Arguments& args) {
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);

MyObject* obj = new MyObject();
obj->val_ = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
obj->Wrap(args.This());

return args.This();
if (args.IsConstructCall()) {
// Invoked as constructor: `new MyObject(...)`
double value = args[0]->IsUndefined() ? 0 : args[0]->NumberValue();
MyObject* obj = new MyObject(value);
obj->Wrap(args.This());
return args.This();
} else {
// Invoked as plain function `MyObject(...)`, turn into construct call.
const int argc = 1;
Local<Value> argv[argc] = { args[0] };
return scope.Close(constructor->NewInstance(argc, argv));
}
}

Handle<Value> MyObject::NewInstance(const Arguments& args) {
@@ -52,6 +52,9 @@ of the signal, otherwise `null`.

Note that the child process stdio streams might still be open.

Also, note that node establishes signal handlers for `'SIGINT'` and `'SIGTERM`',
so it will not terminate due to receipt of those signals, it will exit.

See `waitpid(2)`.

### Event: 'close'
@@ -66,10 +69,9 @@ might share the same stdio streams.

### Event: 'disconnect'

This event is emitted after using the `.disconnect()` method in the parent or
in the child. After disconnecting it is no longer possible to send messages.
An alternative way to check if you can send messages is to see if the
`child.connected` property is `true`.
This event is emitted after calling the `.disconnect()` method in the parent
or in the child. After disconnecting it is no longer possible to send messages,
and the `.connected` property is false.

### Event: 'message'

@@ -121,6 +123,12 @@ Example:
console.log('Spawned child pid: ' + grep.pid);
grep.stdin.end();

### child.connected

* {Boolean} Set to false after `.disconnect' is called
If `.connected` is false, it is no longer possible to send messages.
### child.kill([signal])
* `signal` {String}
@@ -265,12 +273,15 @@ It is also recommended not to use `.maxConnections` in this condition.

### child.disconnect()

To close the IPC connection between parent and child use the
`child.disconnect()` method. This allows the child to exit gracefully since
there is no IPC channel keeping it alive. When calling this method the
`disconnect` event will be emitted in both parent and child, and the
`connected` flag will be set to `false`. Please note that you can also call
`process.disconnect()` in the child process.
Close the IPC channel between parent and child, allowing the child to exit
gracefully once there are no other connections keeping it alive. After calling
this method the `.connected` flag will be set to `false` in both the parent and
child, and it is no longer possible to send messages.

The 'disconnect' event will be emitted when there are no messages in the process
of being received, most likely immediately.

Note that you can also call `process.disconnect()` in the child process.

## child_process.spawn(command, [args], [options])

@@ -469,7 +480,7 @@ See also: `child_process.exec()` and `child_process.fork()`
understand the `-c` switch on UNIX or `/s /c` on Windows. On Windows,
command line parsing should be compatible with `cmd.exe`.)
* `timeout` {Number} (Default: 0)
* `maxBuffer` {Number} (Default: 200*1024)
* `maxBuffer` {Number} (Default: `200*1024`)
* `killSignal` {String} (Default: 'SIGTERM')
* `callback` {Function} called with the output when process terminates
* `error` {Error}
@@ -535,7 +546,7 @@ subshell but rather the specified file directly. This makes it slightly
leaner than `child_process.exec`. It has the same options.


## child\_process.fork(modulePath, [args], [options])
## child_process.fork(modulePath, [args], [options])

* `modulePath` {String} The module to run in the child
* `args` {Array} List of string arguments
@@ -544,20 +555,15 @@ leaner than `child_process.exec`. It has the same options.
* `env` {Object} Environment key-value pairs
* `encoding` {String} (Default: 'utf8')
* `execPath` {String} Executable used to create the child process
* `silent` {Boolean} If true, prevent stdout and stderr in the spawned node
process from being associated with the parent's (default is false)
* Return: ChildProcess object

This is a special case of the `spawn()` functionality for spawning Node
processes. In addition to having all the methods in a normal ChildProcess
instance, the returned object has a communication channel built-in. See
`child.send(message, [sendHandle])` for details.

By default the spawned Node process will have the stdout, stderr associated
with the parent's. To change this behavior set the `silent` property in the
`options` object to `true`.

The child process does not automatically exit once it's done, you need to call
`process.exit()` explicitly. This limitation may be lifted in the future.

These child Nodes are still whole new instances of V8. Assume at least 30ms
startup and 10mb memory for each new Node. That is, you cannot create many
thousands of them.