diff options
author | Michael Lumish <mlumish@google.com> | 2016-10-24 18:19:15 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-24 18:19:15 -0700 |
commit | eb56ce6581ef52fee51c5ff653c9621816d2c3cb (patch) | |
tree | 1531db8332a52ccb86e92c043964fee756992388 | |
parent | 408fc22c7011d2e8dd79f483020433d1adf6dc40 (diff) | |
parent | 952b99cf21016e8669ad28b00abe1030b975c6fd (diff) |
Merge pull request #7738 from murgatroid99/node_package_updates
Update Node library dependencies and change deprecated function calls
-rw-r--r-- | package.json | 25 | ||||
-rw-r--r-- | src/node/ext/byte_buffer.cc | 14 | ||||
-rw-r--r-- | src/node/ext/call.cc | 8 | ||||
-rw-r--r-- | src/node/ext/channel.cc | 4 | ||||
-rw-r--r-- | src/node/ext/server.cc | 2 | ||||
-rw-r--r-- | src/node/src/common.js | 2 | ||||
-rw-r--r-- | templates/package.json.template | 25 |
7 files changed, 43 insertions, 37 deletions
diff --git a/package.json b/package.json index 3f2f3f1873..cabb34ea33 100644 --- a/package.json +++ b/package.json @@ -25,24 +25,26 @@ "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" }, - "bundledDependencies": ["node-pre-gyp"], + "bundledDependencies": [ + "node-pre-gyp" + ], "dependencies": { "arguejs": "^0.2.3", - "lodash": "^3.9.3", + "lodash": "^4.15.0", "nan": "^2.0.0", - "protobufjs": "^4.0.0" + "node-pre-gyp": "^0.6.0", + "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^1.5.0", + "async": "^2.0.1", "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.3.21", + "istanbul": "^0.4.4", "jsdoc": "^3.3.2", "jshint": "^2.5.0", "minimist": "^1.1.0", - "mocha": "^2.3.4", - "mocha-jenkins-reporter": "^0.1.9", - "mustache": "^2.0.0", + "mocha": "^3.0.2", + "mocha-jenkins-reporter": "^0.2.3", "poisson-process": "^0.2.1" }, "engines": { @@ -50,11 +52,10 @@ }, "binary": { "module_name": "grpc_node", - "module_path": "./build/Release/", + "module_path": "src/node/extension_binary", "host": "https://storage.googleapis.com/", "remote_path": "grpc-precompiled-binaries/node/{name}/v{version}", - "package_name": "{node_abi}-{platform}-{arch}.tar.gz", - "module_path": "src/node/extension_binary" + "package_name": "{node_abi}-{platform}-{arch}.tar.gz" }, "files": [ "LICENSE", @@ -75,7 +76,7 @@ ], "main": "src/node/index.js", "license": "BSD-3-Clause", - "jshintConfig" : { + "jshintConfig": { "bitwise": true, "curly": true, "eqeqeq": true, diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc index a3f678f32c..ad7d0ec8c8 100644 --- a/src/node/ext/byte_buffer.cc +++ b/src/node/ext/byte_buffer.cc @@ -44,8 +44,8 @@ namespace grpc { namespace node { +using Nan::MaybeLocal; -using v8::Context; using v8::Function; using v8::Local; using v8::Object; @@ -89,15 +89,19 @@ Local<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) { Local<Value> MakeFastBuffer(Local<Value> slowBuffer) { Nan::EscapableHandleScope scope; Local<Object> globalObj = Nan::GetCurrentContext()->Global(); + MaybeLocal<Value> constructorValue = Nan::Get( + globalObj, Nan::New("Buffer").ToLocalChecked()); Local<Function> bufferConstructor = Local<Function>::Cast( - globalObj->Get(Nan::New("Buffer").ToLocalChecked())); - Local<Value> consArgs[3] = { + constructorValue.ToLocalChecked()); + const int argc = 3; + Local<Value> consArgs[argc] = { slowBuffer, Nan::New<Number>(::node::Buffer::Length(slowBuffer)), Nan::New<Number>(0) }; - Local<Object> fastBuffer = bufferConstructor->NewInstance(3, consArgs); - return scope.Escape(fastBuffer); + MaybeLocal<Object> fastBuffer = Nan::NewInstance(bufferConstructor, + argc, consArgs); + return scope.Escape(fastBuffer.ToLocalChecked()); } } // namespace node } // namespace grpc diff --git a/src/node/ext/call.cc b/src/node/ext/call.cc index 9f023b5883..fbab40dca1 100644 --- a/src/node/ext/call.cc +++ b/src/node/ext/call.cc @@ -613,16 +613,16 @@ NAN_METHOD(Call::New) { return Nan::ThrowTypeError("Call's fourth argument must be a string"); } call = new Call(wrapped_call); - info.This()->SetHiddenValue(Nan::New("channel_").ToLocalChecked(), - channel_object); + Nan::Set(info.This(), Nan::New("channel_").ToLocalChecked(), + channel_object); } call->Wrap(info.This()); info.GetReturnValue().Set(info.This()); } else { const int argc = 4; Local<Value> argv[argc] = {info[0], info[1], info[2], info[3]}; - MaybeLocal<Object> maybe_instance = constructor->GetFunction()->NewInstance( - argc, argv); + MaybeLocal<Object> maybe_instance = Nan::NewInstance( + constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { // There's probably a pending exception return; diff --git a/src/node/ext/channel.cc b/src/node/ext/channel.cc index 00fcca6dc8..db46533b14 100644 --- a/src/node/ext/channel.cc +++ b/src/node/ext/channel.cc @@ -206,8 +206,8 @@ NAN_METHOD(Channel::New) { } else { const int argc = 3; Local<Value> argv[argc] = {info[0], info[1], info[2]}; - MaybeLocal<Object> maybe_instance = constructor->GetFunction()->NewInstance( - argc, argv); + MaybeLocal<Object> maybe_instance = Nan::NewInstance( + constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { // There's probably a pending exception return; diff --git a/src/node/ext/server.cc b/src/node/ext/server.cc index dd1b777ac8..73c5ef2db3 100644 --- a/src/node/ext/server.cc +++ b/src/node/ext/server.cc @@ -169,7 +169,7 @@ NAN_METHOD(Server::New) { const int argc = 1; Local<Value> argv[argc] = {info[0]}; MaybeLocal<Object> maybe_instance = - constructor->GetFunction()->NewInstance(argc, argv); + Nan::NewInstance(constructor->GetFunction(), argc, argv); if (maybe_instance.IsEmpty()) { // There's probably a pending exception return; diff --git a/src/node/src/common.js b/src/node/src/common.js index 22159dd39f..c6c6d597a8 100644 --- a/src/node/src/common.js +++ b/src/node/src/common.js @@ -141,7 +141,7 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service, binaryAsBase64 = options.binaryAsBase64; longsAsStrings = options.longsAsStrings; } - return _.object(_.map(service.children, function(method) { + return _.fromPairs(_.map(service.children, function(method) { return [_.camelCase(method.name), { path: prefix + method.name, requestStream: method.requestStream, diff --git a/templates/package.json.template b/templates/package.json.template index e9596d4d4c..0829517f8f 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -27,24 +27,26 @@ "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" }, - "bundledDependencies": ["node-pre-gyp"], + "bundledDependencies": [ + "node-pre-gyp" + ], "dependencies": { "arguejs": "^0.2.3", - "lodash": "^3.9.3", + "lodash": "^4.15.0", "nan": "^2.0.0", - "protobufjs": "^4.0.0" + "node-pre-gyp": "^0.6.0", + "protobufjs": "^5.0.0" }, "devDependencies": { - "async": "^1.5.0", + "async": "^2.0.1", "google-auth-library": "^0.9.2", "google-protobuf": "^3.0.0", - "istanbul": "^0.3.21", + "istanbul": "^0.4.4", "jsdoc": "^3.3.2", "jshint": "^2.5.0", "minimist": "^1.1.0", - "mocha": "^2.3.4", - "mocha-jenkins-reporter": "^0.1.9", - "mustache": "^2.0.0", + "mocha": "^3.0.2", + "mocha-jenkins-reporter": "^0.2.3", "poisson-process": "^0.2.1" }, "engines": { @@ -52,11 +54,10 @@ }, "binary": { "module_name": "grpc_node", - "module_path": "./build/Release/", + "module_path": "src/node/extension_binary", "host": "https://storage.googleapis.com/", "remote_path": "grpc-precompiled-binaries/node/{name}/v{version}", - "package_name": "{node_abi}-{platform}-{arch}.tar.gz", - "module_path": "src/node/extension_binary" + "package_name": "{node_abi}-{platform}-{arch}.tar.gz" }, "files": [ "LICENSE", @@ -77,7 +78,7 @@ ], "main": "src/node/index.js", "license": "BSD-3-Clause", - "jshintConfig" : { + "jshintConfig": { "bitwise": true, "curly": true, "eqeqeq": true, |