Closed swashcap closed 6 years ago
Building webworker-threads results in several Nan::ForceSet deprecation warnings:
Nan::ForceSet
> webworker-threads@0.7.13 install /Users/swashcap/.nvm/versions/node/v9.8.0/lib/node_modules/tldr/node_modules/webworker-threads > node-gyp rebuild CXX(target) Release/obj.target/WebWorkerThreads/src/WebWorkerThreads.o In file included from ../src/WebWorkerThreads.cc:17: ../src/bson.cc:434:8: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(returnObject, name, value, v8::None); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ In file included from ../src/WebWorkerThreads.cc:17: ../src/bson.cc:690:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(target, Nan::New<String>("BSON").ToLocalChecked(), t->GetFunction(), v8::None); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:258:5: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] JSObjFn(fs_obj, "readFileSync", readFileSync_); ^ ../src/jslib.cc:27:10: note: expanded from macro 'JSObjFn' Nan::ForceSet(obj, Nan::New<String>(name).ToLocalChecked(), Nan::New<FunctionTemplate>(fnname)->GetFunction... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:259:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("native_fs_").ToLocalChecked(), fs_obj, attribute_ro_dd); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:262:5: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] JSObjFn(console_obj, "log", console_log); ^ ../src/jslib.cc:27:10: note: expanded from macro 'JSObjFn' Nan::ForceSet(obj, Nan::New<String>(name).ToLocalChecked(), Nan::New<FunctionTemplate>(fnname)->GetFunction... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:263:5: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] JSObjFn(console_obj, "error", console_error); ^ ../src/jslib.cc:27:10: note: expanded from macro 'JSObjFn' Nan::ForceSet(obj, Nan::New<String>(name).ToLocalChecked(), Nan::New<FunctionTemplate>(fnname)->GetFunction... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:264:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("console").ToLocalChecked(), console_obj, attribute_ro_dd); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:266:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("self").ToLocalChecked(), global, v8::None); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:267:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("global").ToLocalChecked(), global, v8::None); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:269:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("puts").ToLocalChecked(), Nan::New<FunctionTemplate>(Puts)->GetFunct... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:270:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("print").ToLocalChecked(), Nan::New<FunctionTemplate>(Print)->GetFun... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:272:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("postMessage").ToLocalChecked(), Nan::New<FunctionTemplate>(postMess... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:273:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("__postError").ToLocalChecked(), Nan::New<FunctionTemplate>(postErro... ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ ../src/WebWorkerThreads.cc:276:10: warning: 'ForceSet' is deprecated [-Wdeprecated-declarations] Nan::ForceSet(global, Nan::New<String>("thread").ToLocalChecked(), threadObject, v8::None); ^ ../../nan/nan_maybe_43_inl.h:130:1: note: 'ForceSet' has been explicitly marked deprecated here NAN_DEPRECATED inline Maybe<bool> ForceSet( ^ ../../nan/nan.h:98:40: note: expanded from macro 'NAN_DEPRECATED' # define NAN_DEPRECATED __attribute__((deprecated)) ^ 14 warnings generated. SOLINK_MODULE(target) Release/WebWorkerThreads.node
I noticed this when installing tldr, which depends indirectly on webworker-threads.
9.8.0
5.7.1
macOS 10.13.3
Looks like Nan deprecated Nan::ForceSet with version 2.8.0 and recommends using Nan::DefineOwnProperty. This PR simply refactors ForceSet ā DefineOwnProperty.
Nan::DefineOwnProperty
ForceSet
DefineOwnProperty
Here's what Iām doing to test:
npx node-gyp configure build npm run js sed -i '' 's/timeout/gtimeout/g' run-all-tests.sh # Use GNU's timeout ./run-all-tests.sh
Unfortunately, the tests don't pass, but I see they're not passing on master, either. Any pointers?
master
š Awesome, thank you!
Problem
Building webworker-threads results in several
Nan::ForceSet
deprecation warnings:I noticed this when installing tldr, which depends indirectly on webworker-threads.
9.8.0
5.7.1
macOS 10.13.3
Solution
Looks like Nan deprecated
Nan::ForceSet
with version 2.8.0 and recommends usingNan::DefineOwnProperty
. This PR simply refactorsForceSet
āDefineOwnProperty
.Testing
Here's what Iām doing to test:
Unfortunately, the tests don't pass, but I see they're not passing on
master
, either. Any pointers?