Fork me on GitHub
#shadow-cljs
<
2024-03-19
>
djanus10:03:42

I just upgraded shadow-cljs (from 2.17.6 to 2.27.5), and I started getting this:

Warnings in Library Code:
 abs already refers to: cljs.core/abs being replaced by: zprint.range/abs
But I’m perplexed because my project doesn’t depend on zprint explicitly, or as far as I can tell, implicitly (it doesn’t show up anywhere in shadow-cljs info ). Is it shadow’s own dependency?

thheller11:03:16

shadow-cljs does not depend on zprint no, never has

thheller11:03:16

do you actually use shadow-cljs.edn to manage deps? or rather deps.edn/project.clj?

thheller11:03:27

shadow-cljs info doesn't work well for those cases

thheller11:03:42

could also be stuff injected by your editor if your editor is starting it? e.g. emacs jack-in

djanus11:03:54

*correction: shadow-cljs info does show it as a direct dependency, but it’s not in shadow-cljs.edn

djanus11:03:24

I do use it for managing deps (although there’s a deps.edn as well in the same dir, for clj dependencies, so unrelated)

djanus11:03:19

and I start shadow-cljs manually from terminal, so it’s not that either

thheller11:03:33

dunno where it would come from other than one of your other dependencies

thheller11:03:22

can you send the .shadow-cljs/classpath.edn?

thheller11:03:53

that contains all the raw classpath data, maybe info just doesn't construct it correctly

djanus11:03:59

will privmsg if that’s ok

djanus11:03:24

hm i just realized that I have a zprint alias in my ~/.clojure/deps.edn ... could that be it?

djanus11:03:28

{:aliases {:zprint {:extra-deps {org.clojure/clojure {:mvn/version "1.9.0"},
                                 zprint/zprint       {:mvn/version "1.0.2"}},
                    :main-opts  ["-m" "zprint.main"]}
           :with-datomic-valcache {:jvm-opts ["-Ddatomic.valcachePath=/Users/nathell/.datomic-valcache/"
                                              "-Ddatomic.valcacheMaxGb=1"]}
           :rebel  {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}}
                    :main-opts  ["-e" "(do (require 'nrepl.server) (require 'cider.nrepl) (nrepl.server/start-server :port 7777 :handler cider.nrepl/cider-nrepl-handler) (println \"Started nREPL at port 7777\"))" "-m" "rebel-readline.main"]}
           :prof   {:extra-deps {com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.3"}}
                    :jvm-opts   ["-Djdk.attach.allowAttachSelf" "-XX:+UnlockDiagnosticVMOptions" "-XX:+DebugNonSafepoints"]}}
 :deps    {cider/cider-nrepl          {:mvn/version "0.30.0"}
           org.clojure/clojure        {:mvn/version "1.10.1"}
           vvvvalvalval/scope-capture {:mvn/version "0.3.2"}}}

thheller11:03:56

fwiw (tap> (edn/read-string (slurp ".shadow-cljs/classpath.edn")) with (require '[clojure.edn :as edn]) in via npx shadow-cljs clj-repl and then look at in

thheller11:03:13

gives me

#{[rewrite-clj "0.6.1" :exclusions [[com.cemerick/austin]]]
  [borkdude/edamame "0.0.11-alpha.12"]
  [rewrite-cljs "0.4.5" :exclusions [[org.clojure/clojurescript]]]}

thheller11:03:39

under the :deps-resolved key

djanus11:03:43

yup I was wrong originally, sorry > *correction: shadow-cljs info does show it as a direct dependency, but it’s not in shadow-cljs.edn (edited)

thheller11:03:32

wait nvm, that are the deps of zprint 😛

thheller11:03:23

its re-frame-10x

thheller11:03:33

#{[superstructor/re-highlight "1.1.0"]
  [cljsjs/highlight "10.3.1-0"]
  [com.yahoo.platform.yui/yuicompressor
   "2.4.8"
   :exclusions
   [[rhino/js]]]
  [zprint "1.0.1"]}

djanus11:03:57

i guess the q remains why it’s listing it as a top-level dep, but minor

djanus11:03:25

thanks Thomas, you’re a star! i’ve just started sponsoring you on github, it’s long overdue 🙂

thheller11:03:35

thanks, happy to help 🙂

thheller11:03:41

