lumo

:lumo: Standalone ClojureScript environment. Currently at version 1.9.0
2017-09-27T11:47:35.000009Z

that didn't do anything, I guess this needs to be set here https://github.com/nexe/nexe#flags-string in package.js on line 111. I give that a try then...

metametadata 2017-09-27T13:22:06.000706Z

Hi! What is the proper way to instrument spec-ed functions in Lumo? I could get it to work in REPL but not when loading the script file. Specifically:

; foo.cljs
(ns foo.core
  (:require [clojure.spec.test.alpha :as st :include-macros true]))

(defn bar
  []
  (st/instrument))
Then in REPL (with org.clojure/test.check present in the classpath passed to lumo):
cljs.user=> (require 'foo)
              ⬆
Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined at line 6 foo.cljs

2017-09-27T13:26:49.000531Z

it's foo.core right, and a file called core in a directory called foo in a folder that's on classpath?

metametadata 2017-09-27T13:27:58.000136Z

well, I've put foo.cljs in the current folder. Lumo doesn't really care that namespace name doesn't match the filename

2017-09-27T13:28:33.000227Z

try removeing .core from the foo and use single name namespace (you get warning you can ignore)

metametadata 2017-09-27T13:28:33.000335Z

I had the same problem with correct file structure. it's just the minimal example

metametadata 2017-09-27T13:28:49.000612Z

ok, I'll try just to make sure

2017-09-27T13:28:57.000492Z

the symbols are always stored in the analyzer under the namespace name.

metametadata 2017-09-27T13:32:03.000155Z

Tried removing .core - no luck. Also no luck with foo/core.cljs, ns foo.core and (require 'foo.core). So it seems to be some problem related specifically to how I require clojure.spec.test.

2017-09-27T13:34:23.000234Z

I got

cljs.user=> (require 'foo)	
(require 'foo)	
            ⬆
WARNING: foo is a single segment namespace at line 1 foo.cljs
No such namespace: clojure.test.check, could not locate clojure/test/check.cljs, clojure/test/check.cljc, or JavaScript source providing "clojure.test.check" in file foo.cljs
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2560:92)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$2 (NO_SOURCE_FILE <embedded>:2559:92)
	 (NO_SOURCE_FILE <embedded>:5560:162)
	 Object.lumo.repl.load_other (NO_SOURCE_FILE <embedded>:6367:378)
	 lumo.repl.load (NO_SOURCE_FILE <embedded>:6371:96)
	 Function.cljs.js.require.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:5562:77)
	 (NO_SOURCE_FILE <embedded>:5535:284)
	 (Object.lumo.repl.run_sync_BANG_)

metametadata 2017-09-27T13:35:35.000347Z

yeah, it's because [org.clojure/test.check "0.9.0"] is needed to be on classpath

metametadata 2017-09-27T13:36:17.000485Z

I have it in project.clj deps and and then invoke REPL with

lumo -c `lein cp`

metametadata 2017-09-27T13:37:49.000441Z

and then this works without problems:

cljs.user=> (require '[clojure.spec.test.alpha :as st])
nil
cljs.user=> (st/instrument)
[]

2017-09-27T13:37:57.000447Z

e $ lumo -c src:~/.m2/repository/org/clojure/test.check/0.9.0/test.check-0.9.0.jar
Lumo 1.8.0-beta
ClojureScript 1.9.931
Node.js v8.5.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (require 'foo)
(require 'foo)
            ⬆
WARNING: foo is a single segment namespace at line 1 foo.cljs
nil
cljs.user=> 

2017-09-27T13:37:59.000442Z

works

metametadata 2017-09-27T13:38:18.000731Z

hm

metametadata 2017-09-27T13:38:47.000272Z

ok, that's reassuring πŸ™‚

metametadata 2017-09-27T13:40:20.000503Z

ᐅ lumo -c src:~/.m2/repository/org/clojure/test.check/0.9.0/test.check-0.9.0.jar
Lumo 1.8.0-beta
ClojureScript 1.9.927
Node.js v8.5.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (require 'foo)
            ⬆
WARNING: foo is a single segment namespace at line 1 foo.cljs
              ⬆
Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined at line 6 foo.cljs
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2539:92)
	 Object.cljs.analyzer.macroexpand_1 (NO_SOURCE_FILE <embedded>:3118:329)
	 Function.cljs.analyzer.analyze_seq.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:3125:35)
	 Object.cljs.analyzer.analyze_form (NO_SOURCE_FILE <embedded>:3162:213)
	 Object.cljs.analyzer.analyze_STAR_ (NO_SOURCE_FILE <embedded>:3165:337)
	 Function.cljs.analyzer.analyze.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:3170:52)
	 Function.cljs.analyzer.analyze_seq.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:3125:189)
	 Object.cljs.analyzer.analyze_form (NO_SOURCE_FILE <embedded>:3162:213)

Cannot read property 'cljs$core$IFn$_invoke$arity$1' of undefined
	 Function.cljs.spec.test.alpha$macros.instrument.cljs$core$IFn$_invoke$arity$4 (evalmachine.<anonymous>:266:94)
	 Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$6 (NO_SOURCE_FILE <embedded>:774:131)
	 Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:773:205)
	 Function.cljs.core.apply_to_simple.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:772:199)
	 Function.cljs.core.apply.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:785:297)
	 Object.cljs.analyzer.macroexpand_1_STAR_ (NO_SOURCE_FILE <embedded>:3115:105)
	 Object.cljs.analyzer.macroexpand_1 (NO_SOURCE_FILE <embedded>:3118:211)
	 Function.cljs.analyzer.analyze_seq.cljs$core$IFn$_invoke$arity$4 (NO_SOURCE_FILE <embedded>:3125:35)
	 Object.cljs.analyzer.analyze_form (NO_SOURCE_FILE <embedded>:3162:213)
	 Object.cljs.analyzer.analyze_STAR_ (NO_SOURCE_FILE <embedded>:3165:337)

