Fork me on GitHub
#shadow-cljs
<
2018-02-14
>
currentoor00:02:29

hello, i’m noticing some weird behavior with cider. everything (eval, jump-to, docstring lookup) seems to be working except for symbols that get :referd in

currentoor00:02:41

anyone familiar with that?

mjmeintjes05:02:18

@thheller Thanks, just thought I'd mention that the release snapshot analyzer displaying the size usage per dependency is really useful.

thheller07:02:23

@koz can you give me examples of deps that dont work anymore?

thheller07:02:38

pushed 2.1.9 fixing one issue I found

thheller07:02:38

gah found another issue

thheller07:02:46

I hate this change

pepe07:02:45

@thheller for me it is material-component-web. Same with 2.1.9

thheller07:02:03

yeah thats what I'm testing with

thheller07:02:13

(now, not before)

pepe07:02:23

Or better "@material/ripple" to be precise

pepe07:02:46

The thing is js/module$node_modules$$material$ripple$index resolves to the right object

thheller07:02:04

the problem is that the closure compiler folks decided to change how the interop between commonjs and es6 works

thheller07:02:55

so the CLJS compiler had to be adjusted as well

thheller07:02:06

problem now is that babel converted ES6 -> CJS files

thheller07:02:22

are treated as CJS although they should be handled as ES6

pepe08:02:07

That's a pity. Nothing critical for me thou. I wish you best luck in solving it 👍:skin-tone-4:

thheller09:02:20

2.1.10 should cover the most common cases

Jon09:02:11

shadow-cljs - updating dependencies
shadow-cljs - dependency update failed - Could not find artifact thheller:shadow-cljs:jar:2.1.10 in central ()
error Command failed with exit code 1.

thheller09:02:53

oops. fixed.

Jon09:02:46

working now~

thheller10:02:59

still trying to figure out if this is compatible with what webpack will be doing

pepe10:02:56

For me requiring ["@material/ripple" :as ripple] still yields undefined

thheller10:02:34

AFAICT it works?

thheller10:02:15

ripple.MDCRipple.attachTo this is incorrect though

thheller10:02:20

should be ripple/MDCRipple.attachTo

pepe10:02:01

true, sorry

pepe10:02:26

it works indeed, I defined ripple as js/module$node_modules$$material$ripple$index as workaround and forget to fix it. Thank you very much!

koz14:02:21

@thheller I found that requiring threejs didn’t work correctly anymore

koz14:02:30

I’m bringing it in as ["three" :as THREE]

koz14:02:19

let me try 2.1.10 and see if that works

pithyless15:02:11

If I’ve got a resources/public/js/test/index.html and I want it to be visible for the :browser-test target, is there a way I can tell it to look for index.html in another :resource-paths? Right now it only looks at :http-root. If not, is there a way I can move files, like sift in boot?

pithyless15:02:39

The main idea being I’ve got a shadow-target/ output dir, but I’d prefer not to keep any of those file in the git repo, just have it as a temporary target that can be wiped. Is that possible?

denik15:02:05

@thheller trying to use vega-lite:

(:require ["vega-lite" :refer (compile)])
compile is undefined even though this is synonymous to https://github.com/nesterone/vue-vega/blob/9d7f1b3341471e33b402dc1383266d8570f16cfd/test/unit/specs/components/delegate/vegaLiteDelegate.spec.js when I type veg into the browser console, this variable autocompletes module$node_modules$vega_lite$build$src$index and module$node_modules$vega_lite$build$src$index.compile exists. Any ideas what might be going on here?

thheller15:02:20

@pithyless do you want to replace the default generated index.html or do you want to access that file independently?

pithyless15:02:58

@thheller I want to replace it

pithyless15:02:39

where :http-root is shadow-target/... and my file is resources/.../index.html

thheller15:02:45

shadow-cljs will only generate an index.html if none exists

thheller15:02:55

so you can just copy yours to the :test-dir?

thheller15:02:17

or set :test-dir to resources/public/js/test

pithyless15:02:48