[day8.re-frame/re-frame-10x "1.2.2" :exclusions [[com.cognitect/transit-java] [org.clojure/clojure] [thheller/shadow-cljs] [org.clojure/clojurescript] [com.cognitect/transit-clj] [org.clojure/core.async]]]
  [cljsjs/highlight "10.3.1-0"]
  [com.yahoo.platform.yui/yuicompressor "2.4.8" :exclusions [[rhino/js]]]
  [superstructor/re-highlight "1.1.0"]
  [zprint "1.0.1"]
    [borkdude/edamame "0.0.11-alpha.12"]
    [rewrite-clj "0.6.1" :exclusions [[com.cemerick/austin]]]
    [rewrite-cljs "0.4.5" :exclusions [[org.clojure/clojurescript]]]

thheller11:03:58

doesn't print as top lvl for me? using your snapshot?

djanus11:03:57

i’m getting

thheller11:03:02

hmm thats a different version?

thheller11:03:52

maybe you have something in ~/.shadow-cljs/config.edn?

djanus11:03:07

just cider-nrepl

djanus11:03:13

i did bump re-frame-10x and the warnings went away, though

thheller11:03:36

yeah you had some pretty old stuff in there

djanus11:03:33

ah that info is after I bumped it 🙂

djanus11:03:56

me being the source of confusion again

manutter5114:03:33

I'm trying to include the latest Tableau JS API in my project, and I'm getting an error:

[:main] Build failure:
no output for id: [:shadow.build.classpath/resource "tableau.embedding.3.3.0.js"]
{:resource-id [:shadow.build.classpath/resource "tableau.embedding.3.3.0.js"]}
ExceptionInfo: no output for id: [:shadow.build.classpath/resource "tableau.embedding.3.3.0.js"]
I'm trying to require it with (:require ... ["/tableau.embedding.3.3.0.js" :as tabjs]...) in my NS declaration since I had to download the JS file direction -- it's not in NPM. Looking at the JS file, I see a lot of mentions of __webpack_require__, so I assume it's expecting to be processed by webpack, which I have zero experience with. Any suggestions? I'm lost at sea here.

thheller15:03:40

what kind of file is that? why is that on the classpath?

thheller15:03:36

can you link me to the instructions for the package? why did you have to download it?

manutter5115:03:14

That's the API file, supplied by Tableau that I'm trying to integrate into my app. It's a plain JS file that I downloaded because I thought I needed it locally to include it in my build.

manutter5115:03:43

It is available via a CDN if that's an option.

thheller15:03:52

sorry but "JS file" is very very very broad definition, so I need more details

thheller15:03:11

if this is intended to be included separately you do no include it via the build at all

thheller15:03:23

just like a CDN build

thheller15:03:31

you just put it into your public/vendor or so dir

thheller15:03:51

then in HTML <script src="/vendor/tableau.embedding.3.3.0.js"></script>

thheller15:03:06

(assuming public is the folder used for your webserver)

manutter5115:03:44

Ok, that sounds promising. I thought I needed the source locally to be able to reference classes included in the file, but it sounds like I just need to load the script in my app and then just do the old-fashioned js/TableauViz kind of thing.

thheller15:03:12

I don't have the slightest clue what this is or does, so can't comment on that

thheller15:03:33

but if its an intended "CDN" type library, then it is likely not meant to be "consumed" by other build tools such as shadow-cljs

thheller15:03:48

as in it is already standalone and fully bundled

manutter5115:03:05

Well, you've at least challenged my assumptions, so I have some more directions I can explore. That's what I needed to know, thanks!

manutter5115:03:44

I don't have much experience working in the "raw" ES6 ecosphere, and I'm also new to shadow-cljs, so it's easy for me to get lost.

thheller15:03:04

basically you always follow the instructions given by the library, and if they give you some import statements you are supposed to do then you can reference https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages which has a bunch of translation examples

manutter5115:03:24

👍 Thanks!

thheller15:03:39

if no such instructions are given and just a CDN reference with a script tag then you do that and don't tell your build about it at all 😛

manutter5115:03:17

It does have "import" statements in the docs, but they weren't working because the library isn't an NPM package (got an error about the imported classes not being present in node_modules). But we'll see how far I get with the JS globals. At least it's building successfully now.

thheller15:03:24

do you have a link for me?

manutter5115:03:03

I'm upgrading from an earlier, non-ES6 version of the API, so I'm following the instructions here: https://help.tableau.com/current/api/embedding_api/en-us/docs/embedding_api_migration_guide.html

thheller15:03:18

ah ok, so it is an ES module. then the require should have been fine

thheller15:03:27

but possible that the file includes something the closure compiler doesn't unterstand

thheller15:03:46

so could be that the script tag is the better option, if its sufficient

manutter5115:03:01

Sounds good, I'll pursue that.