Giter Club home page Giter Club logo

fast-deepclone's People

Contributors

laurence-myers avatar scottinet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

fast-deepclone's Issues

Can't install

I have tried a couple different computers and projects, but I can't install this into any of them I get something like

gitpod /workspace/author-website $ npm i fast-deepclone

> [email protected] install /workspace/author-website/node_modules/fast-deepclone
> node-gyp rebuild

make: Entering directory '/workspace/author-website/node_modules/fast-deepclone/build'
  CXX(target) Release/obj.target/DeepClone/src/deepclone.o
../src/deepclone.cc: In function ‘void copyProperties(v8::Local<v8::Object>, v8::Local<v8::Object>)’:
../src/deepclone.cc:70:41: error: no matching function for call to ‘v8::Array::Get(unsigned int&)’
   70 |     const Local<Value> key = keys->Get(i);
      |                                         ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note:   candidate expects 2 arguments, 1 provided
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note:   candidate expects 2 arguments, 1 provided
../src/deepclone.cc: In function ‘v8::Local<v8::Object> cloneObjectToTarget(circularMap&, v8::Local<v8::Object>, bool, v8::Local<v8::Object>, int)’:
../src/deepclone.cc:92:41: error: no matching function for call to ‘v8::Array::Get(unsigned int&)’
   92 |     const Local<Value> key = keys->Get(i);
      |                                         ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note:   candidate expects 2 arguments, 1 provided
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note:   candidate expects 2 arguments, 1 provided
../src/deepclone.cc:97:63: error: no matching function for call to ‘v8::Value::ToObject()’
   97 |         Nan::Set(target, key, cloneObject(refs, val->ToObject(), copy));
      |                                                               ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:108:56: warning: ‘v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents()’ is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
  108 |         bufferView->CopyContents(targetAB->GetContents().Data(), bufferView->ByteLength());
      |                                                        ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:5273:12: note: declared here
 5273 |   Contents GetContents();
      |            ^~~~~~~~~~~
../src/deepclone.cc:140:69: error: no matching function for call to ‘v8::Value::ToObject()’
  140 |           arr->SetPrototype(Nan::GetCurrentContext(), val->ToObject()->GetPrototype());
      |                                                                     ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:150:38: warning: ‘v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents()’ is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
  150 |         memcpy(targetAB->GetContents().Data(), buffer->GetContents().Data(), buffer->ByteLength());
      |                                      ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:5273:12: note: declared here
 5273 |   Contents GetContents();
      |            ^~~~~~~~~~~
../src/deepclone.cc:150:68: warning: ‘v8::ArrayBuffer::Contents v8::ArrayBuffer::GetContents()’ is deprecated: Use GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
  150 |         memcpy(targetAB->GetContents().Data(), buffer->GetContents().Data(), buffer->ByteLength());
      |                                                                    ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:5273:12: note: declared here
 5273 |   Contents GetContents();
      |            ^~~~~~~~~~~
../src/deepclone.cc:163:48: error: no matching function for call to ‘v8::Array::Get(unsigned int&)’
  163 |           targetMap->Set(context, values->Get(i), values->Get(i+1));
      |                                                ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note:   candidate expects 2 arguments, 1 provided
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note:   candidate expects 2 arguments, 1 provided
../src/deepclone.cc:163:66: error: no matching function for call to ‘v8::Array::Get(unsigned int)’
  163 |           targetMap->Set(context, values->Get(i), values->Get(i+1));
      |                                                                  ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note:   candidate expects 2 arguments, 1 provided
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note:   candidate expects 2 arguments, 1 provided
../src/deepclone.cc:166:73: error: no matching function for call to ‘v8::Value::ToObject()’
  166 |         targetMap->SetPrototype(Nan::GetCurrentContext(), val->ToObject()->GetPrototype());
      |                                                                         ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:167:38: error: no matching function for call to ‘v8::Value::ToObject()’
  167 |         copyProperties(val->ToObject(), targetMap->ToObject());
      |                                      ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:167:61: error: no matching function for call to ‘v8::Map::ToObject()’
  167 |         copyProperties(val->ToObject(), targetMap->ToObject());
      |                                                             ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:168:71: error: no matching function for call to ‘v8::Value::ToObject()’
  168 |         Nan::Set(target, key, cloneObjectToTarget(refs, val->ToObject(), copy, targetMap->ToObject(), uid));
      |                                                                       ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:168:100: error: no matching function for call to ‘v8::Map::ToObject()’
  168 |         Nan::Set(target, key, cloneObjectToTarget(refs, val->ToObject(), copy, targetMap->ToObject(), uid));
      |                                                                                                    ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:176:48: error: no matching function for call to ‘v8::Array::Get(unsigned int&)’
  176 |           targetSet->Add(context, values->Get(i));
      |                                                ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
 3717 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3717:43: note:   candidate expects 2 arguments, 1 provided
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
 3720 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
      |                                           ^~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:3720:43: note:   candidate expects 2 arguments, 1 provided