cljs.user=> 

metametadata 2017-09-27T13:40:36.000513Z

the only difference is the reported ClojureScript version

metametadata 2017-09-27T13:41:10.000343Z

you have 1.9.931 vs. 1.9.927 on my machine somehow

2017-09-27T13:41:17.000194Z

pff ok, I actually compiled lumo just few minutes ago for another reason. Did you try deleteing .lumo_cache?

metametadata 2017-09-27T13:42:10.000181Z

yes, the problem is still there

2017-09-27T13:45:21.000395Z

well, then compile newest lumo and take a run few times around the block in the meantime πŸ™‚

metametadata 2017-09-27T13:46:15.000826Z

alright, thanks for the help! maybe indeed it's the bug in current Lumo versions

2017-09-27T13:46:35.000028Z

np

2017-09-27T14:19:07.000268Z

neither modifying flags in scripts/package.js flags: ['--max-old-space-size=8192'] or adding v8.setFlagsFromString('--max_old_space_size=8192'); in src/js/cli.js (next to strict mode flag), changes the value from

(.-heap_size_limit (.getHeapStatistics (js/require "v8")))
=> 1501560832
just as short term solution, I'd like to change the limit, so I welcome all hints.

richiardiandrea 2017-09-27T14:39:19.000563Z

@metametadata from what understood version 0.9.0 is not self-host compatible

metametadata 2017-09-27T14:46:22.000480Z

@richiardiandrea huh, good point. I don't really use anything from test.check, but I'll try 0.10.0-alpha just to make sure

metametadata 2017-09-27T14:46:36.000568Z

also I've built Lumo from master and it fixed my bug

metametadata 2017-09-27T14:47:08.000217Z

I guess I need test.check on classpath only because of this issue https://dev.clojure.org/jira/browse/CLJS-1792

richiardiandrea 2017-09-27T15:27:53.000257Z

Yes there was a bug in there as well and Antonio fixed it @metametadata ...did not know about that jira though, I added a test.check test in lumo and it seems to be green :)) all good

metametadata 2017-09-27T15:39:47.000446Z

@richiardiandrea awesome. just in case, I still filed an issue: https://github.com/anmonteiro/lumo/issues/282

richiardiandrea 2017-09-27T15:41:06.000488Z

Yep saw that, btw -D allows you to specify the dep directly without the whole .m2 path, it does the folder scan in there for you

metametadata 2017-09-27T15:42:34.000426Z

ah yes πŸ‘

1πŸ‘
metametadata 2017-09-27T17:00:24.000410Z

