juxt / clip

Light structure and support for dependency injection
MIT License
228 stars 15 forks source link

Nodejs support #34

Closed crofty closed 1 year ago

crofty commented 1 year ago

Hi. Is Clip expected to work with nodejs? I'm trying to include clip in a project, compiled with shadow-cljs, targeting a node-script, and I'm getting the following error when I add the clip require:

SHADOW import error .shadow-cljs/builds/inform/dev/out/cljs-runtime/juxt.clip.impl.core.js

script.js:64
  /* ignore this, look at stacktrace */ fn.call(global, require, module, __filename, __dirname);
                                           ^
TypeError: Cannot read properties of undefined (reading 'prototype')

It looks like it's failing at this part of the code.

Is it expected to work on nodejs or is that unsupported?

SevereOverfl0w commented 1 year ago

It should be supported, but isn't regularly tested. https://github.com/juxt/clip/blob/master/src/juxt/clip/impl/core.cljc#L154 is definitely not right, that's going to be java only.

Should it be js/Object in JavaScript?

dula2000 commented 1 year ago

Clip is a library for working with the clipboard on the client-side, specifically in web browsers. It is not designed to work with Node.js, as Node.js does not have access to the clipboard. Instead, you should look for a Node.js library that provides similar functionality for working with the clipboard on the server-side.

SevereOverfl0w commented 1 year ago

Should be fixed in 0.28.0, enjoy!

crofty commented 1 year ago

Great. Thank you!