../src/deepclone.cc:179:71: error: no matching function for call to ‘v8::Value::ToObject()’
  179 |       targetSet->SetPrototype(Nan::GetCurrentContext(), val->ToObject()->GetPrototype());
      |                                                                       ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:180:38: error: no matching function for call to ‘v8::Value::ToObject()’
  180 |         copyProperties(val->ToObject(), targetSet->ToObject());
      |                                      ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:180:61: error: no matching function for call to ‘v8::Set::ToObject()’
  180 |         copyProperties(val->ToObject(), targetSet->ToObject());
      |                                                             ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:181:71: error: no matching function for call to ‘v8::Value::ToObject()’
  181 |         Nan::Set(target, key, cloneObjectToTarget(refs, val->ToObject(), copy, targetSet->ToObject(), uid));
      |                                                                       ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:181:100: error: no matching function for call to ‘v8::Set::ToObject()’
  181 |         Nan::Set(target, key, cloneObjectToTarget(refs, val->ToObject(), copy, targetSet->ToObject(), uid));
      |                                                                                                    ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:184:63: error: no matching function for call to ‘v8::Value::ToObject()’
  184 |         Nan::Set(target, key, cloneObject(refs, val->ToObject(), copy));
      |                                                               ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE deepClone(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/deepclone.cc:218:37: error: no matching function for call to ‘v8::Value::ToBoolean()’
  218 |       deepCopy = optCopy->ToBoolean()->Value();
      |                                     ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2848:18: note: candidate: ‘v8::Local<v8::Boolean> v8::Value::ToBoolean(v8::Isolate*) const’
 2848 |   Local<Boolean> ToBoolean(Isolate* isolate) const;
      |                  ^~~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2848:18: note:   candidate expects 1 argument, 0 provided
../src/deepclone.cc:226:66: error: no matching function for call to ‘v8::Value::ToObject()’
  226 |     info.GetReturnValue().Set(cloneObject(refs, source->ToObject(), deepCopy));
      |                                                                  ^
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note: candidate: ‘v8::MaybeLocal<v8::Object> v8::Value::ToObject(v8::Local<v8::Context>) const’
 2822 |   V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
      |                                            ^~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:2822:44: note:   candidate expects 1 argument, 0 provided
In file included from ../src/deepclone.cc:3:
../src/deepclone.cc: At global scope:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/node.h:758:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
  758 |       (node::addon_register_func) (regfunc),                          \
      |                                           ^
/home/gitpod/.cache/node-gyp/14.17.0/include/node/node.h:792:3: note: in expansion of macro ‘NODE_MODULE_X’
  792 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/deepclone.cc:237:1: note: in expansion of macro ‘NODE_MODULE’
  237 | NODE_MODULE(DeepClone, init)
      | ^~~~~~~~~~~
In file included from ../src/deepclone.cc:2:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]’:
/home/gitpod/.cache/node-gyp/14.17.0/include/node/node_object_wrap.h:85:78:   required from here
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:10874:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<node::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
10874 |                reinterpret_cast<Callback>(callback), type);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h: In instantiation of ‘void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = Nan::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)]’:
../../nan/nan_object_wrap.h:65:61:   required from here
/home/gitpod/.cache/node-gyp/14.17.0/include/node/v8.h:10874:16: warning: cast between incompatible function types from ‘v8::WeakCallbackInfo<Nan::ObjectWrap>::Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)’} to ‘Callback’ {aka ‘void (*)(const v8::WeakCallbackInfo<void>&)’} [-Wcast-function-type]
make: *** [DeepClone.target.mk:111: Release/obj.target/DeepClone/src/deepclone.o] Error 1
make: Leaving directory '/workspace/author-website/node_modules/fast-deepclone/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/gitpod/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:376:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Linux 5.4.0-1033-gke
gyp ERR! command "/home/gitpod/.nvm/versions/node/v14.17.0/bin/node" "/home/gitpod/.nvm/versions/node/v14.17.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /workspace/author-website/node_modules/fast-deepclone
gyp ERR! node -v v14.17.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN enoent ENOENT: no such file or directory, open '/workspace/author-website/package.json'
npm WARN author-website No description
npm WARN author-website No repository field.
npm WARN author-website No README data
npm WARN author-website No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gitpod/.npm/_logs/2021-06-22T01_59_30_234Z-debug.log

