This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
hey y’all, i have use case that I’d love some help with. I’d like shadow-cljs to write a file to disk whose contents are the transformation of a cljs value:
;; source file contains this:
(def seq-1 [1 2 3])
(def seq-2 [3 4 5])
(def sequences
[seq-1 seq-2])
;; i want shadow-cljs to write a file with this in it:
(def sequences [1 3])
;; in other words, transform the value of `sequences` and write it
is this possible?I had a similar problem when collecting malli schemas and wanting to write clj-kondo config for them during compilation - there is a demonstration of how to do that here https://github.com/metosin/malli/blob/master/src/malli/dev/cljs_kondo_preload.cljc
but this requires some "collection" mechanism, so not sure this will help with your use-case
this is helpful, thank you!
hi! 👋 I'm trying to load https://www.npmjs.com/package/@sqlite.org/sqlite-wasm
(:require
["@sqlite.org/sqlite-wasm" :as sqlite])
but getting
errors in file: {...}/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
{:js-str-offsets [], :js-esm false, :js-imports [], :js-invalid-requires [], :goog-provides [], :js-language "es9", :goog-module nil, :js-warnings [], :resource-name "node_modules/@sqlite_DOT_org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs", :js-requires [], :js-errors [{:line 2968, :column 7, :message "primary expression expected"}], :goog-requires [], :tag :shadow.build.npm/errors, :uses-global-buffer false, :uses-global-process false}
ExceptionInfo: errors in file: {...}/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
couldn't figure out anything special about this line
createPreloadedFile: (
parent,
name,
url,
canRead,
canWrite,
onload,
onerror,
dontCreateFile,
canOwn,
preFinish,
) => { // line 2968
var fullname = name
? PATH_FS.resolve(PATH.join2(parent, name))
: parent;
...
> whatever it is is not supported by the closure compiler and thus not shadow-cljs good to know, thanks! Any workarounds or suggestions perhaps?
I guess try webpack? https://shadow-cljs.github.io/docs/UsersGuide.html#js-provider-external