This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-28
Channels
- # announcements (7)
- # beginners (49)
- # calva (18)
- # cider (48)
- # clj-yaml (1)
- # clojure (37)
- # clojure-dev (23)
- # clojure-europe (29)
- # clojure-nl (1)
- # clojure-norway (16)
- # clojure-sweden (41)
- # clojure-uk (6)
- # clojurescript (32)
- # community-development (9)
- # conjure (4)
- # datomic (13)
- # hyperfiddle (24)
- # kaocha (6)
- # leiningen (4)
- # missionary (46)
- # nextjournal (1)
- # nrepl (26)
- # off-topic (101)
- # shadow-cljs (67)
- # testing (9)
- # yamlscript (5)
Hello, I am trying to use the marked
markdown library with a :browser
target. Details of things I tried and failures in the thread.
["marked" :as marked]
[:app] Build failure:
Failed to inspect file
/home/chrism/dev/yt-transcript.com/node_modules/marked/lib/marked.cjs
Errors encountered while trying to parse file
/home/chrism/dev/yt-transcript.com/node_modules/marked/lib/marked.cjs
{:line 2247, :column 17, :message "'identifier' expected"}
["marked/marked.min.js" :as marked]
package marked had exports, but could not resolve ./marked.min.js
{:package #object[java.io.File 0x3550d766 "/home/chrism/dev/yt-transcript.com/node_modules/marked"], :require-from nil, :rel-require "./marked.min.js"}
ExceptionInfo: package marked had exports, but could not resolve ./marked.min.js
shadow.build.npm/find-resource-in-package (npm.clj:807)
shadow.build.npm/find-resource-in-package (npm.clj:793)
shadow.build.npm/find-resource (npm.clj:923)
shadow.build.npm/find-resource (npm.clj:847)
shadow.build.resolve/find-npm-resource (resolve.clj:123)
shadow.build.resolve/find-npm-resource (resolve.clj:94)
...
No that's all that is printed in the terminal. Is there something I can do to get one?
the closure compiler is choking on this line
parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
> which shadow-cljs version do you use?
"version": "2.25.3"
["marked/lib/marked.umd.js" :refer [parse]]
> JS reload failed Error: Package subpath './lib/marked.umd.js' is not defined by "exports"
Is there a way to tell it to ignore "exports"?
Info attached.
If I use ["marked/lib/marked.esm.js" :refer [parse]]`` I get the same error.
All good I can use a different markdown renderer lib.
Ah ok.
Ah ok so it's closure not supporting the new syntax. Understood, thanks.
Yes I do. At night as I fall asleep I whisper curses against their names.
This was a big issue with Python too - continuously introducing cool new syntax that turns every stack into a giant house of cards every time you upgrade any package by one version.
Thank you for maintaining shadow-cljs in the midst of this madness.
yeah still work in progress I guess. unfortunately not something I can influence or work around from the shadow-cljs side
All good thanks for your help.
I downgraded marked one version and it now imports.
I could be wrong, but it looks like when I send multiple eval requests through shadow-cljs nrepl quickly, I don't get a [done] message for them, which would violate nrepl spec IIUC, I'm not sure but does that sound right?
a stack of results, at the bottom I sent (+ 1 1) requests slowy and each returned [done], at the top I sent them quickly and didn't get a [done], it's possible that my code is responsible for this but I don't think so
might be possible yes, I think the assumption was that the client waits for the done before sending the next eval
not impossible of course, just didn't bother since waiting for the previous result is usually what you want
I think sometimes I'm not certain that the reason is but waiting for the done, I thought it was sorted but now I can't see a pattern when "done" is returned and when it isn't
I don't think it's happening just when the client doesn't wait for a done, I'm also seeing it when I do want
there is a nrepl-debug tool in shadow-cljs if you want to make sure what actually goes over the wire
npx shadow-cljs --force-spawn run shadow.nrepl-debug 5000 .shadow-cljs/nrepl-port
while another shadow-cljs is running
it creates a logfile in target/nrepl-debug
thats basically just a dump of all messages
I ran this:
npx shadow-cljs --force-spawn run shadow.nrepl-debug 5000 44475
it created 20 nrepl-20.log.edn files but they all seemed to be empty, it also logged stuff like this: in the terminal output:
3]
[java.io.PushbackInputStream read "PushbackInputStream.java" 136]
[nrepl.bencode$read_byte invokeStatic "bencode.clj" 87]
[nrepl.bencode$read_byte invokePrim "bencode.clj" -1]
[nrepl.bencode$read_token invokeStatic "bencode.clj" 239]
[nrepl.bencode$read_token invoke "bencode.clj" 237]
[nrepl.bencode$read_bencode invokeStatic "bencode.clj" 257]
I didn't understand what you meant by connecting my editor to 5000, I tried a browser to localhost:5000 that didn't work
Oh so it's opening another nrepl port there, got you, when I get back I'll connect to that and see what it says
I got back to connecting to this REPL, but am not sure what I should do with it once I am connected
you do whatever else you were doing and get a full log of all messages going between shadow-cljs and your nrepl client
it probably is just what you showed above in the screenshot, but I need the full log
Is the log in the edn, the terminal or the repl output? None seem to be recording events from the (existing) repl in my first process, it just looks like a connection log of (itself)
it only logs what you send over it. it writes everything to the logfile. it doesn't log anything that doesn't go over the connection, so if you are connecting your REPL to the original server then that is not logged.
I hope x-post is ok (let me know if not), but I discovered this channel and it might be more appropriate here
Mainly:
Is there a way to make anonymous fns
already put whatever the context is in the reported fn
name for stack traces?
that would need to happen in the clojurescript compiler itself, not something shadow-cljs can easily influence
I vaguely remember opening a similar ticket myself and eventually not caring anymore due to source maps
Naming anonymous fns to improve stack trace is a good tip I hadn't thought of, thanks for this!