@anmonteiro are there any plans for releasing beta2 (with test.check bug fixed)? I didn't want to bother you, but it looks like building Lumo under Linux is more cumbersome than under MacOS πŸ™‚ Somehow (in "node:8.5.0-stretch" docker container) compilation is killed at some point with message "Killed" and no additional information.

anmonteiro 2017-09-27T17:00:45.000290Z

probably running out of memory

anmonteiro 2017-09-27T17:00:56.000518Z

@metametadata here: http://s3.amazonaws.com/lumo-linux/lumo.zip

anmonteiro 2017-09-27T17:01:03.000220Z

can you run that?

metametadata 2017-09-27T17:01:53.000321Z

okay, didn't think about that. ok, let me try

anmonteiro 2017-09-27T17:01:53.000506Z

I’m planning on releasing 1.8.0-rc or 1.8.0 proper eventually, but I have 1 more thing I wanna get done

metametadata 2017-09-27T17:07:18.000037Z

@anmonteiro yes, zipped executable seems to work in Debian, thank you

metametadata 2017-09-27T18:54:49.000143Z

@anmonteiro did something change in the way require works since 1.7.0? I'm now hitting a very strange problem of not being able to require local file anymore. It only happens when I run Lumo > 1.7.0 inside the docker container which is created by Jenkins pipeline πŸ˜• Cleaning .lumo-cache doesn't help. I can't reproduce it on MacOS or even when I manually run the same docker image and perform all the operations manually. It seems as if Jenkins machinery somehow has effect on how Lumo behaves inside the container. I've checked that the required file exists at the respective path, pwd, etc.

metametadata 2017-09-27T19:08:44.000267Z

This is a log from my container (I'm using 1.8.0-beta from npm):

+ cat foo.cljs
(ns foo)

+ lumo --version
1.8.0-beta

+ lumo -e (require 'foo)
No such namespace: foo, could not locate foo.cljs, foo.cljc, or JavaScript source providing "foo"
	 (new)
	 Function.cljs.core.ex_info.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1928:72)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:2539:92)
	 Function.cljs.analyzer.error.cljs$core$IFn$_invoke$arity$2 (NO_SOURCE_FILE <embedded>:2538:92)
	 (NO_SOURCE_FILE <embedded>:5847:162)
	 Object.lumo.repl.load_other (NO_SOURCE_FILE <embedded>:6363:378)
	 lumo.repl.load (NO_SOURCE_FILE <embedded>:6367:96)
	 Function.cljs.js.require.cljs$core$IFn$_invoke$arity$5 (NO_SOURCE_FILE <embedded>:5849:77)
	 Function.cljs.js.load_deps.cljs$core$IFn$_invoke$arity$7 (NO_SOURCE_FILE <embedded>:5859:507)
	 Function.cljs.js.ns_side_effects.cljs$core$IFn$_invoke$arity$6 (NO_SOURCE_FILE <embedded>:5917:287)

anmonteiro 2017-09-27T20:07:40.000187Z

@metametadata sure you’re not just messing quoting?

anmonteiro 2017-09-27T20:07:53.000410Z

i.e. lumo -e "(require 'foo)"

metametadata 2017-09-27T20:13:43.000323Z

yep, it's the logging of Jenkins messes stuff up. the only thing I change is the version of Lumo: 1.7.0 <-> 1.8.0-beta

metametadata 2017-09-27T20:14:28.000091Z

I suspect there can be something different in the way Lumo started scanning for files and Jenkins executing Lumo process somehow triggers the issue

metametadata 2017-09-27T20:16:27.000120Z

For some context, in my a Jenkinsfile there's this line calling the "built-in" pipeline DSL function which runs stuff in shell:

sh """ lumo -e "(require 'foo)" """

metametadata 2017-09-27T20:19:40.000454Z

I also managed to docker exec -it ... bash into the same container instance while Jenkins pipeline was running and couldn't reproduce the issue from there

metametadata 2017-09-27T20:22:08.000274Z

I also suspect that in these cases Lumo could receive different env vars. But I have to debug it and am not sure if it can really affect require-ing files

richiardiandrea 2017-09-27T20:52:03.000038Z

A question: if I have source-map-support in my node_modules, should I see some difference in lumo script stack traces currently

anmonteiro 2017-09-27T20:56:30.000013Z

no

1πŸ‘