Skip to content

Commit

Permalink
Fixed build with newer Node.js versions (#205)
Browse files Browse the repository at this point in the history
Co-authored-by: Michael Dawson <mdawson@devrus.com>
  • Loading branch information
Root-Core and mhdawson authored Jul 21, 2023
1 parent 7c045d3 commit 661cd59
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
operating-system: [ubuntu-latest, windows-2019, macos-latest]

steps:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
build_with_cmake/
node_modules/
Debug/
Release/
Expand Down
3 changes: 2 additions & 1 deletion 1_hello_world/nan/hello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ void Method(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}

void Init(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();
exports->Set(context,
Nan::New("hello").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(Method)
Expand Down
3 changes: 2 additions & 1 deletion 2_function_arguments/nan/addon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ void Add(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}

void Init(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();
exports->Set(context,
Nan::New("add").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(Add)
Expand Down
3 changes: 2 additions & 1 deletion 4_object_factory/nan/addon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ void CreateObject(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}

void Init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();
module->Set(context,
Nan::New("exports").ToLocalChecked(),
Nan::New<v8::FunctionTemplate>(CreateObject)
Expand Down
3 changes: 2 additions & 1 deletion 6_object_wrap/nan/myobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ MyObject::MyObject(double value) : value_(value) {}
MyObject::~MyObject() {}

void MyObject::Init(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();
Nan::HandleScope scope;

// Prepare constructor template
Expand Down
3 changes: 2 additions & 1 deletion 7_factory_wrap/nan/addon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ void CreateObject(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}

void InitAll(v8::Local<v8::Object> exports, v8::Local<v8::Object> module) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();

Nan::HandleScope scope;

Expand Down
3 changes: 2 additions & 1 deletion 8_passing_wrapped/nan/addon.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ void Add(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}

void InitAll(v8::Local<v8::Object> exports) {
v8::Local<v8::Context> context = exports->CreationContext();
v8::Local<v8::Context> context =
exports->GetCreationContext().ToLocalChecked();

MyObject::Init();

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"dependencies": {
"chalk": "^3.0.0",
"clang-format": "^1.4.0",
"cmake-js": "^7.1.1",
"semver": "^7.1.3"
},
"devDependencies": {
Expand Down

0 comments on commit 661cd59

Please sign in to comment.