I was trying to replicate my boot setup where resources/* where in git and all the compiled output stuff was in shadow-target/*

pithyless15:02:33

as it stands, :test-dir will be a combination of stuff I’ve got in git and stuff generated by shadow

thheller15:02:07

I just gitignore the generated files and avoid the copying

thheller15:02:21

but I'm currently planning the plugin API which would let you do things like that

pithyless15:02:54

I’ll .gitignore for now; but this kind of API improvement would be nice 🙂

thheller15:02:27

@denik I don't unterstand the question? compile does exist yes?

denik16:02:35

no everything is undefined

denik16:02:57

compile exists only through the long variable I found in the browser console

denik16:02:02

the requires do not work

thheller16:02:58

if you are on 2.1.7+ there is currently a problem. I tested with 2.1.10 which seems to work

thheller16:02:36

otherwise revert back to 2.1.6 until I fixed this mess.

denik17:02:23

2.1.10 works

thheller15:02:10

@koz confirmed that three doesn't work properly. I'll try to figure out why.

thheller16:02:07

ah nvm .. works in 2.1.10

koz16:02:16

@thheller just stopped by to tell you that (regarding 2.1.10)

koz16:02:37

however it seems like https://github.com/Khan/aphrodite doesn’t work in 2.1.10

koz16:02:48

(after working in 2.1.6)

koz16:02:02

when you require ["aphrodite" :refer (StyleSheet)], StyleSheet is undefined

thheller16:02:02

indeed. checking.

koz16:02:07

thank you

thheller16:02:16

aphrodite definitely has the strangest exports handling I have seen to date

koz16:02:55

oh wow - I haven’t really looked into the source

koz16:02:14

yeah this library isn’t like a big dependency for us, just wanted to let you know of a dependency that was working before that isn’t now (in case it affects others)

koz16:02:16

these are indeed weird exports

thheller16:02:58

problem is that they I look for this pattern to decide if the file was ES6 converted by babel

thheller16:02:00

Object.defineProperty(exports, '__esModule', {
    value: true
});

thheller16:02:12

they set it but then not actually use the exports object

thheller16:02:40

I might have to revert back to the way it was before

koz16:02:47

I wonder if this is due to them using an old version of Babel (seems to be Babel 5): https://github.com/Khan/aphrodite/pull/281. Babel 6 might have changed this: https://babeljs.io/docs/plugins/transform-es2015-modules-commonjs/

thheller16:02:13

might be but the detection was already questionable and I had to detect 3 different patterns already for the deps I had installed for testing

thheller16:02:39

so I doubt that aphrodite will be the only package with strange exports

thheller16:02:51

rather go back to the old way and try to be less smart about it I guess

justinlee16:02:19

why is it that shadow has to do all of this detection? like, how does babel+webpack manage to use es6 import syntax at all times with every npm module. maybe i’m not thinking clearly but if they are doing some kind of detection, can we go peek at their code and see what they are doing?

thheller16:02:59

actually the problem comes from the Closure Compiler and it wants to do the ES6/CJS interop

thheller16:02:44

covering all the scenarios they describe is hard if the closure compiler has different ideas

thheller16:02:16

for CLJS there isn't actually a problem if I revert it back to the way it was (without detection)

thheller16:02:10

its only tricky because I want this to work

thheller16:02:26

ie JS<-CLJS->JS interop

justinlee16:02:33

the answer to most of my “why is this so effing weird” questions in cljs is aways “because closure compiler” 🙂

thheller16:02:46

"because JS" actually 😉

thheller16:02:38

closure compiler is actually how I'd expect things to work .. then there is stuff like aphrodite which doesn't even make sense when you look at it 😛

thheller16:02:20

there are too many ways of doing things in the JS world and they seem to be adding things every few months

justinlee16:02:14

i mean i know js is bizarre. but i still maintain that if cljs did its own symbol minification we could ditch closure compiler and have seamless integration with the js ecosystem.

thheller16:02:31

well I wouldn't want to give up the :advanced stuff Closure does and from what I can tell the JS world is working towards getting something comparable

thheller16:02:42

but that just won't work with some of the stuff they do

justinlee16:02:53

well anyway you are mostly there anyway

thheller16:02:09

I actually think they will converge on a set of standards at some point that will pretty much match what GCC does today

justinlee16:02:30

honestly if i can just get protorepl in atom working with shadow and maybe figure out a patch to get my linter working everything will be near perfect

justinlee17:02:57

question: the (:require ["npm-module-name" :as something]) is a really nice feature, but I wonder does it make sense to provide an option (maybe in :js-options?) to use a synthetic namespace. i ask because right now the string messes up my linter and deviates from cljs. it’s nice to be able to require the right module name right from the source without a compiler option but in the final estimation not critical. just a thought.

thheller17:02:24

don't tell anyone but (:require [npm-module-name :as something]) actually works as well

thheller17:02:50

I just think a string is more reliable and makes it clear that you are importing JS and not CLJS

thheller17:02:14

but CLJS allows the symbol so I have to do it as well

justinlee17:02:31

oh yea that fixes my linter 🙂

justinlee17:02:07

it doesn’t fix protorepl sadly

justinlee17:02:30

it dumps

java.io.FileNotFoundException: Could not locate seekeasy/handler__init.class or seekeasy/handler.clj on classpath., compiling:(seekeasy/repl.clj:1:1)
which i assume must be part of the repl protocol as i don’t have a handler.clj or a repl.clj

thheller17:02:02

"clojure seekeasy" doesnt return anything useful on google or clojars

justinlee17:02:32

oh sorry seekeasy is my namespace

thheller17:02:46

I can take a look at proto repl in a bit

thheller17:02:18

looked at it a while ago but forgot everything

justinlee17:02:30

i’ve been looking for something that documents the repl/nrepl convention/protocol but haven’t found anything

justinlee17:02:16

it’s been one of the most confusing things being a new cljs programmer

thheller18:02:23

the convention is to use middleware for tooling stuff but IIRC proto-repl just evals stuff

justinlee18:02:07

looking at the code, it seems to implement an nrepl connection. isn’t that all you need?

thheller18:02:46

it depends on how they do the CLJS interop

thheller18:02:10

nrepl connect should work without issue but not sure what they do regarding cljs

thheller18:02:42

its so weird .. I did so much coffeescript a couple years ago but I can't figure out whats going on anymore 😛

thheller18:02:53

it just looks so weird now