Steps to reproduce:

  1. Run npm i fast-deepclone

More detailed steps to reproduce:

  1. Go to some random computer that doesn't belong to scottinet or laurence-myers . You can do this by, for instance, by going to this random gitpod-ready repository I found https://github.com/andresaunders/author-website/tree/a4332807bf0f293b567077b1043fe0f746daa417 . Then clicking on the gitpod badge on that page that looks like image . After signing into Gitpod, it should open up a free virtual machine and an IDE in your browser for you.
  2. Run npm i fast-deepclone in the terminal in that IDE.

Map is not cloned when passed as the root object

Reproducible test scenario (using Mocha):

const deepClone = require('fast-deepclone');
const assert = require('assert');

describe(`fast-deepclone`, function () {
    it(`can deep copy a map`, function () {
        const map = new Map();
        map.set('key', 'value');

        const copiedMap = deepClone(map, true);
        assert.notStrictEqual(map, copiedMap, "Variables holding Maps should not reference the same object in memory");
        assert.strictEqual(map.size, copiedMap.size, "The cloned Map should have the same size as the original Map");
    });
});

This test will fail at the assertion "Variables holding Maps should not reference the same object in memory"

Deep copying a class that extends Map, e.g. a "DefaultMap", returns a Map instead

I have a custom class that extends from Map. This class is "DefaultMap", and provides a default value when an item is not found in the Map.

It looks like instances of "DefaultMap" are getting cloned as just "Map". It then loses the custom functionality provided by "DefaultMap".

Here's a test case to reproduce the problem:

const deepClone = require('fast-deepclone');
const assert = require('assert');

describe(`fast-deepclone`, function () {
    it(`can deep copy a class that extends map`, function () {
        class DefaultMap extends Map {
            constructor(defaultValueFactory, iterable) {
                super(iterable);
                this.defaultValueFactory = defaultValueFactory;
            }

            get(key) {
                if (!this.has(key)) {
                    const value = this.defaultValueFactory(key, this);
                    this.set(key, value);
                    return value;
                } else {
                    return super.get(key);
                }
            }
        }

        const defaultValue = 'placeholder';
        const map = new DefaultMap(() => defaultValue);
        const obj = {
            myMap: map
        };

        const copiedObj = deepClone(obj, true);
        assert.notStrictEqual(obj.myMap, copiedObj.myMap, "Properties holding Maps should not reference the same object in memory");
        assert.strictEqual(obj.myMap.size, copiedObj.myMap.size, "The cloned Map should have the same size as the original Map");

        const value = copiedObj.myMap.get('nonExistentKey');
        assert.strictEqual(value, defaultValue, "The cloned Map should be a DefaultMap, and should return the default value when given a non-existent key");
        assert.notStrictEqual(obj.myMap.size, copiedObj.myMap.size, "After implicitly inserting an element, the cloned Map should have a different size to the original Map");
    });
});

This test fails at the assertion "The cloned Map should be a DefaultMap, and should return the default value when given a non-existent key".

Cloning an ArrayBuffer causes a fatal assertion error, killing the process

Steps To Reproduce

fast-deepclone v1.0.0

const deepClone = require('fast-deepclone');
const arrayBuffer = new ArrayBuffer(3);
const originalDataView = new DataView(arrayBuffer);
originalDataView.setInt8(0, 1);
originalDataView.setInt8(1, 2);
originalDataView.setInt8(2, 3);
const valueToClone = {
  myProperty: arrayBuffer
};
deepClone(valueToClone, true);

Error message

#
# Fatal error in heap\heap.cc, line 3641
# Check failed: map->instance_type() == JS_REGEXP_TYPE || map->instance_type() == JS_OBJECT_TYPE || map->instance_type() == JS_ERROR_TYPE || map->instance_type() == JS_ARRAY_TYPE || map->instance_type() == JS_API_OBJECT_TYPE || map->instance_type() == WASM_INSTANCE_TYPE || map->instance_type() == WASM_MEMORY_TYPE || map->instance_type() == WASM_MODULE_TYPE || map->instance_type() == WASM_TABLE_TYPE || map->instance_type() == JS_SPECIAL_API_OBJECT_TYPE.
#

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.