Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:
- TARGET_ARCH="ia32"

node_js:
- "12"
- "10"
- "8"

Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ environment:
GYP_MSVS_VERSION: 2015
matrix:
# Node.js
- nodejs_version: "12"
- nodejs_version: "10"
- nodejs_version: "8"

Expand Down
36 changes: 18 additions & 18 deletions generate/templates/manual/clone/clone.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NAN_METHOD(GitClone::Clone) {
// start convert_from_v8 block
const char *from_url = NULL;

String::Utf8Value url(info[0]->ToString());
Nan::Utf8String url(Nan::To<v8::String>(info[0]).ToLocalChecked());
// malloc with one extra byte so we can add the terminating null character
// C-strings expect:
from_url = (const char *)malloc(url.length() + 1);
Expand All @@ -50,7 +50,7 @@ NAN_METHOD(GitClone::Clone) {
// start convert_from_v8 block
const char *from_local_path = NULL;

String::Utf8Value local_path(info[1]->ToString());
Nan::Utf8String local_path(Nan::To<v8::String>(info[1]).ToLocalChecked());
// malloc with one extra byte so we can add the terminating null character
// C-strings expect:
from_local_path = (const char *)malloc(local_path.length() + 1);
Expand All @@ -67,7 +67,7 @@ NAN_METHOD(GitClone::Clone) {
// start convert_from_v8 block
const git_clone_options *from_options = NULL;
if (info[2]->IsObject()) {
from_options = Nan::ObjectWrap::Unwrap<GitCloneOptions>(info[2]->ToObject())
from_options = Nan::ObjectWrap::Unwrap<GitCloneOptions>(Nan::To<v8::Object>(info[2]).ToLocalChecked())
->GetValue();
} else {
from_options = 0;
Expand All @@ -80,11 +80,11 @@ NAN_METHOD(GitClone::Clone) {
CloneWorker *worker = new CloneWorker(baton, callback);

if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("url", info[0]->ToObject());
worker->SaveToPersistent("url", Nan::To<v8::Object>(info[0]).ToLocalChecked());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("local_path", info[1]->ToObject());
worker->SaveToPersistent("local_path", Nan::To<v8::Object>(info[1]).ToLocalChecked());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("options", info[2]->ToObject());
worker->SaveToPersistent("options", Nan::To<v8::Object>(info[2]).ToLocalChecked());

AsyncLibgit2QueueWorker(worker);
return;
Expand Down Expand Up @@ -140,12 +140,12 @@ void GitClone::CloneWorker::HandleOKCallback() {
if (baton->error) {
v8::Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
err = Nan::To<v8::Object>(Nan::Error(baton->error->message)).ToLocalChecked();
} else {
err = Nan::Error("Method clone has thrown an error.")->ToObject();
err = Nan::To<v8::Object>(Nan::Error("Method clone has thrown an error.")).ToLocalChecked();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("Clone.clone").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand All @@ -168,24 +168,24 @@ void GitClone::CloneWorker::HandleOKCallback() {
continue;
}

v8::Local<v8::Object> nodeObj = node->ToObject();
v8::Local<v8::Object> nodeObj = Nan::To<v8::Object>(node).ToLocalChecked();
v8::Local<v8::Value> checkValue = GetPrivate(
nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked());

if (!checkValue.IsEmpty() && !checkValue->IsNull() &&
!checkValue->IsUndefined()) {
v8::Local<v8::Value> argv[1] = {checkValue->ToObject()};
v8::Local<v8::Value> argv[1] = {Nan::To<v8::Object>(checkValue).ToLocalChecked()};
callback->Call(1, argv, async_resource);
callbackFired = true;
break;
}

v8::Local<v8::Array> properties = nodeObj->GetPropertyNames();
v8::Local<v8::Array> properties = Nan::GetPropertyNames(nodeObj).ToLocalChecked();
for (unsigned int propIndex = 0; propIndex < properties->Length();
++propIndex) {
v8::Local<v8::String> propName =
properties->Get(propIndex)->ToString();
v8::Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
Nan::To<v8::String>(Nan::Get(properties, propIndex).ToLocalChecked()).ToLocalChecked();
v8::Local<v8::Value> nodeToQueue = Nan::Get(nodeObj, propName).ToLocalChecked();
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
Expand All @@ -194,10 +194,10 @@ void GitClone::CloneWorker::HandleOKCallback() {

if (!callbackFired) {
v8::Local<v8::Object> err =
Nan::Error("Method clone has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(),
Nan::To<v8::Object>(Nan::Error("Method clone has thrown an error.")).ToLocalChecked();
Nan::Set(err, Nan::New("errno").ToLocalChecked(),
Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("Clone.clone").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand Down
18 changes: 9 additions & 9 deletions generate/templates/manual/commit/extract_signature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ NAN_METHOD(GitCommit::ExtractSignature)
baton->error = NULL;
baton->signature = GIT_BUF_INIT_CONST(NULL, 0);
baton->signed_data = GIT_BUF_INIT_CONST(NULL, 0);
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
baton->repo = Nan::ObjectWrap::Unwrap<GitRepository>(Nan::To<v8::Object>(info[0]).ToLocalChecked())->GetValue();

// baton->commit_id
if (info[1]->IsString()) {
String::Utf8Value oidString(info[1]->ToString());
Nan::Utf8String oidString(Nan::To<v8::String>(info[1]).ToLocalChecked());
baton->commit_id = (git_oid *)malloc(sizeof(git_oid));
if (git_oid_fromstr(baton->commit_id, (const char *)strdup(*oidString)) != GIT_OK) {
free(baton->commit_id);
Expand All @@ -44,12 +44,12 @@ NAN_METHOD(GitCommit::ExtractSignature)
}
}
} else {
baton->commit_id = Nan::ObjectWrap::Unwrap<GitOid>(info[1]->ToObject())->GetValue();
baton->commit_id = Nan::ObjectWrap::Unwrap<GitOid>(Nan::To<v8::Object>(info[1]).ToLocalChecked())->GetValue();
}

// baton->field
if (info[2]->IsString()) {
String::Utf8Value field(info[2]->ToString());
Nan::Utf8String field(Nan::To<v8::String>(info[2]).ToLocalChecked());
baton->field = (char *)malloc(field.length() + 1);
memcpy((void *)baton->field, *field, field.length());
baton->field[field.length()] = 0;
Expand All @@ -65,8 +65,8 @@ NAN_METHOD(GitCommit::ExtractSignature)
}

ExtractSignatureWorker *worker = new ExtractSignatureWorker(baton, callback);
worker->SaveToPersistent("repo", info[0]->ToObject());
worker->SaveToPersistent("commit_id", info[1]->ToObject());
worker->SaveToPersistent("repo", Nan::To<v8::Object>(info[0]).ToLocalChecked());
worker->SaveToPersistent("commit_id", Nan::To<v8::Object>(info[1]).ToLocalChecked());
Nan::AsyncQueueWorker(worker);
return;
}
Expand Down Expand Up @@ -132,9 +132,9 @@ void GitCommit::ExtractSignatureWorker::HandleOKCallback()
}
else if (baton->error_code < 0)
{
Local<v8::Object> err = Nan::Error("Extract Signature has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(), Nan::New("Commit.extractSignature").ToLocalChecked());
Local<v8::Object> err = Nan::To<v8::Object>(Nan::Error("Extract Signature has thrown an error.")).ToLocalChecked();
Nan::Set(err, Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(), Nan::New("Commit.extractSignature").ToLocalChecked());
Local<v8::Value> argv[1] = {
err
};
Expand Down
52 changes: 26 additions & 26 deletions generate/templates/manual/filter_list/load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ NAN_METHOD(GitFilterList::Load) {
// start convert_from_v8 block
git_repository *from_repo = NULL;
from_repo =
Nan::ObjectWrap::Unwrap<GitRepository>(info[0]->ToObject())->GetValue();
Nan::ObjectWrap::Unwrap<GitRepository>(Nan::To<v8::Object>(info[0]).ToLocalChecked())->GetValue();
// end convert_from_v8 block
baton->repo = from_repo;
// start convert_from_v8 block
git_blob *from_blob = NULL;
if (info[1]->IsObject()) {
from_blob =
Nan::ObjectWrap::Unwrap<GitBlob>(info[1]->ToObject())->GetValue();
Nan::ObjectWrap::Unwrap<GitBlob>(Nan::To<v8::Object>(info[1]).ToLocalChecked())->GetValue();
} else {
from_blob = 0;
}
Expand All @@ -63,7 +63,7 @@ NAN_METHOD(GitFilterList::Load) {
// start convert_from_v8 block
const char *from_path = NULL;

String::Utf8Value path(info[2]->ToString());
Nan::Utf8String path(Nan::To<v8::String>(info[2]).ToLocalChecked());
// malloc with one extra byte so we can add the terminating null character
// C-strings expect:
from_path = (const char *)malloc(path.length() + 1);
Expand Down Expand Up @@ -93,15 +93,15 @@ NAN_METHOD(GitFilterList::Load) {
LoadWorker *worker = new LoadWorker(baton, callback);

if (!info[0]->IsUndefined() && !info[0]->IsNull())
worker->SaveToPersistent("repo", info[0]->ToObject());
worker->SaveToPersistent("repo", Nan::To<v8::Object>(info[0]).ToLocalChecked());
if (!info[1]->IsUndefined() && !info[1]->IsNull())
worker->SaveToPersistent("blob", info[1]->ToObject());
worker->SaveToPersistent("blob", Nan::To<v8::Object>(info[1]).ToLocalChecked());
if (!info[2]->IsUndefined() && !info[2]->IsNull())
worker->SaveToPersistent("path", info[2]->ToObject());
worker->SaveToPersistent("path", Nan::To<v8::Object>(info[2]).ToLocalChecked());
if (!info[3]->IsUndefined() && !info[3]->IsNull())
worker->SaveToPersistent("mode", info[3]->ToObject());
worker->SaveToPersistent("mode", Nan::To<v8::Object>(info[3]).ToLocalChecked());
if (!info[4]->IsUndefined() && !info[4]->IsNull())
worker->SaveToPersistent("flags", info[4]->ToObject());
worker->SaveToPersistent("flags", Nan::To<v8::Object>(info[4]).ToLocalChecked());

AsyncLibgit2QueueWorker(worker);
return;
Expand Down Expand Up @@ -134,17 +134,17 @@ void GitFilterList::LoadWorker::HandleOKCallback() {
// GitFilterList baton->filters
v8::Local<v8::Array> owners = Nan::New<Array>(0);
v8::Local<v8::Object> filterRegistry = Nan::New(GitFilterRegistry::persistentHandle);
v8::Local<v8::Array> propertyNames = filterRegistry->GetPropertyNames();
v8::Local<v8::Array> propertyNames = Nan::GetPropertyNames(filterRegistry).ToLocalChecked();

Nan::Set(
owners,
Nan::New<Number>(0),
this->GetFromPersistent("repo")->ToObject()
Nan::To<v8::Object>(this->GetFromPersistent("repo")).ToLocalChecked()
);

for (uint32_t index = 0; index < propertyNames->Length(); ++index) {
v8::Local<v8::String> propertyName = propertyNames->Get(index)->ToString();
String::Utf8Value propertyNameAsUtf8Value(propertyName);
v8::Local<v8::String> propertyName = Nan::To<v8::String>(Nan::Get(propertyNames, index).ToLocalChecked()).ToLocalChecked();
Nan::Utf8String propertyNameAsUtf8Value(propertyName);
const char *propertyNameAsCString = *propertyNameAsUtf8Value;

bool isNotMethodOnRegistry = strcmp("register", propertyNameAsCString)
Expand All @@ -153,12 +153,12 @@ void GitFilterList::LoadWorker::HandleOKCallback() {
Nan::Set(
owners,
Nan::New<Number>(owners->Length()),
filterRegistry->Get(propertyName)
Nan::Get(filterRegistry, propertyName).ToLocalChecked()
);
}
}

to = GitFilterList::New(baton->filters, true, owners->ToObject());
to = GitFilterList::New(baton->filters, true, Nan::To<v8::Object>(owners).ToLocalChecked());
} else {
to = Nan::Null();
}
Expand All @@ -172,12 +172,12 @@ void GitFilterList::LoadWorker::HandleOKCallback() {
if (baton->error) {
v8::Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
err = Nan::To<v8::Object>(Nan::Error(baton->error->message)).ToLocalChecked();
} else {
err = Nan::Error("Method load has thrown an error.")->ToObject();
err = Nan::To<v8::Object>(Nan::Error("Method load has thrown an error.")).ToLocalChecked();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("FilterList.load").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand All @@ -202,24 +202,24 @@ void GitFilterList::LoadWorker::HandleOKCallback() {
continue;
}

v8::Local<v8::Object> nodeObj = node->ToObject();
v8::Local<v8::Object> nodeObj = Nan::To<v8::Object>(node).ToLocalChecked();
v8::Local<v8::Value> checkValue = GetPrivate(
nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked());

if (!checkValue.IsEmpty() && !checkValue->IsNull() &&
!checkValue->IsUndefined()) {
v8::Local<v8::Value> argv[1] = {checkValue->ToObject()};
v8::Local<v8::Value> argv[1] = {Nan::To<v8::Object>(checkValue).ToLocalChecked()};
callback->Call(1, argv, async_resource);
callbackFired = true;
break;
}

v8::Local<v8::Array> properties = nodeObj->GetPropertyNames();
v8::Local<v8::Array> properties = Nan::GetPropertyNames(nodeObj).ToLocalChecked();
for (unsigned int propIndex = 0; propIndex < properties->Length();
++propIndex) {
v8::Local<v8::String> propName =
properties->Get(propIndex)->ToString();
v8::Local<v8::Value> nodeToQueue = nodeObj->Get(propName);
Nan::To<v8::String>(Nan::Get(properties, propIndex).ToLocalChecked()).ToLocalChecked();
v8::Local<v8::Value> nodeToQueue = Nan::Get(nodeObj, propName).ToLocalChecked();
if (!nodeToQueue->IsUndefined()) {
workerArguments.push(nodeToQueue);
}
Expand All @@ -228,10 +228,10 @@ void GitFilterList::LoadWorker::HandleOKCallback() {

if (!callbackFired) {
v8::Local<v8::Object> err =
Nan::Error("Method load has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(),
Nan::To<v8::Object>(Nan::Error("Method load has thrown an error.")).ToLocalChecked();
Nan::Set(err, Nan::New("errno").ToLocalChecked(),
Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("FilterList.load").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand Down
14 changes: 7 additions & 7 deletions generate/templates/manual/filter_source/repo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ void GitFilterSource::RepoWorker::HandleOKCallback() {
if (baton->error) {
v8::Local<v8::Object> err;
if (baton->error->message) {
err = Nan::Error(baton->error->message)->ToObject();
err = Nan::To<v8::Object>(Nan::Error(baton->error->message)).ToLocalChecked();
} else {
err = Nan::Error("Method repo has thrown an error.")->ToObject();
err = Nan::To<v8::Object>(Nan::Error("Method repo has thrown an error.")).ToLocalChecked();
}
err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code));
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("FilterSource.repo").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand All @@ -74,10 +74,10 @@ void GitFilterSource::RepoWorker::HandleOKCallback() {
free((void *)baton->error);
} else if (baton->error_code < 0) {
v8::Local<v8::Object> err =
Nan::Error("Method repo has thrown an error.")->ToObject();
err->Set(Nan::New("errno").ToLocalChecked(),
Nan::To<v8::Object>(Nan::Error("Method repo has thrown an error.")).ToLocalChecked();
Nan::Set(err, Nan::New("errno").ToLocalChecked(),
Nan::New(baton->error_code));
err->Set(Nan::New("errorFunction").ToLocalChecked(),
Nan::Set(err, Nan::New("errorFunction").ToLocalChecked(),
Nan::New("FilterSource.repo").ToLocalChecked());
v8::Local<v8::Value> argv[1] = {err};
callback->Call(1, argv, async_resource);
Expand Down
4 changes: 2 additions & 2 deletions generate/templates/manual/include/str_array_converter.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class StrArrayConverter {
static git_strarray *Convert (v8::Local<v8::Value> val);

private:
static git_strarray *ConvertArray(Array *val);
static git_strarray *ConvertString(v8::Local<String> val);
static git_strarray *ConvertArray(v8::Local<v8::Array> val);
static git_strarray *ConvertString(v8::Local<v8::String> val);
static git_strarray *AllocStrArray(const size_t count);
static git_strarray *ConstructStrArray(int argc, char** argv);
};
Expand Down
Loading