Fork me on GitHub
#clojurescript
<
2018-04-12
>
lilactown00:04:57

has anyone gotten any of the common HTTP request libs working with proxies?

lilactown00:04:39

I’m thrashing - started out using cljs-http, but that didn’t respect the HTTP_PROXY/HTTPS_PROXY environment variables

lilactown00:04:30

I’m trying to us kvlt, which uses request under the hood if it detects you’re using Node.js. I thought request respected the HTTP/HTTPS_PROXY env vars, but not currently working QQ

souenzzo02:04:18

I'm trying to use some libraries from npm, I get some success with react. But when I try to install the graphql, i get Undefined nameToPath for module$tmp$cljs_issues$node_modules$graphql$index_mjs. Repo to reproduce: https://github.com/souenzzo/cljs-issues

soulflyer08:04:01

I'm seeing a very odd effect with cljs.repl/dir. It's output is all squashed together onto a single line. If I feed it into with-out-str I can see the newlines again. My emacs config has just undergone major surgery so I could well have broken something, but I can't for the life of me figure out what. (println(with-out-string(dir xx))) gives me what I would expect from (dir xx). Any ideas how I could have broken this? It's not a change in the source of dir, that's been the same for a very long time. Here is the full weirdness:

cljs.user> (dir anh-front.tree)
childchild-with-labelchildrenexpandlabelsmap-datanodenode-dataroottest-tree
nil
cljs.user> (with-out-str (dir anh-front.tree))
"child\nchild-with-label\nchildren\nexpand\nlabels\nmap-data\nnode\nnode-data\nroot\ntest-tree\n"
cljs.user> (println (with-out-str (dir anh-front.tree)))
child
child-with-label
children
expand
labels
map-data
node
node-data
root
test-tree
nil

javi10:04:31

has anyone used to load a script type="module" ?

mfikes11:04:59

@soulflyer Out of curiosity, which REPL and ClojureScript version are you using?

soulflyer11:04:22

@mfikes clojurescript 1.10.238 and figwheel repl

mfikes11:04:47

It might be worth checking if this occurs at the terminal via lein figwheel (to isolate it from anything going on in emacs)

mfikes11:04:16

Ahh, I can repro the issue as well @soulflyer — in a simple fresh Figwheel project in the terminal

soulflyer12:04:35

beat me too it. Same here, it's happening in lein figwheel here too.

mfikes12:04:53

It is not related to 1.10.238; my hunch is Rebel Readline

soulflyer12:04:36

What's that?

mfikes12:04:08

It is Bruce's new REPL that is included with the latest Figwheel

thheller12:04:19

@fj.abanses can't do that with jsloader. well only if it doesn't contain import/export.

soulflyer12:04:28

Ah , that's the new look I was seeing in lein figwheel. Seems like a big improvement on the old functionality. And emacs uses this too?

mfikes12:04:28

I have no clue about emacs and REBL readline, but since Bruce uses emacs, you can be pretty sure it works. 🙂

mfikes12:04:07

I don't use emacs, so I can't really speak to it though, TBH.

soulflyer12:04:12

and I don't know enough about how emacs links in with figwheel yet...

iGEL12:04:16

Hey, I have a problem with my tests when upgrading clojurescript. The last working version of cljs is 1.9.521, with 1.9.542 it fails. This is the failure:

goog.require could not find: tools.money

   in logToConsole_
Error: goog.require could not find: tools.money

   in require
tools/money.cljs is my lib I want to test, it's located it src-cljs/tools, while the test & test runner are in test-cljs/test. The runner looks like this:
(ns test.test-runner
  (:require [test.money-test]
            [clojure.test :as t :refer [run-all-tests]]))

(enable-console-print!)

(defmethod t/report [::t/default :end-run-tests] [m]
  (when-let [exit (cond (exists? js/phantom) js/phantom.exit
                        (exists? js/process) js/process.exit)]
    (exit (+ (:fail m) (:error m)))))

(run-all-tests)
And the beginning of the test:
(ns test.money-test
  (:require [clojure.test :refer [deftest testing is are run-tests]]
            [tools.money :as money]))
; ...
Compiling raises no errors or warnings besides replacing cljs.core/zero? and cljs.core/neg?, and in the production code everything works fine! Ah, finally I run the tests with phantomjs app/assets/javascripts/cljs/test.js

iGEL12:04:31

Any ideas? 🙏

mfikes14:04:38

