Fork me on GitHub
#shadow-cljs
<
2019-11-23
>
Drew Verlee00:11:59

Would it be helpful to create a spec for the shadow cls config? I could see that along with Bruce's spell spec lib going a long way to catching some configuration mistakes up front.

thheller00:11:01

they are already partially spec'd

Drew Verlee00:11:31

Great, I'll take a look and see if I can do anything more.

thheller00:11:49

could probably do more though but I don't like closing down the config format too much. so to some degree I don't it want to complain about keys it doesn't know

thheller00:11:04

maybe only if they are somewhat close to some known keys

thheller00:11:16

dunno how the spell check stuff does stuff

thheller10:11:42

question for the compiler nerds here: what is the correct term for this in compiler terms? https://ask.clojure.org/index.php/8879/cljs-should-macros-support-lifting-vars-to-the-ns-level

lilactown17:11:17

is this what Clojure refers to as "interning"?

thheller17:11:36

no, at least not in the context of String.intern or keywords

thheller17:11:46

no. that would have the same issues. the issue is declaring the var outside the current context. so it doesn't have to check if the work was already done previously

thheller17:11:39

there are plenty of other ways to do what I want to do ... but the variant with "lifting" the var would be the most efficient

lilactown17:11:57

yeah I see what you're saying

thheller17:11:18

reify is one of the other examples that would benefit by this

thheller17:11:28

just look at the code it currently generates to see why

lilactown17:11:11

the only potential stumbling block I can think of is keeping it semi-hygienic, right

lilactown17:11:45

and Clojure is not historically all-in on hygienic macros so seems in line

thheller17:11:21

this is completely "hygenic"? whatever that means ... 😉

lilactown17:11:02

hehe, I'm referring to the chance of clashing with a var already def or interned in the namespace

lilactown17:11:38

obviously gensym solves that. just thinking out loud

thheller17:11:48

yeah the chances of that are rather slim given the use of (gensym "fragment__")

thheller17:11:25

if I only knew the correct term for this I could look at other lisps and how they do it

thheller17:11:37

they must be able to do this in some way

thheller17:11:14

well I guess they might just automatically lift the def out of the current scope .. no clue.

lilactown17:11:19

I think a lot of lisps would frown on this because it kind of breaks the mental model of local and hygienic macros

lilactown17:11:37

so it might not be something that has all that much prior art

thheller17:11:55

reify is the prior art. it needs to do exactly this.

thheller17:11:28

in clojure thats no problem since it just generates a class outside of the var system

thheller17:11:01

in CLJS it can't. so it just dumps the code directly in there wrapped in an exists? check

thheller17:11:17

this isn't something I made up ... I'm 100% sure there is a regular compiler term for this

thheller17:11:39

my google fu just sucks 😛

thheller17:11:49

maybe. not sure. dunno if that refers to moving it out of the current scope too

thheller17:11:38

I'll create some benchmarks too see if I'm just overthinking this .. probably not worth worrying about this so much if the JIT is gonna do this for us anyways

lilactown19:11:14

I know that @U0FR82FU1 did some work in uix to hoist static data to a shared global ns. Might check that out and see if it gives you any ideas

grounded_sage11:11:53

Any idea how I can resolve this problem?

The required JS dependency "@babel/runtime/helpers/interopRequireDefault" is not available, it was required by "node_modules/react-dates/lib/index.js".

Search in:
	/Users/user/my-project/node_modules
You probably need to run:
  npm install @babel/runtime/helpers/interopRequireDefault
When I run the npm install it gives me this
npm install @babel/runtime/helpers/interopRequireDefault
npm ERR! code ENOLOCAL
npm ERR! Could not install from "@babel/runtime/helpers/interopRequireDefault" as it does not contain a package.json file.

grounded_sage11:11:13

I've trying to import the react-dates npm package

awb9913:11:05

I would like to use shadow-cljs to require arbitrary npm and cljs dependencies from a self hosted clojurescript repl. I saw example at https://github.com/thheller/shadow-cljs/blob/0e28c615cd75d4cbce27ede7a8f7f70785d42c86/src/dev/demo/selfhost/simple.cljs. Now my question is to allow dependency definition at runtime - do I have to start shadow cljs via command line with generated settings files. Or would I rather run it via its compiler api?

awb9913:11:14

What I want to do is provide dependencies for a few important cljs and npm dependencies out of the box. And then everything else should be fetched from npm / maven at runtime and be served to the load-fn in the browser repl.

padraic14:11:05

Is there any reason to be using deps.edn aliasing to leverage shadow-cljs?

David Pham14:11:49

I use deps.edn for local libraries

thheller15:11:44

@grounded_sage likely a dependency conflict of @babel/runtime. ie. react-dates depending on a different version than present in node_modules/@babel/runtime

grounded_sage15:11:58

house of cards land of JS

thheller15:11:47

@hoertlehner the self-hosted stuff only supports "pre-packaging" npm dependencies. if you want to do it dynamically then you must build that yourself using regular self-hosted cljs stuff. shadow-cljs can't help for those.

grounded_sage15:11:57

@thheller I'd like to know how I can fix this. But in the meantime I am using HTML date input element because I'm just prototyping atm.

thheller15:11:46

make sure all the right versions are installed. standard dependency conflict resolving.

awb9915:11:19

@thheller Thanks Thomas! Could you point me to the location where you do the npm prepackaging in your code?

thheller15:11:17

I can but none of that will be relevant to the self-hosted stuff. It uses the Closure Compiler heavily which is written in Java and won't be available for self-hosted

thheller15:11:09

this does all the packaging but its mostly using standard shadow-cljs stuff

Eliraz20:11:48

how do you check for dependencies update?