Fork me on GitHub
#sci
<
2021-05-25
>
jeroenvandijk08:05:58

Nice! I can confirm using Reagent with Sci can be used for many things. I have been playing with it since last year. Back then I still ran into some issues (I was pushing it), but I think they have been solved since

jeroenvandijk18:05:19

Had a better look at how you do the plugin system. Really cool. I hope to try it with something like observablehq soon to further explore it

borkdude18:05:06

@jeroenvandijk I suspect that there will be some problems if plugins are developed independently (in separate projects) since the advanced compilation renaming might not work the same if you work in a fork... I haven't tested that. But it will probably work if you compile all the modules using simple or so

jeroenvandijk18:05:09

Ah yeah true forgot about that

borkdude18:05:38

but if the plugins are all compiled from the same code base, that could work

jeroenvandijk18:05:02

yeah exactly still very useful. A page only needs to load the plugins it needs

borkdude18:05:18

I wonder how other JS projects handle this

âž• 3
👀 3
jeroenvandijk18:05:22

Not sure how heavy the advanced compilation process would become with many plugins. Worth to find out 🙂

borkdude18:05:23

you could also try this btw

borkdude18:05:43

fork the script-tag project, make a plugin and see if it works with the published script-tag js

jeroenvandijk18:05:33

I don’t know enough about the compilation process but I hope it is somewhat deterministic

borkdude18:05:42

check the script/release.clj script to see how to compile for release

borkdude18:05:55

clojure -M:dev -m shadow.cljs.devtools.cli release main

borkdude18:05:09

and the modules (plugins) are defined in shadow-cljs.edn

borkdude18:05:54

I've been investigating support for CLJS's this-as in sci, it's a bit more difficult than I thought. How common is that these days

jeroenvandijk18:05:00

I don’t remember using this-as , but i haven’t don’t much cljs lately

jeroenvandijk18:05:14

I wonder if :modules or :stable-names might be relevant for the advanced compilation of Sci modules https://clojurescript.org/reference/compiler-options#modules

jeroenvandijk18:05:32

i’ll look into this later

borkdude18:05:42

it's already using those modules

borkdude18:05:55

I haven't heard about stable names... let's see

jeroenvandijk19:05:15

I’m probably doing something wrong (wrong shadow-clj version maybe?)

script/release.clj
Compiling CLJS
Cloning: 
Checking out:  at 02733a591bfa2f425b8abe0377d6668559ac278a
Downloading: thheller/shadow-cljs/2.12.5/shadow-cljs-2.12.5.pom from clojars
Downloading: borkdude/edamame/0.0.11/edamame-0.0.11.pom from clojars
Downloading: cljsjs/react/17.0.2-0/react-17.0.2-0.pom from clojars
Downloading: cljsjs/react-dom-server/17.0.2-0/react-dom-server-17.0.2-0.pom from clojars
Downloading: cljsjs/react-dom/17.0.2-0/react-dom-17.0.2-0.pom from clojars
Downloading: com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.pom from central
Downloading: com/google/javascript/closure-compiler-main/v20210302/closure-compiler-main-v20210302.pom from central
Downloading: thheller/shadow-undertow/0.1.0/shadow-undertow-0.1.0.pom from clojars
Downloading: com/google/javascript/closure-compiler-parent/v20210302/closure-compiler-parent-v20210302.pom from central
Downloading: io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.pom from central
Downloading: io/undertow/undertow-parent/2.2.4.Final/undertow-parent-2.2.4.Final.pom from central
Downloading: com/google/javascript/closure-compiler-unshaded/v20210302/closure-compiler-unshaded-v20210302.jar from central
Downloading: borkdude/edamame/0.0.11/edamame-0.0.11.jar from clojars
Downloading: io/undertow/undertow-core/2.2.4.Final/undertow-core-2.2.4.Final.jar from central
Downloading: cljsjs/react/17.0.2-0/react-17.0.2-0.jar from clojars
Downloading: thheller/shadow-undertow/0.1.0/shadow-undertow-0.1.0.jar from clojars
Downloading: cljsjs/react-dom-server/17.0.2-0/react-dom-server-17.0.2-0.jar from clojars
Downloading: thheller/shadow-cljs/2.12.5/shadow-cljs-2.12.5.jar from clojars
Downloading: cljsjs/react-dom/17.0.2-0/react-dom-17.0.2-0.jar from clojars
[:main] Compiling ...
The required namespace "react" is not available, it was required by "reagent/core.cljs".

[bb null] Terminating with non-zero exit code: 1

jeroenvandijk19:05:02

I wanted to see if my compiled output is (slightly) different than yours. If it is not i’m assuming external modules should work

borkdude19:05:03

you need to npm install it

jeroenvandijk19:05:53

What version are you using? I seem to have [email protected]

borkdude19:05:49

shouldn't matter I think as long as it downloads the same library

borkdude19:05:03

I have 7.13.0

borkdude19:05:37

$ cat node_modules/react/package.json
{
  "name": "react",
  "description": "React is a JavaScript library for building user interfaces.",
  "keywords": [
    "react"
  ],
  "version": "17.0.1",

borkdude19:05:37

Seems to not work.

borkdude19:05:45

I will try with :stable-names ...

borkdude19:05:32

hmm, :stable-names always enabled, cannot be disabled says the shadow-cljs manual

3
borkdude19:05:32

I will try shadow-cljs release ... --debug

borkdude19:05:20

Perhaps :pseudo-names could work here, although the docs suggest it's for debugging

borkdude19:05:43

yeah, @thheller confirmed this is not possible with advanced

borkdude19:05:37

compiling with :simple yields 5mb, about 5 times as much as with :advanced

borkdude19:05:22

for node projects that might not be so bad @jeroenvandijk, so if you want to make a plugin system for observable, while allowing others to make plugins independently that might work

borkdude19:05:17

for the script tag thing I'd like to stick to advanced though

jeroenvandijk20:05:00

yeah makes sense. I’ll think about it some more

Ian Fernandez23:05:35

I've tried to make a simple try

Ian Fernandez23:05:15

I'm getting some error