Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable compilation for Node 12 #81

Merged
merged 3 commits into from
May 23, 2019
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 @@ -9,6 +9,7 @@ env:
- TRAVIS_NODE_VERSION="8.10"
- TRAVIS_NODE_VERSION="10"
- TRAVIS_NODE_VERSION="11"
- TRAVIS_NODE_VERSION="12"
os:
- linux
- osx
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
environment:
fast_finish: true
matrix:
- nodejs_version: "12"
- nodejs_version: "11"
- nodejs_version: "10"
- nodejs_version: "8"
Expand All @@ -14,7 +15,7 @@ platform:
install:
- python -V
- set PYTHON=python
- ps: Install-Product node $env:nodejs_version $env:platform
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM
- node -p process.arch
- node -p process.version
- npm install node-gyp@3.6.1
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"lzmajs": "./bin/lzmajs"
},
"dependencies": {
"nan": "^2.10.0",
"nan": "^2.14.0",
"node-pre-gyp": "^0.11.0",
"readable-stream": "^2.3.5",
"rimraf": "^2.6.1"
Expand Down
2 changes: 1 addition & 1 deletion src/filter-array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FilterArray::FilterArray(Local<Array> arr) : ok_(false) {

for (size_t i = 0; i < len; ++i) {
Local<Object> entry = Local<Object>::Cast(EmptyToUndefined(Nan::Get(arr, i)));
if (entry.IsEmpty() || entry->IsUndefined() || entry->IsNull() || !entry->Has(id_)) {
if (entry.IsEmpty() || entry->IsUndefined() || entry->IsNull() || !Nan::Has(entry, id_).ToChecked()) {
Nan::ThrowTypeError("Filter array needs object entries");
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/index-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void IndexParser::Init(Local<Object> exports) {
Nan::SetPrototypeMethod(tpl, "feed", Feed);
Nan::SetPrototypeMethod(tpl, "parse", Parse);

constructor.Reset(tpl->GetFunction());
constructor.Reset(Nan::GetFunction(tpl).ToLocalChecked());
exports->Set(NewString("IndexParser"), Nan::New<Function>(constructor));
}

Expand Down
2 changes: 1 addition & 1 deletion src/lzma-stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ NAN_METHOD(LZMAStream::Code) {

self->inbufs.push(LZMA_NATIVE_MOVE(inputData));

bool async = info[1]->BooleanValue();
bool async = Nan::To<bool>(info[1]).ToChecked();

if (async) {
#ifdef LZMA_ASYNC_AVAILABLE
Expand Down
26 changes: 13 additions & 13 deletions src/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ void moduleInit(Local<Object> exports) {
LZMAStream::Init(exports);
IndexParser::Init(exports);

exports->Set(NewString("versionNumber"), Nan::New<FunctionTemplate>(lzmaVersionNumber)->GetFunction());
exports->Set(NewString("versionString"), Nan::New<FunctionTemplate>(lzmaVersionString)->GetFunction());
exports->Set(NewString("checkIsSupported"), Nan::New<FunctionTemplate>(lzmaCheckIsSupported)->GetFunction());
exports->Set(NewString("checkSize"), Nan::New<FunctionTemplate>(lzmaCheckSize)->GetFunction());
exports->Set(NewString("crc32_"), Nan::New<FunctionTemplate>(lzmaCRC32)->GetFunction());
exports->Set(NewString("filterEncoderIsSupported"), Nan::New<FunctionTemplate>(lzmaFilterEncoderIsSupported)->GetFunction());
exports->Set(NewString("filterDecoderIsSupported"), Nan::New<FunctionTemplate>(lzmaFilterDecoderIsSupported)->GetFunction());
exports->Set(NewString("rawEncoderMemusage"), Nan::New<FunctionTemplate>(lzmaRawEncoderMemusage)->GetFunction());
exports->Set(NewString("rawDecoderMemusage"), Nan::New<FunctionTemplate>(lzmaRawDecoderMemusage)->GetFunction());
exports->Set(NewString("mfIsSupported"), Nan::New<FunctionTemplate>(lzmaMfIsSupported)->GetFunction());
exports->Set(NewString("modeIsSupported"), Nan::New<FunctionTemplate>(lzmaModeIsSupported)->GetFunction());
exports->Set(NewString("easyEncoderMemusage"), Nan::New<FunctionTemplate>(lzmaEasyEncoderMemusage)->GetFunction());
exports->Set(NewString("easyDecoderMemusage"), Nan::New<FunctionTemplate>(lzmaEasyDecoderMemusage)->GetFunction());
exports->Set(NewString("versionNumber"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaVersionNumber)).ToLocalChecked());
exports->Set(NewString("versionString"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaVersionString)).ToLocalChecked());
exports->Set(NewString("checkIsSupported"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaCheckIsSupported)).ToLocalChecked());
exports->Set(NewString("checkSize"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaCheckSize)).ToLocalChecked());
exports->Set(NewString("crc32_"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaCRC32)).ToLocalChecked());
exports->Set(NewString("filterEncoderIsSupported"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaFilterEncoderIsSupported)).ToLocalChecked());
exports->Set(NewString("filterDecoderIsSupported"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaFilterDecoderIsSupported)).ToLocalChecked());
exports->Set(NewString("rawEncoderMemusage"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaRawEncoderMemusage)).ToLocalChecked());
exports->Set(NewString("rawDecoderMemusage"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaRawDecoderMemusage)).ToLocalChecked());
exports->Set(NewString("mfIsSupported"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaMfIsSupported)).ToLocalChecked());
exports->Set(NewString("modeIsSupported"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaModeIsSupported)).ToLocalChecked());
exports->Set(NewString("easyEncoderMemusage"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaEasyEncoderMemusage)).ToLocalChecked());
exports->Set(NewString("easyDecoderMemusage"), Nan::GetFunction(Nan::New<FunctionTemplate>(lzmaEasyDecoderMemusage)).ToLocalChecked());

// enum lzma_ret
exports->Set(NewString("OK"), Nan::New<Number>(LZMA_OK));
Expand Down
2 changes: 1 addition & 1 deletion src/mt-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ MTOptions::MTOptions(Local<Object> opt) : filters_(NULL), ok_(true) {
opts_.flags = 0;
opts_.filters = NULL;

opts_.block_size = Nan::Get(opt, NewString("blockSize")).ToLocalChecked()->IntegerValue();
opts_.block_size = Nan::To<int64_t>(Nan::Get(opt, NewString("blockSize")).ToLocalChecked()).ToChecked();
opts_.timeout = Nan::To<uint32_t>(Nan::Get(opt, NewString("timeout")).ToLocalChecked())
.FromMaybe(0);
opts_.preset = Nan::To<uint32_t>(Nan::Get(opt, NewString("preset")).ToLocalChecked())
Expand Down