lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
2017-11-17T00:04:16.000209Z

maybe its because https://github.com/anmonteiro/lumo/blob/0ffdd66dac0b27e9894fe8370e17d3e5f12c932c/src/js/cljs.js#L317-L346 doesnt try to look at the embedded resources?

richiardiandrea 2017-11-17T00:08:16.000278Z

@hlolli you might be onto something but I am going to wait for Antonio to speak here as I have not dug enough on that myself

anmonteiro 2017-11-17T00:11:46.000165Z

I don’t think that code should have anything to do with embedded resources

anmonteiro 2017-11-17T00:12:06.000197Z

loading resources is pretty self contained

anmonteiro 2017-11-17T00:12:11.000223Z

in the load function in lumo.repl

richiardiandrea 2017-11-17T00:19:27.000169Z

in the meantime I created a branch for the stest/instrument WARNING: https://github.com/anmonteiro/lumo/pull/312

anmonteiro 2017-11-17T00:20:17.000149Z

why did you comment out all the build-api-tests

richiardiandrea 2017-11-17T00:20:28.000334Z

just for quickly executing the tests

richiardiandrea 2017-11-17T00:20:42.000119Z

will put everything back when I will find the fix 😉

richiardiandrea 2017-11-17T00:23:19.000187Z

just wanted to make sure that I am not doing silly things in the ns declaration (which is usually what happens) 😄

2017-11-17T00:24:16.000230Z

yes I agree, but what I'm trying to achieve is bundling cljs code into the nexe. I've spent much time trying to add this feature, I hope we could allow searching for mainScript in bundled resources on certain conditions? Just need to find out where the path gets resolved at least to test it.

anmonteiro 2017-11-17T00:43:50.000177Z

I’m saying the path is resolved in lumo.repl/load

anmonteiro 2017-11-17T00:43:54.000108Z

or whatever it’s called

anmonteiro 2017-11-17T00:44:04.000217Z

and that executePath shouldn’t be where you need to look

2017-11-17T00:47:37.000122Z

ah ok, I think I get you, I will take a look there! thanks

2017-11-17T00:48:26.000220Z

yup bingo, I was exacly looking there

2017-11-17T00:48:54.000241Z

this confirms it Object.lumo.repl.load_other (NO_SOURCE_FILE <embedded>:6470:378)

richiardiandrea 2017-11-17T01:01:46.000262Z

So it looks like the first time I do boot dev, I get a bunch of:

--- m {:name cljs.spec.test.alpha, :macros true, :path cljs/spec/test/alpha}
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 112 cljs/spec/test/alpha.cljc
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 135 cljs/spec/test/alpha.cljc
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 245 cljs/spec/test/alpha.cljc
That I have never seen before

richiardiandrea 2017-11-17T01:02:06.000327Z

(apart from the first line that I have added)

2017-11-17T01:02:48.000202Z

this just passed my eyes, no smallest idea if these are related cc @richiardiandrea https://github.com/anmonteiro/lumo/blob/7c34d011dd8232828a337f361737de0bd3cfd1b4/src/cljs/snapshot/lumo/repl.cljs#L230-L232

richiardiandrea 2017-11-17T01:03:29.000138Z

thanks for the hint! digging...

richiardiandrea 2017-11-17T01:16:36.000242Z

or better, it passes by there it seems, but calls back with it, emitting the warnings without injecting eval

richiardiandrea 2017-11-17T01:20:29.000150Z

Compiling out/cljs/spec/test/alpha.cljs
--- load {:name cljs.spec.test.alpha, :macros true, :path cljs/spec/test/alpha}
--- load-and-cb cljs.spec.test.alpha cljs/spec/test/alpha cljs/spec/test/alpha.clj true
--- load-and-cb bundled-source false js-lib? false
--- load-and-cb cljs.spec.test.alpha cljs/spec/test/alpha cljs/spec/test/alpha.cljc true
--- load-and-cb bundled-source false js-lib? false
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 112 cljs/spec/test/alpha.cljc
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 135 cljs/spec/test/alpha.cljc
WARNING: Use of undeclared Var cljs.spec.test.alpha$macros/eval at line 245 cljs/spec/test/alpha.cljc

