This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-20
Channels
- # adventofcode (1)
- # announcements (2)
- # babashka (81)
- # beginners (33)
- # calva (11)
- # circleci (4)
- # clj-commons (3)
- # cljdoc (7)
- # clojars (5)
- # clojure (21)
- # clojure-europe (5)
- # clojure-japan (1)
- # clojure-norway (27)
- # clojurescript (24)
- # emacs (11)
- # events (5)
- # fulcro (14)
- # lsp (40)
- # malli (9)
- # nbb (1)
- # off-topic (5)
- # portal (4)
- # reitit (8)
- # scittle (9)
- # shadow-cljs (14)
- # spacemacs (3)
- # tools-deps (3)
I've looked at https://lwhorton.github.io/2018/10/20/clojurescript-interop-with-javascript.html . One thing I don't understand is this: How do I get shadow-cljs to emit a es module or a iife (is this the default?) where it exports some cljs functions which I can then call from js land? Most of the docs I find online seem to make the assumption of "js has libraries; cljs drives main loop"; I want a situation where "cljs builds to a js library I can import; and js drives the main loop, calling into the exported cljs functions"
probably in combination with https://shadow-cljs.github.io/docs/UsersGuide.html#_third_party_tool_integration if you intend to integrate into another build tool
What's the issue here with goog.dom NodeType?
cljs.user=> (require '[goog.dom])
nil
cljs.user=> goog.dom/NodeType
WARNING: Use of undeclared Var goog.dom/NodeType at line 1 <cljs repl>
#js {:ELEMENT 1, :ATTRIBUTE 2, :TEXT 3, :CDATA_SECTION 4, :ENTITY_REFERENCE 5, :ENTITY 6, :PROCESSING_INSTRUCTION 7, :COMMENT 8, :DOCUMENT 9, :DOCUMENT_TYPE 10, :DOCUMENT_FRAGMENT 11, :NOTATION 12}
Seems like you should import it instead of requiring it:
cljs.user=> (import 'goog.dom.NodeType)
nil
cljs.user=> NodeType
#js {:ELEMENT 1, :ATTRIBUTE 2, :TEXT 3, :CDATA_SECTION 4, :ENTITY_REFERENCE 5, :ENTITY 6, :PROCESSING_INSTRUCTION 7, :COMMENT 8, :DOCUMENT 9, :DOCUMENT_TYPE 10, :DOCUMENT_FRAGMENT 11, :NOTATION 12}
From https://clojurescript.org/reference/google-closure-library#import-a-class.The (import '(goog.dom NodeType))
syntax (which I myself prefer more) seems to work as well, even though the link above uses it for enums.
anyone know of a js or cljs library for quickly generating flake ids in the browser?
You can use test.check generators (or spec uses that under the hood) to generate data. For example, if by "ids" you mean UUIDs, there is a generator that already does that.
(require '[clojure.test.check.generators :as gen])
(gen/sample gen/uuid)
(#uuid "ba5f8d50-bb93-4b0f-9520-445d7481cc94"
#uuid c7a0fc19-fbf9-40d7-8ee2-1e80e589f14e"
#uuid "aeadc7c6-6872-4d96-9a9b-db898913860c"
#uuid "292f6f3a-7e92-4f29-8379-d0056c769284"
#uuid "87ff55ab-7964-4515-8606-34d15396a0bc"
#uuid "873059ce-55a3-43dd-832f-9a4c2fb762ec"
#uuid "a5aa04f0-62a9-4c5a-8144-42252f655fda"
#uuid "6aff1af1-deeb-44fe-a877-0f90f1f40bc2"
#uuid "ae0b0062-3087-434b-b111-521927a03470"
#uuid "1ee61c50-1f6d-47fe-8e4e-48c218654f16")
Lol. Sorry, I thought it was a typo for "fake id". Looks like you can turn to npm for that https://www.npmjs.com/package/flakeid
This looks to be clj-only, but you could use it on the server-side. https://github.com/maxcountryman/flake/blob/master/src/flake/core.clj
yeah i already have a flake generator on the server from mulog. i was looking for something in the browser
How concerned should we be about this entry in NVD: https://nvd.nist.gov/vuln/detail/CVE-2022-41719 ? It's rated as a 'high' risk.
probably it's a false positive as that appears to be a Go dependency? even if it was a Java one, they only affect cljs compilation, not your production code
I just working on a library that has clojurescript as a dependency, so I guess this won't be an issue until someone uses it to face the public. Thanks.
clojurescript doesn't use msgpack at all, its just a dependency due to transit-java supporting it. so you are fine.
in a deps.cljs, there is a section that says:
{:npm-deps [ ... ] }
Is it possible to specify a path where instead of giving it a "npm-name, npm-version", we specify a path on the local filesystem ?Try this syntax: https://stackoverflow.com/questions/15806241/how-to-specify-local-modules-as-npm-package-dependencies
For :foreign-libs , i.e. https://clojurescript.org/reference/packaging-foreign-deps why do we need the :externs file ? Wouldn't the goog closure read in the *.js files, then rename everything consistently ?