Fork me on GitHub

Why am I getting Use of undeclared Var cljs.analyzer/Throwable with 1.11.54?

------ WARNING #2 - :undeclared-var --------------------------------------------
 Resource: cljs/analyzer.cljc:4403:12
4400 |   []
4401 |   (try
4402 |     @(ns-resolve ' '*alias-map*)
4403 |     (catch Throwable t
 Use of undeclared Var cljs.analyzer/Throwable
4404 |       nil)))
4405 |
4406 | #?(:clj
4407 |    (defn forms-seq*
It's also complaining about cljs.analyzer/ns-resolve.


@dnolen Let me know if I can provide you with any further information 👍


@U06B8J0AJ it's already fixed, please use ClojureScript master and let me know if it works for you

👍 1

@dnolen c0d305274d7813e22cd2753d247a02e9dd95ddee fixes the warnings.


I'm curious what you are doing since this didn't arise in the unit tests, I guess you're calling analyze-form-seq yourself?


Honestly, I have no idea. I've been hunting for the origin of this (since no source is given except for CLJS itself). My best guess is that it's some transitive dependency. I haven't dug into those yet.


hrm ok, thanks


Although, hang on. Could it be this lazy-ass thing I wrote for a test seed?

(defmacro entities-in-ns
     "Returns a vector of all entities defined in the supplied namespace."
     `(filterv entity? (map deref (vals (ns-publics ~ns-symbol)))))


hrm from what's visible there, I doubt it


looks like a bug introduced in 1.11.51 I guess. Throwable is a java thing, so needs to be behind a reader conditional for self-host I guess

👍 1

I have some JS that I’d like to compile via :foreign-lib so it can be live reloaded. If foo/a.js calls require ./b.js, is that supported? I’m trying to specify it as :provides ["foo.a"] and :provides ["foo.b"], but closure isn’t finding ./b.js. It looks like it’s searching for ./b.js relative to my package.json, rather than relative to a.js


@thheller hrm, odd that didn't get caught by the self host tests


@arohner you're saying something a bit contradictory. If it's foreign lib - you cannot compile through Closure (technically you can, but it just doesn't work well in the general case, so you need to really know what you are doing). So not sure what you mean or what you are trying to do.


If it's custom JS you wrote, then you don't need foreign libs.


My existing build is using :target :bundle. I have JS I wrote that is currently nodeJS and using node deps. I would like the custom JS to live reload using figwheel. AIUI, the easiest way to do that is to run the JS through Closure


that's just not how :target :bundle works


ClojureScript does not understand Node.js stuff, it assumes the JS bundler will bundle all that stuff into one big thing


to clarify a bit more (:require [some-node-thing :as ...]) in your ns form is completely synthetic


there is nothing really to load, because some JS bundler already bundled the JS bits into one big file (when using :target :bundle)


:foreign-lib use directly can support live reload, but that's separate from :target :bundle stuff


If I define :foreign-lib for the npm deps of my custom JS, and then foreign lib my JS, would that work?


let's step back for a second


:foreign-lib is an old thing that existed before Webpack and it's ilk, before people stored web libs in Node.js - remember Bower


the assumption is the JS library is read to go - has no dependencies, already compiled, etc.


in this case we load these files for you at development time, and we concatenate them in advanced builds


that's the true purpose of :foreign-lib


:target :bundle solves a different problem - you want to use something from node_modules - your JS is not ready to go


in fact, the JS you want to use has an complex dependency graph, or feature set only JS tools can understand


in this case we don't really load anything, we assume that you will bundle all this stuff up into one big file


we inject ClojureScript into the entrypoint, but all your deps are already loaded


based on this I would say :target :bundle + hot reloading some JS through Figwheel is not really practical


and probably in many cases cannot even work


because JS libs are represented as closures in the tooling


I haven't followed JS hot loaders because far as I can tell it is a big mess and they never got it work (to our REPL expectations) because the whole thing is conceptually broken from a Lisp viewpoint


AFAICT, the JS hotloaders also don’t work for us because they assume ESM/commonJS modules, and the CLJS hot reloaders assume closure modules


there are bigger problems due to ESM/CJS here, we would never use it anyway


with :foreign-lib you could setup a watching JS bundler, and then have Figwheel watch for changes to the produced .js file if you don't need what :target :bundle provides


Are there any alternatives? A full suite of styled clojurescript components?


There are CLJS bindings/wrappers for other libraries, like MUI.


And there's always an option to use a UI library directly - i.e. creating your own wrapper for it, in a way.


Interesting taking a look at MUI right now. Thanks


@U06B8J0AJ do you have an example in clojurescript or do you use regular react


In Reagent, you'd do something like

(def listbox
  (reagent/adapt-react-class Headless/Listbox))


Given an import of

["@headlessui/react" :as Headless]


And then just use it as you would a normal Reagent component,

[listbox {...}]


Follow the structure of the examples on the Headless website. Keep in mind that some things need to be converted to JS, and some keywords are different, like :className instead of :class, etc.

👍 1

Cann't display an image from S3! Getting the image ->

{:http-xhrio {:method          :get
              :uri             (:s3/url data)
              :timeout         8000
              :headers         {"Content-Type" "image/*"}
              :response-format (ajax/raw-response-format)
              :on-success      [::get-uploaded-image-success]
              :on-failure      [::s3-url-failure]}
I can see the response-->
"_response" "�PNG\r\n\n\rIHDR��\bΧ&�HiCCPICC Profile(�c``I,(�aa``��+)\nrwR���R`��� Ė\fl����>@%\f0|���\b�/��\nch���{�ѷ���X1գ����d ��3��JS�l����):\nȞb�C�@�$\b�\bXMH�3�}

on the reagent comp->>
[:img {:src    @form-values-image}]

The image is not being displayed!  But when I click on the link in the browser console, it downloads the image.

Any idea?  Thanks in advance.


Hmm, I don't know anything at all about S3, but the symptoms you describe are what happens when the server sends a PNG file with a Content-Type that's not image/png.


Thank you. I think it is in the right direction. I uploaded a new image (png), with Content-Type, image/png. Checked on aws, and it is right. But still getting the same issue. Does the :img on the reagent comp has a content-type attr? will theck. Thanks.


Thanks again. I figured out, finally. First, I changed the seeting at AWS metadata of that image to "image/png", as previously stated. Second, I used the URL directly inside the map to :img tag in the reagent component, as shown below:

[:div.display-image     [:img {:src    @get-image-s3-url}]]
Thanks again.

👍 1

I think :src expects a base64 encoding.


vorher zur stadt zähltzalbwegs kann