cgrand 2017-11-17T09:43:35.000055Z

Hi I’ve published xforms 0.15.1 to npm which has an up-to-date .lumo_cache but I believe it’s not picked by lumo (that’s what I infer from`lumo -v` output)

richiardiandrea 2017-11-17T15:56:37.000598Z

Uhm I will try to check that

cgrand 2017-11-17T16:35:37.000242Z

I mean: if run xforms locally with -K it gets cached and the second time I don’t see any javascript being compiled when I require it

cgrand 2017-11-17T16:36:27.000449Z

However when I use it as a dep the cache seems to be ignored (despite being present under node_modules/xforms

cgrand 2017-11-17T16:36:47.000011Z

(and timestamps are ok)

2017-11-17T16:38:04.000028Z

I guess -k lowercase with path works fine? Btw it should only get cached once and read the cache if they exist?

2017-11-17T16:38:55.000314Z

I haven't tried xforms, but if there's no change in the source code, it should be safe to just give a path to the cache to speed up startup time?

cgrand 2017-11-17T16:39:39.000718Z

xforms is deployed as a npm package and there’s an up to date cache in the package but lumo ignores it

2017-11-17T16:40:40.000470Z

does it ignore it with lowercase or capital k?

cgrand 2017-11-17T16:42:51.000375Z

with -k or -K, the first time it’s compiled and put in the cache directory.

cgrand 2017-11-17T16:43:16.000647Z

My expectation was that it would never compile it since a cache is present in the package

cgrand 2017-11-17T16:43:26.000209Z

Is my expectation wrong?

2017-11-17T16:43:44.000800Z

no that's correct expectation

2017-11-17T16:45:47.000560Z

ok so you're using lumo to call xforms as node module. I think this is not yet implemented. I think lumo will try to chache everything into one directory when in your case it should merge. But I say only as user.

2017-11-17T16:46:34.000471Z

What I personally would like to see, is "lumo" key in package json, this would be a good place for lumo to look at.

cgrand 2017-11-17T16:48:58.000438Z

I’m running lumo master

2017-11-17T16:49:50.000145Z

how this could work would be

cd ~/myLumoProject/
lumo -m cljs.core -c src -k node_modules/xforms/.lumo_cache
something like this should prevent cacheing between starts.

richiardiandrea 2017-11-17T16:49:58.000299Z

It is a brand new feature something might be off

richiardiandrea 2017-11-17T16:50:40.000476Z

The cache should be read from directories.cache in package.json and added directly to the pool of cache files

richiardiandrea 2017-11-17T16:51:58.000070Z

I haven't tried that here yet, but will soon (thanks Christophe for publishing on npm and trying things out!)

cgrand 2017-11-17T16:54:01.000800Z

@richiardiandrea thanks to you for getting me set up

anmonteiro 2017-11-17T16:55:54.000166Z

We dont read cache from Npm packages yet

anmonteiro 2017-11-17T16:56:07.000215Z

It’s just not implemented

anmonteiro 2017-11-17T16:56:18.000227Z

Which is why the issue is still open

richiardiandrea 2017-11-17T16:56:58.000176Z

Oh cool that explains it

cgrand 2017-11-17T16:59:02.000357Z

Thanks!

cgrand 2017-11-17T16:59:45.000482Z

Well now you know that you canuse xforms to test 🙂

cgrand 2017-11-17T17:01:03.000279Z

Isn’t the issue tricky when you require A and B and that A depends on B too? Then you have two caches for B code, no?

anmonteiro 2017-11-17T17:01:45.000101Z

I havent given it any thought

anmonteiro 2017-11-17T17:01:53.000594Z

Might eequire some refactoring

anmonteiro 2017-11-17T17:02:30.000189Z

That particular case may not be a problem at all, I’m more concerned about caches for different versions of ClojureScript

cgrand 2017-11-17T17:03:03.000487Z

what if the B “embedded” in A cache is a different version than the one your required?

cgrand 2017-11-17T17:03:34.000265Z

That’s was going to me by next question (cljs version)

anmonteiro 2017-11-17T17:03:40.000556Z

Right that may become a problem

anmonteiro 2017-11-17T17:04:15.000069Z

Maybe we shouldnt support caches at all

anmonteiro 2017-11-17T17:04:28.000772Z

And have that be an app-thing only

anmonteiro 2017-11-17T17:04:32.000249Z

Not library

cgrand 2017-11-17T17:18:02.000304Z

Can’t you have a mode for not generating a cache for deps?

richiardiandrea 2017-11-17T18:17:10.000520Z

@anmonteiro so I have been digging:

cljs.user=> (def cache (ana/read-analysis-cache (ana/cache-file "out/cljs/spec/test/alpha.cljs" "out") "out/cljs/spec/test/alpha.cljs"))
...
cljs.user=> (filter #(clojure.string/includes? (str %) "cljs.spec") (keys (get-in cache [:cljs.analyzer/namespaces])))
(cljs.spec.alpha$macros
 cljs.spec.gen.alpha$macros
 cljs.spec.test.alpha
 cljs.spec.alpha
 cljs.spec.gen.alpha)
I would have expected to see cljs.spec.test.alpha$macros? Am I on the right track? EDIT: test was wrong

richiardiandrea 2017-11-17T18:19:52.000335Z

looks like the $macros for cljs.spec.test.alpha are not in the cache?

2017-11-17T18:25:43.000398Z

@richiardiandrea its at least bundled (lumo.internal.embedded.keys)

richiardiandrea 2017-11-17T18:26:35.000229Z

uhm lemme have a look

richiardiandrea 2017-11-17T18:28:57.000211Z

@hlolli it seems it is not:

cljs.user=> (filter #(clojure.string/includes? (str %) "cljs.spec") (lumo.internal.embedded.keys))
("cljs/core$macros.cljc.cache._COLON_cljs.spec_SLASH_registry_ref.json"
 "cljs/core$macros.cljc.cache._COLON_cljs.spec_SLASH_speced_vars.json"
 "target/cljs/core$macros.cljc.cache._COLON_cljs.spec_SLASH_registry_ref.json"
 "target/cljs/core$macros.cljc.cache._COLON_cljs.spec_SLASH_speced_vars.json")

2017-11-17T18:29:25.000424Z

that's not what I get

richiardiandrea 2017-11-17T18:29:59.000562Z

oh, what do you get?

2017-11-17T18:30:33.000104Z

(filter #(clojure.string/includes? (str %) "cljs/spec") (lumo.internal.embedded.keys))
("cljs/spec/alpha$macros.cache.json"
 "cljs/spec/alpha$macros.js"
 "cljs/spec/alpha.cljc"
 "cljs/spec/alpha.cljs"
 "cljs/spec/alpha.cljs.cache.json"
 "cljs/spec/alpha.js"
 "cljs/spec/gen/alpha$macros.cache.json"
 "cljs/spec/gen/alpha$macros.js"
 "cljs/spec/gen/alpha.cljc"
 "cljs/spec/gen/alpha.cljs"
 "cljs/spec/gen/alpha.cljs.cache.json"
 "cljs/spec/gen/alpha.js"
 "cljs/spec/test/alpha$macros.cache.json"
 "cljs/spec/test/alpha$macros.js"
 "cljs/spec/test/alpha.cache.json"
 "cljs/spec/test/alpha.cljc"
 "cljs/spec/test/alpha.cljs"
 "cljs/spec/test/alpha.js")

2017-11-17T18:30:37.000376Z

note the slash

richiardiandrea 2017-11-17T18:30:40.000315Z

ah well the test is wrong 😄

richiardiandrea 2017-11-17T18:30:48.000521Z

yep saw that

😬 1
richiardiandrea 2017-11-17T18:31:35.000255Z

so @hlolli have you dug in that? at which stage those are loaded instead ?

2017-11-17T18:33:00.000550Z

yes, I've looked a bit into that, and I will be spending my friday night now doing more of that. But it's not dynamic, there's a hash-map in the snapshot/cljs section, maybe that entry is missing.

2017-11-17T18:33:18.000171Z

I'm leaving work and heading home. Will be here later on.

richiardiandrea 2017-11-17T18:34:00.000348Z

ok will look into that as well

anmonteiro 2017-11-17T18:34:02.000405Z

the warnings are fine

anmonteiro 2017-11-17T18:34:08.000649Z

there’s no eval in clojurescript

anmonteiro 2017-11-17T18:35:02.000662Z

and the files are there

richiardiandrea 2017-11-17T18:36:00.000778Z

yep, I tried to invert the two lines here https://github.com/anmonteiro/lumo/blob/7c34d011dd8232828a337f361737de0bd3cfd1b4/src/cljs/snapshot/lumo/repl.cljs#L227 so that the cb is called after the inject-... but it seems still there...in any case...the WARNING I am interested in is the instrument one, because I always error out on WARNINGs so it stops my compilation

anmonteiro 2017-11-17T18:36:22.000415Z

the callback is fine

👍 1
anmonteiro 2017-11-17T18:40:24.000186Z

I just don’t have time to look into this

anmonteiro 2017-11-17T18:42:54.000275Z

@richiardiandrea I don’t see any warnings

anmonteiro 2017-11-17T18:42:58.000081Z

on current master

anmonteiro 2017-11-17T18:43:05.000212Z

are you sure you have a current build?

anmonteiro 2017-11-17T18:43:49.000428Z

oh you mean compiling, not executing

richiardiandrea 2017-11-17T18:44:30.000299Z

yep compiling @anmonteiro the branch I have PR-ed contains the WARNING

richiardiandrea 2017-11-17T18:45:22.000127Z

don't worry I will try my best to see what is going on 😄

anmonteiro 2017-11-17T18:45:57.000019Z

I don’t see any warnings

anmonteiro 2017-11-17T18:46:02.000266Z

with latest master

richiardiandrea 2017-11-17T18:46:42.000641Z

not even on my branch?

anmonteiro 2017-11-17T18:47:13.000133Z

I didn’t check out your branch yet

anmonteiro 2017-11-17T18:47:45.000068Z

but

anmonteiro 2017-11-17T18:47:53.000281Z

@richiardiandrea I don’t see your warning on CI

richiardiandrea 2017-11-17T18:49:05.000047Z

oh it failed earlier just a sec

anmonteiro 2017-11-17T18:49:21.000185Z

what do I have to run

anmonteiro 2017-11-17T18:49:22.000715Z

in your branch?

anmonteiro 2017-11-17T18:49:35.000257Z

oh it’s in the PR sorry

richiardiandrea 2017-11-17T18:50:26.000044Z

yep that, just force pushed

anmonteiro 2017-11-17T19:01:49.000458Z

cool I see the warning now

anmonteiro 2017-11-17T19:02:00.000463Z

I’ll see if I have time to investigate later

richiardiandrea 2017-11-17T19:03:17.000170Z

ok thanks Antonio, I did a bit of debugging and I posted it in the issue

richiardiandrea 2017-11-17T19:04:24.000660Z

hlolli was talking about embedded resources, haven't explored there yet

2017-11-17T19:49:36.000226Z

@richiardiandrea yes I'm working on that feature on this fork https://github.com/hlolli/lumo, still in progress

richiardiandrea 2017-11-17T19:57:42.000431Z

checking 😉

hlship 2017-11-17T21:26:45.000534Z

Documentation PR: https://github.com/anmonteiro/lumo/pull/313/files

👍 2