Update Node library dependencies and change deprecated function calls

pull/7738/head
murgatroid99 9 years ago
parent 04132ae14a
commit c0a64cda94
  1. 25
      package.json
  2. 14
      src/node/ext/byte_buffer.cc
  3. 8
      src/node/ext/call.cc
  4. 4
      src/node/ext/channel.cc
  5. 4
      src/node/ext/node_grpc.cc
  6. 2
      src/node/ext/server.cc
  7. 2
      src/node/src/common.js
  8. 25
      templates/package.json.template

@ -25,24 +25,26 @@
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
}, },
"bundledDependencies": ["node-pre-gyp"], "bundledDependencies": [
"node-pre-gyp"
],
"dependencies": { "dependencies": {
"arguejs": "^0.2.3", "arguejs": "^0.2.3",
"lodash": "^3.9.3", "lodash": "^4.15.0",
"nan": "^2.0.0", "nan": "^2.0.0",
"protobufjs": "^4.0.0" "node-pre-gyp": "^0.6.0",
"protobufjs": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"async": "^1.5.0", "async": "^2.0.1",
"google-auth-library": "^0.9.2", "google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0", "google-protobuf": "^3.0.0",
"istanbul": "^0.3.21", "istanbul": "^0.4.4",
"jsdoc": "^3.3.2", "jsdoc": "^3.3.2",
"jshint": "^2.5.0", "jshint": "^2.5.0",
"minimist": "^1.1.0", "minimist": "^1.1.0",
"mocha": "^2.3.4", "mocha": "^3.0.2",
"mocha-jenkins-reporter": "^0.1.9", "mocha-jenkins-reporter": "^0.2.3",
"mustache": "^2.0.0",
"poisson-process": "^0.2.1" "poisson-process": "^0.2.1"
}, },
"engines": { "engines": {
@ -50,11 +52,10 @@
}, },
"binary": { "binary": {
"module_name": "grpc_node", "module_name": "grpc_node",
"module_path": "./build/Release/", "module_path": "src/node/extension_binary",
"host": "https://storage.googleapis.com/", "host": "https://storage.googleapis.com/",
"remote_path": "grpc-precompiled-binaries/node/{name}/v{version}", "remote_path": "grpc-precompiled-binaries/node/{name}/v{version}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz", "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
"module_path": "src/node/extension_binary"
}, },
"files": [ "files": [
"LICENSE", "LICENSE",
@ -75,7 +76,7 @@
], ],
"main": "src/node/index.js", "main": "src/node/index.js",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"jshintConfig" : { "jshintConfig": {
"bitwise": true, "bitwise": true,
"curly": true, "curly": true,
"eqeqeq": true, "eqeqeq": true,

@ -44,8 +44,8 @@
namespace grpc { namespace grpc {
namespace node { namespace node {
using Nan::MaybeLocal;
using v8::Context;
using v8::Function; using v8::Function;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
@ -89,15 +89,19 @@ Local<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
Local<Value> MakeFastBuffer(Local<Value> slowBuffer) { Local<Value> MakeFastBuffer(Local<Value> slowBuffer) {
Nan::EscapableHandleScope scope; Nan::EscapableHandleScope scope;
Local<Object> globalObj = Nan::GetCurrentContext()->Global(); Local<Object> globalObj = Nan::GetCurrentContext()->Global();
MaybeLocal<Value> constructorValue = Nan::Get(
globalObj, Nan::New("Buffer").ToLocalChecked());
Local<Function> bufferConstructor = Local<Function>::Cast( Local<Function> bufferConstructor = Local<Function>::Cast(
globalObj->Get(Nan::New("Buffer").ToLocalChecked())); constructorValue.ToLocalChecked());
Local<Value> consArgs[3] = { const int argc = 3;
Local<Value> consArgs[argc] = {
slowBuffer, slowBuffer,
Nan::New<Number>(::node::Buffer::Length(slowBuffer)), Nan::New<Number>(::node::Buffer::Length(slowBuffer)),
Nan::New<Number>(0) Nan::New<Number>(0)
}; };
Local<Object> fastBuffer = bufferConstructor->NewInstance(3, consArgs); MaybeLocal<Object> fastBuffer = Nan::NewInstance(bufferConstructor,
return scope.Escape(fastBuffer); argc, consArgs);
return scope.Escape(fastBuffer.ToLocalChecked());
} }
} // namespace node } // namespace node
} // namespace grpc } // namespace grpc

@ -613,16 +613,16 @@ NAN_METHOD(Call::New) {
return Nan::ThrowTypeError("Call's fourth argument must be a string"); return Nan::ThrowTypeError("Call's fourth argument must be a string");
} }
call = new Call(wrapped_call); call = new Call(wrapped_call);
info.This()->SetHiddenValue(Nan::New("channel_").ToLocalChecked(), Nan::Set(info.This(), Nan::New("channel_").ToLocalChecked(),
channel_object); channel_object);
} }
call->Wrap(info.This()); call->Wrap(info.This());
info.GetReturnValue().Set(info.This()); info.GetReturnValue().Set(info.This());
} else { } else {
const int argc = 4; const int argc = 4;
Local<Value> argv[argc] = {info[0], info[1], info[2], info[3]}; Local<Value> argv[argc] = {info[0], info[1], info[2], info[3]};
MaybeLocal<Object> maybe_instance = constructor->GetFunction()->NewInstance( MaybeLocal<Object> maybe_instance = Nan::NewInstance(
argc, argv); constructor->GetFunction(), argc, argv);
if (maybe_instance.IsEmpty()) { if (maybe_instance.IsEmpty()) {
// There's probably a pending exception // There's probably a pending exception
return; return;

@ -206,8 +206,8 @@ NAN_METHOD(Channel::New) {
} else { } else {
const int argc = 3; const int argc = 3;
Local<Value> argv[argc] = {info[0], info[1], info[2]}; Local<Value> argv[argc] = {info[0], info[1], info[2]};
MaybeLocal<Object> maybe_instance = constructor->GetFunction()->NewInstance( MaybeLocal<Object> maybe_instance = Nan::NewInstance(
argc, argv); constructor->GetFunction(), argc, argv);
if (maybe_instance.IsEmpty()) { if (maybe_instance.IsEmpty()) {
// There's probably a pending exception // There's probably a pending exception
return; return;

@ -261,8 +261,8 @@ void InitLogConstants(Local<Object> exports) {
Nan::HandleScope scope; Nan::HandleScope scope;
Local<Object> log_verbosity = Nan::New<Object>(); Local<Object> log_verbosity = Nan::New<Object>();
Nan::Set(exports, Nan::New("logVerbosity").ToLocalChecked(), log_verbosity); Nan::Set(exports, Nan::New("logVerbosity").ToLocalChecked(), log_verbosity);
Local<Value> DEBUG(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_DEBUG)); Local<Value> DEBUG_LOG(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_DEBUG));
Nan::Set(log_verbosity, Nan::New("DEBUG").ToLocalChecked(), DEBUG); Nan::Set(log_verbosity, Nan::New("DEBUG").ToLocalChecked(), DEBUG_LOG);
Local<Value> INFO(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_INFO)); Local<Value> INFO(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_INFO));
Nan::Set(log_verbosity, Nan::New("INFO").ToLocalChecked(), INFO); Nan::Set(log_verbosity, Nan::New("INFO").ToLocalChecked(), INFO);
Local<Value> LOG_ERROR(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_ERROR)); Local<Value> LOG_ERROR(Nan::New<Uint32, uint32_t>(GPR_LOG_SEVERITY_ERROR));

@ -169,7 +169,7 @@ NAN_METHOD(Server::New) {
const int argc = 1; const int argc = 1;
Local<Value> argv[argc] = {info[0]}; Local<Value> argv[argc] = {info[0]};
MaybeLocal<Object> maybe_instance = MaybeLocal<Object> maybe_instance =
constructor->GetFunction()->NewInstance(argc, argv); Nan::NewInstance(constructor->GetFunction(), argc, argv);
if (maybe_instance.IsEmpty()) { if (maybe_instance.IsEmpty()) {
// There's probably a pending exception // There's probably a pending exception
return; return;

@ -141,7 +141,7 @@ exports.getProtobufServiceAttrs = function getProtobufServiceAttrs(service,
binaryAsBase64 = options.binaryAsBase64; binaryAsBase64 = options.binaryAsBase64;
longsAsStrings = options.longsAsStrings; longsAsStrings = options.longsAsStrings;
} }
return _.object(_.map(service.children, function(method) { return _.fromPairs(_.map(service.children, function(method) {
return [_.camelCase(method.name), { return [_.camelCase(method.name), {
path: prefix + method.name, path: prefix + method.name,
requestStream: method.requestStream, requestStream: method.requestStream,

@ -27,24 +27,26 @@
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test",
"install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build" "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build"
}, },
"bundledDependencies": ["node-pre-gyp"], "bundledDependencies": [
"node-pre-gyp"
],
"dependencies": { "dependencies": {
"arguejs": "^0.2.3", "arguejs": "^0.2.3",
"lodash": "^3.9.3", "lodash": "^4.15.0",
"nan": "^2.0.0", "nan": "^2.0.0",
"protobufjs": "^4.0.0" "node-pre-gyp": "^0.6.0",
"protobufjs": "^5.0.0"
}, },
"devDependencies": { "devDependencies": {
"async": "^1.5.0", "async": "^2.0.1",
"google-auth-library": "^0.9.2", "google-auth-library": "^0.9.2",
"google-protobuf": "^3.0.0", "google-protobuf": "^3.0.0",
"istanbul": "^0.3.21", "istanbul": "^0.4.4",
"jsdoc": "^3.3.2", "jsdoc": "^3.3.2",
"jshint": "^2.5.0", "jshint": "^2.5.0",
"minimist": "^1.1.0", "minimist": "^1.1.0",
"mocha": "^2.3.4", "mocha": "^3.0.2",
"mocha-jenkins-reporter": "^0.1.9", "mocha-jenkins-reporter": "^0.2.3",
"mustache": "^2.0.0",
"poisson-process": "^0.2.1" "poisson-process": "^0.2.1"
}, },
"engines": { "engines": {
@ -52,11 +54,10 @@
}, },
"binary": { "binary": {
"module_name": "grpc_node", "module_name": "grpc_node",
"module_path": "./build/Release/", "module_path": "src/node/extension_binary",
"host": "https://storage.googleapis.com/", "host": "https://storage.googleapis.com/",
"remote_path": "grpc-precompiled-binaries/node/{name}/v{version}", "remote_path": "grpc-precompiled-binaries/node/{name}/v{version}",
"package_name": "{node_abi}-{platform}-{arch}.tar.gz", "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
"module_path": "src/node/extension_binary"
}, },
"files": [ "files": [
"LICENSE", "LICENSE",
@ -77,7 +78,7 @@
], ],
"main": "src/node/index.js", "main": "src/node/index.js",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"jshintConfig" : { "jshintConfig": {
"bitwise": true, "bitwise": true,
"curly": true, "curly": true,
"eqeqeq": true, "eqeqeq": true,

Loading…
Cancel
Save