@igel When you run your tests, is src-cljs/tools on your classpath?

iGEL14:04:56

How can I check this? (I'm surprised that there is classpath in clojurescript)

mfikes14:04:37

The classpath is usually augmented by :source-paths or somesuch by whatever tooling you are using

mfikes14:04:20

Given the changelog, my only real hunch is that you are using cljs.spec in your code

iGEL14:04:38

cljsbuild is reporting: Compiling ["../../../app/assets/javascripts/cljs/test.js"] from ["src-cljs/tools" "test-cljs"]...

iGEL14:04:34

That answers your question, doesn't it?

mfikes14:04:21

Yes, that looks good, I would expect "src-cljs/tools" to be on your classpath

mfikes14:04:14

One other suggestion is to go look in your out directory to see if tools.money is there

mfikes14:04:17

I’d compare what the out directories look like between when it works and when it fails

iGEL14:04:56

There is a clear difference. After removing the target dir, the broken build has a lot less files and the entire tools directory is missing (without deleting the target, it was the same, lein clean didn't do anything)

mfikes14:04:45

Does tools.money perhaps use cljs.spec?

iGEL14:04:04

Possibly, but how can I check or disable spec?

mfikes15:04:57

@igel What I’m thinking is that, if any of the namespaces that core.money depends on is requiring cljs.spec instead of cljs.spec.alpha, that could cause them to fail to compile. Of course, there should be compiler errors emitted regarding this, but it might be worth checking out that aspect just in case.

iGEL15:04:26

I see. But there are no errors or warnings (besides the 2 about replacing two methods, see above) and this lib only requires [clojure.string :as str], [goog.string :as gstring] & [goog.string.format]. There are however quite a few dependencies defined in the project.clj for other builds (I'll try tomorrow to remove them)

iGEL15:04:46

thank you so far for your help 🙂

tomc17:04:16

I'm trying to use two dependencies from cljsjs - https://github.com/cljsjs/packages/tree/master/react-highlight and https://github.com/cljsjs/packages/tree/master/quill. React-highlight uses a library called highlight.js that is an optional dependency of quill. If react-highlight is on the page before quill, everything works fine, but if quill is loaded before react-highlight, I get an error when trying to use quill. Is there a way to force one dependency to always load before another?

dnolen17:04:32

@souenzzo @jannis worked on this, I believe you can use a different resolution method to make GraphQL work

jannis17:04:04

Yes. @souenzzo Try passing :package-json-resolution ["browser" "main"] to the CLJS compiler.

👍 4
souenzzo18:04:43

lein install from clojure/clojurescript and use 0.0-SNAPSHOT should work, right?

souenzzo18:04:47

Compile Exception
java.lang.AssertionError: Assert failed: (or (= (:package-json-resolution opts) :webpack) (= (:package-json-resolution opts) :nodejs) (and (sequential? (:package-json-resolution opts)) (every? string? (:package-json-resolution opts))) (not (contains? opts :package-json-resolution)))
I will try to use clj + git deps this night.

souenzzo01:04:11

@jannis Using clojurescript from master and :package-json-resolution ["browser" "main"], still the same error.

souenzzo02:04:47

Where I can find docs about packageJsonEntryNames?

souenzzo03:04:08

Few more tryies, now I'm with Error: Undefined nameToPath for module$home$souenzzo$new_school$node_modules$react_redux$es$index due :package-json-resolution ["browser" "main"] setting

jannis10:04:55

@souenzzo What are your NPM deps and how do you import them in your .cljs file(s)?

souenzzo13:04:00

@jannis there is a repo https://github.com/souenzzo/cljs-issues (the repo isn't using cljs on master)

jannis17:04:20

Make sure you have the latest ClojureScript version for that.

qqq19:04:41

In cljs, how do I check if an object is a js/Float32Array. ?

justinlee19:04:53

@qqq use type:

cljs.user=> (def x "string")
#'cljs.user/x
cljs.user=> (= (type x) js/String)
true

👍 4
Michael Fiano21:04:47

Is there anyone interested in participating in the Lisp Game Jam next week using ClojureScript? I'm trying to pair someone looking for a team mate.

kenny22:04:53

Where in cljs.spec.test.alpha/instrument do functions get replaced with the wrapped spec-checking fn?

mfikes23:04:36

@kenny The scope of that may also include up to the outermost doto there. FWIW, this was revised with 1.10.238 in order to accommodate an issue with multi-arity functions (CLKS-2397).