This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-07-27
Channels
- # announcements (16)
- # architecture (19)
- # beginners (31)
- # calva (2)
- # cider (1)
- # clerk (4)
- # clj-yaml (58)
- # cljdoc (2)
- # cljs-dev (10)
- # clojure (77)
- # clojure-europe (108)
- # clojure-norway (26)
- # clojure-sanfrancisco (2)
- # conjure (1)
- # cursive (2)
- # datahike (5)
- # datomic (13)
- # emacs (7)
- # etaoin (3)
- # hyperfiddle (15)
- # introduce-yourself (3)
- # kaocha (1)
- # off-topic (21)
- # reagent (4)
- # releases (1)
- # shadow-cljs (41)
- # spacemacs (28)
- # specter (8)
- # squint (30)
- # yamlscript (2)
Hey, I'm playing with Lit components and compile them with shadow-cljs defclass syntax (@thheller huge thanks for building it!). Everything is working relatively smooth except lifecycle callbacks. I have to employ a terrible hack to call super.connectedCallback()
method. Am I missing some better way to call it?
This is how I define connectedCallback and that long row starting with .call does the trick but looks very ugly. I guess I might add some macro for it, but want to make sure I'm not missing something first.
(connectedCallback
[this]
;; Object.getPrototypeOf(Dog.prototype).speak.call(this);
(.call (.-connectedCallback (.getPrototypeOf js/Object lit/LitElement.prototype)) this)
(js/console.log "Hello from Dom" this)))
PS lit works fine on 2.25.0.kind of a hack I guess, still need to add the same (super)
logic that the constructor has I guess
No, js/super.connectedCallback
doesn't work. It generates super$ symbol and then can't find it.
And this one doesn't work either 😞
(.connectedCallback (super))
Spitting it out with
(js* "super.connectedCallback()")
doesn't work either, since there are some assignments before super call and javascripts crashes with
'super' keyword unexpected here
(.. lit/LitElement -prototype -connectedCallback (call this))
should work I guess but isn't much better thant what you had
Thank you so much for looking into it. I'll follow the issue and will use the workaround for now.
Hi all! I'm building some edge-functions for netlify, and one of them just got a build error because the stripe-lib for deno is not hosted on the CDN anymore. The new import they mention is via npm-specifiers, like import Stripe from "npm:stripe@^11.16";
Any idea how I would use those with shadow-cljs?
stripe includes an export target for deno now, but I have no clue if and how I can use this.. not much experience in the js-world yet.
this is part of the package.json:
"exports": {
"types": "./types/index.d.ts",
"browser": {
"import": "./esm/stripe.esm.worker.js",
"require": "./cjs/stripe.cjs.worker.js"
},
"deno": {
"import": "./esm/stripe.esm.worker.js",
"require": "./cjs/stripe.cjs.worker.js"
},
"worker": {
"import": "./esm/stripe.esm.worker.js",
"require": "./cjs/stripe.cjs.worker.js"
},
"default": {
"import": "./esm/stripe.esm.node.js",
"require": "./cjs/stripe.cjs.node.js"
}
}
(:require ["npm:stripe@^11.16" :default Stripe])
also works but that is "deprecated" and unofficial
or when you need to bundle skip the :js-provider
setting and just (:require ["stripe$default" :as Stripe])
the $default
stuff is explained here https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages
with {:js-provider :import}
the require strings are just passed through directly to deno, shadow-cljs does nothing to them
yeah it‘s running in deno - can I exclude only stripe though and include other npm libs directly?
I tried setting :js-options {:js-provider :import}
and requiring with (:require ["npm:stripe@^11.16$default" :as Stripe])
, but it fails with this error
Closure compilation failed with 1 errors
--- shadow.js.shim.module$npm_stripe$^11_16$default.js:2
Parse error. Semi-colon expected
if I bundle it and require it with (:require ["stripe$default" :as Stripe])
, is there a way to choose the deno version? (as in the deno-export of the stripe npm package)