diff --git a/package.json b/package.json index 0dd3d5d..75cdd59 100644 --- a/package.json +++ b/package.json @@ -35,11 +35,11 @@ "package_name": "{node_abi}-{platform}-{arch}.tar.gz" }, "dependencies": { - "nan": "^2.10.0", - "node-pre-gyp": "^0.10.2" + "nan": "^2.14.1", + "node-pre-gyp": "^0.10.3" }, "devDependencies": { - "aws-sdk": "^2.266.1", + "aws-sdk": "^2.682.0", "geojson-coords": "0.0.0", "mocha": "^2.5.3", "osm-testdata": "^1.0.0", diff --git a/src/apply.cpp b/src/apply.cpp old mode 100644 new mode 100755 index 38adbf5..ec639f9 --- a/src/apply.cpp +++ b/src/apply.cpp @@ -161,7 +161,7 @@ namespace node_osmium { Nan::ThrowTypeError(Nan::New("please provide handler objects as second and further parameters to apply()").ToLocalChecked()); return; } - auto obj = info[i]->ToObject(); + auto obj = info[i]->ToObject(info.GetIsolate()->GetCurrentContext()).ToLocalChecked(); if (Nan::New(JSHandler::constructor)->HasInstance(obj)) { handlers.push_back(unwrap(obj)); } else if (Nan::New(LocationHandlerWrap::constructor)->HasInstance(obj)) { @@ -172,7 +172,7 @@ namespace node_osmium { } try { - auto source = info[0]->ToObject(); + auto source = info[0]->ToObject(info.GetIsolate()->GetCurrentContext()).ToLocalChecked(); if (Nan::New(BasicReaderWrap::constructor)->HasInstance(source)) { osmium::io::Reader& reader = unwrap(source); diff --git a/src/buffer_wrap.cpp b/src/buffer_wrap.cpp old mode 100644 new mode 100755 index 31696f8..4077a9e --- a/src/buffer_wrap.cpp +++ b/src/buffer_wrap.cpp @@ -28,7 +28,7 @@ namespace node_osmium { Nan::SetPrototypeMethod(lcons, "next", next); Nan::SetPrototypeMethod(lcons, "filter_point_in_time", filter_point_in_time); Nan::SetPrototypeMethod(lcons, "create_node_buffer", create_node_buffer); - target->Set(Nan::New(symbol_Buffer), lcons->GetFunction()); + target->Set(Nan::New(symbol_Buffer), lcons->GetFunction(target->CreationContext()).ToLocalChecked()); constructor.Reset(lcons); } @@ -39,7 +39,7 @@ namespace node_osmium { info.GetReturnValue().Set(info.This()); return; } else if (info.Length() == 1 && info[0]->IsObject()) { - auto obj = info[0]->ToObject(); + auto obj = info[0]->ToObject(info.GetIsolate()->GetCurrentContext()).ToLocalChecked(); if (node::Buffer::HasInstance(obj)) { try { osmium::memory::Buffer buffer(reinterpret_cast(node::Buffer::Data(obj)), node::Buffer::Length(obj)); @@ -76,7 +76,7 @@ namespace node_osmium { int filter_id = 0; if (info.Length() == 1 && info[0]->IsInt32()) { - filter_id = info[0]->Int32Value(); + filter_id = info[0]->Int32Value(Nan::GetCurrentContext()).ToChecked(); } while (buffer_wrap->m_iterator != buffer_wrap->m_this.end()) { @@ -130,12 +130,12 @@ namespace node_osmium { osmium::Timestamp point_in_time; if (info[0]->IsInt32()) { - point_in_time = info[0]->Int32Value(); + point_in_time = info[0]->Int32Value(Nan::GetCurrentContext()).ToChecked(); } else if (info[0]->IsString()) { Nan::Utf8String time_string { info[0] }; point_in_time = osmium::Timestamp(*time_string); } else if (info[0]->IsDate()) { - point_in_time = osmium::Timestamp(static_cast(v8::Date::Cast(*info[0])->NumberValue() / 1000)); + point_in_time = osmium::Timestamp(static_cast(v8::Date::Cast(*info[0])->NumberValue(info.GetIsolate()->GetCurrentContext()).ToChecked() / 1000)); } typedef osmium::DiffIterator> diff_iterator; @@ -183,7 +183,7 @@ namespace node_osmium { Nan::MaybeLocal maybe_local = Nan::NewInstance(buffer_constructor, 3, constructor_info); if (maybe_local.IsEmpty()) Nan::ThrowError("Could not create new Buffer instance"); - info.GetReturnValue().Set(maybe_local.ToLocalChecked()->ToObject()); + info.GetReturnValue().Set(maybe_local.ToLocalChecked()); return; } diff --git a/src/file_wrap.cpp b/src/file_wrap.cpp old mode 100644 new mode 100755 index bedc923..47ced57 --- a/src/file_wrap.cpp +++ b/src/file_wrap.cpp @@ -15,7 +15,8 @@ namespace node_osmium { v8::Local lcons = Nan::New(FileWrap::New); lcons->InstanceTemplate()->SetInternalFieldCount(1); lcons->SetClassName(Nan::New(symbol_File)); - target->Set(Nan::New(symbol_File), lcons->GetFunction()); + v8::Local context = target->CreationContext(); + target->Set(Nan::New(symbol_File), lcons->GetFunction(context).ToLocalChecked()); constructor.Reset(lcons); } @@ -42,12 +43,13 @@ namespace node_osmium { try { osmium::io::File file; + v8::Local context = info.GetIsolate()->GetCurrentContext(); if (info[0]->IsString()) { Nan::Utf8String filename { info[0] }; file = osmium::io::File(*filename, format); - } else if (info[0]->IsObject() && node::Buffer::HasInstance(info[0]->ToObject())) { - auto source = info[0]->ToObject(); + } else if (info[0]->IsObject() && node::Buffer::HasInstance(info[0]->ToObject(context).ToLocalChecked())) { + auto source = info[0]->ToObject(context).ToLocalChecked(); file = osmium::io::File(node::Buffer::Data(source), node::Buffer::Length(source), format); } else { Nan::ThrowTypeError(Nan::New("first argument to File constructor must be a string (filename) or node.Buffer").ToLocalChecked()); diff --git a/src/filter.cpp b/src/filter.cpp old mode 100644 new mode 100755 index fe03ae4..fde0cb4 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -20,7 +20,8 @@ namespace node_osmium { NAN_METHOD(Filter::register_filter) { if (info.Length() == 1 && info[0]->IsObject()) { - auto object = info[0]->ToObject(); + v8::Local context = info.GetIsolate()->GetCurrentContext(); + auto object = info[0]->ToObject(context).ToLocalChecked(); // XXX check that object is of class Filter Filter::all_filters.emplace_back(new Filter(object)); assert(Filter::all_filters.size() < std::numeric_limits::max());