Clojurians
#cljs-dev
<
2017-08-02
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

anmonteiro06:08:18

FWIW I think CLJS-2288 is still wrong

anmonteiro06:08:52

I’m setting up Windows CI and I think I can provide fixes to all things windows that supersede those in the tickets

anmonteiro06:08:24

(including relative-name, which is now well tested in both Windows / non-Windows)

anmonteiro06:08:41

so that people can use in their own forks (cc @mfikes ) and make it better

anmonteiro06:08:58

there are like 5 failures in lein test and 3 failures in script/test

anmonteiro06:08:11

I got that down from 20 in lein test :slightly_smiling_face:

richiardiandrea11:08:23

A question, is there a way to access the current cljs.env/*compiler* from a cljs REPL ? I was working on supporting cljs completions in inf-clojure

thheller11:08:31

no since it doesn’t exist in CLJS

thheller11:08:41

you’d either need a macro or a special form for that

dnolen12:08:33

@anmonteiro nice!

richiardiandrea12:08:56

@thheller thanks! Right a macro would not work I guess for completions if I end up in a vanilla cljs repl. There is a server starting there so maybe I can use that? How do you solve it in shadow-cljs?

thheller12:08:57

do it from the CLJ repl

richiardiandrea13:08:42

But the vanilla Repl drops you in a cljs repl immediately

thheller13:08:59

thats why you open a second connection for tool stuff

richiardiandrea13:08:36

Are we talking present repls or future repls?

richiardiandrea13:08:47

You could also multiplex

richiardiandrea13:08:57

(sorry off topic here)

richiardiandrea13:08:23

weird because when I try to nc localhost port-of-a-vanilla-repl I receive a single ready as answer, how do you folks use it?

richiardiandrea13:08:23

Maybe found a problem, I have this node_repl.clj:

(require 'cljs.repl)
(require 'cljs.build.api)
(require 'cljs.repl.node)

(cljs.build.api/build "src" {:main "logpoc.core"
                             :target :nodejs
                             :output-to "out/logpoc.js"
                             :verbose true})

(cljs.repl/repl (cljs.repl.node/repl-env)
  :watch "src"
  :output-dir "out")
but in my out/watch.log:
$ cat out/watch.log 
Building ...
java.lang.AssertionError: Assert failed: :nodejs target with :none optimizations requires a :main entry
(not (and (= target :nodejs) (= optimizations :none) (not (contains? opts :main))))
	at cljs.closure$check_node_target.invokeStatic(closure.clj:1954)
	at cljs.closure$check_node_target.invoke(closure.clj:1951)
	at cljs.closure$build.invokeStatic(closure.clj:2475)
	at cljs.closure$build.invoke(closure.clj:2444)
	at cljs.closure$watch$buildf__6992.invoke(closure.clj:2647)
	at cljs.closure$watch.invokeStatic(closure.clj:2679)
	at cljs.closure$watch.invoke(closure.clj:2623)
	at cljs.repl$repl_STAR_$fn__7543$fn__7548.invoke(repl.cljc:902)
	at clojure.core$binding_conveyor_fn$fn__4676.invoke(core.clj:1938)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.lang.Thread.run(Thread.java:748)

Watching paths: /home/arichiardi/git/logpoc/src

juhoteperi14:08:28

Hmm, check-source-map will give error if :source-map true is provided but no :optimizations https://github.com/clojure/clojurescript/blob/master/src/main/clojure/cljs/closure.clj#L1886

juhoteperi14:08:10

There are a few other check-* functions that seem to presume :optimizations is always set, but most of them are being called with the original opts, not opts with implicit opts added

richiardiandrea14:08:55

Maybe mine above is the same problem actually, I don't have any :optimizations

richiardiandrea14:08:30

I added the option to my node_repl.clj but no luck

juhoteperi14:08:23

There are two test cases which use :target :nodejs, without :optimizations and no :main, which breaks assertion at check-node-targets

richiardiandrea14:08:09

so I guess these tests are broken as well? in my case the options are there unless I am doing something wrong. I am going to try to take them away...It is very weird that in my case the repl starts but out/watch.log contains the error

richiardiandrea15:08:33

tried 1.9.660 with no luck as well

juhoteperi15:08:53

Just adding the :main option fixed the tests

richiardiandrea15:08:20

not here but thanks, I'll make a repro case I think (as a side note, sometimes you don't want a :main, but I guess cljs compiler does not have the notion of a node library yet)

richiardiandrea15:08:53

uhm so mies does not have the build step as per the Getting Started for the repl

richiardiandrea15:08:42

ok repository attached, I am going to wait before opening a ticket cause maybe it is expected: https://github.com/arichiardi/node-repl-main-error

anmonteiro15:08:09

@juhoteperi going to try Closure master + that patch with our tests

juhoteperi18:08:29

@anmonteiro What did you use to run Closure tests? mvn, Idea?

anmonteiro18:08:10

@juhoteperi mvn -pl pom-main-unshaded.xml test -Dtest=RewriteJsonToModuleTest

anmonteiro18:08:28

that’ll run only 1 test

juhoteperi18:08:48

I tried using -Dtest yesterday but it didn't run anything

anmonteiro18:08:02

you probably need to add the pom-main

juhoteperi18:08:02

what does that -pl pom-main-unshaded.xml part do? I didn't use that

anmonteiro18:08:12

it makes maven aware of that pom

anmonteiro18:08:20

otherwise I think it only picks up pom.xml

anmonteiro18:08:47

-pl,--projects <arg>                   Comma-delimited list of specified
                                        reactor projects to build instead
                                        of all projects. A project can be
                                        specified by [groupId]:artifactId
                                        or by its relative path

juhoteperi18:08:49

I'll have a quick look at those UMD wrappers

anmonteiro18:08:44

@juhoteperi I started looking at the package.json browser field but got sidetracked with the Windows CI stuff yesterday

anmonteiro20:08:38

it’s a commit :tada:

anmonteiro20:08:04

might be in the next release, I don’t think they have cut a branch yet

juhoteperi20:08:37

I made some very small progress with wrappers, one problem was that if Immediately-invoked function expression was wrapped with ! it wasn't removed

juhoteperi20:08:41

But there are other probems, like function foo () { return 'export' }; module.exports = foo(); which are more complicated to fix

juhoteperi20:08:08

or function foo(exports) { exports.foo = 'hello'; }; foo(module.exports);

juhoteperi22:08:06

Got the ternary UMD wrapper working with Leaflet

juhoteperi22:08:34

Some wrapper could have code like this :smile:

void !!-+-+!~! void !~!!~~~~!! function() { console.log("hello world") }()

juhoteperi22:08:52

But I hope no real library does that

juhoteperi22:08:46

1 && function () { /* ... */ }();
0, function () { /* ... */ }();
might be reasonable, but these will be easy to fix is encountered later

juhoteperi22:08:13

probably these are not used as they take more chars than parenthesis or one of those operators

juhoteperi23:08:47

I started a Cljsjs wiki page to document which packages work with module processing, and to track the problems: https://github.com/cljsjs/packages/wiki/Closure-npm-Module-processing-status