sci

https://github.com/babashka/SCI - also see #babashka and #nbb
2021-05-25T08:11:58.004400Z

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

borkdude 2021-05-25T11:16:44.004800Z

Making an http request with the sci application tag =) https://github.com/borkdude/sci-script-tag/blob/ef2eb9a19097902b6c4b24de261ad4d0d8f08e0c/resources/public/tictactoe.html#L51-L60

😎 1
2021-05-25T18:36:19.007500Z

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

borkdude 2021-05-25T18:45:06.009Z

@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

2021-05-25T18:46:09.009600Z

Ah yeah true forgot about that

borkdude 2021-05-25T18:48:38.011400Z

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

2021-05-25T18:49:02.011800Z

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

borkdude 2021-05-25T18:49:18.012300Z

I wonder how other JS projects handle this

👀 1
âž• 1
2021-05-25T18:49:22.012500Z

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

borkdude 2021-05-25T18:50:23.013300Z

you could also try this btw

borkdude 2021-05-25T18:50:43.013800Z

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

2021-05-25T18:51:02.014Z

yeah good one

2021-05-25T18:51:33.014700Z

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

borkdude 2021-05-25T18:52:42.015300Z

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

borkdude 2021-05-25T18:52:55.015500Z

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

borkdude 2021-05-25T18:53:09.015800Z

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

borkdude 2021-05-25T18:54:54.016800Z

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

2021-05-25T18:56:00.017500Z

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

2021-05-25T18:56:14.017900Z

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

2021-05-25T18:56:32.018400Z

i’ll look into this later

borkdude 2021-05-25T18:56:42.018600Z

it's already using those modules

2021-05-25T18:56:48.018900Z

ah ok

borkdude 2021-05-25T18:56:55.019100Z

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

2021-05-25T19:10:15.020100Z

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

script/release.clj
Compiling CLJS
Cloning: <https://github.com/borkdude/sci>
Checking out: <https://github.com/borkdude/sci> 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

2021-05-25T19:11:02.021Z

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

borkdude 2021-05-25T19:11:03.021100Z

you need to npm install it

2021-05-25T19:11:53.021600Z

What version are you using? I seem to have npm@6.14.4

borkdude 2021-05-25T19:20:49.022Z

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

borkdude 2021-05-25T19:21:03.022200Z

I have 7.13.0

borkdude 2021-05-25T19:21:37.022400Z

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

borkdude 2021-05-25T19:37:37.023500Z

Seems to not work.

borkdude 2021-05-25T19:38:45.024Z

I will try with :stable-names ...

borkdude 2021-05-25T19:40:32.024300Z

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

1
borkdude 2021-05-25T19:41:32.024700Z

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

borkdude 2021-05-25T19:50:20.025500Z

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

borkdude 2021-05-25T19:54:43.025800Z

yeah, @thheller confirmed this is not possible with advanced

borkdude 2021-05-25T19:57:37.026300Z

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

borkdude 2021-05-25T19:58:22.026800Z

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

borkdude 2021-05-25T19:59:17.027300Z

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

2021-05-25T20:03:00.028400Z

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

2021-05-25T23:38:35.028800Z

I've tried to make a simple try

2021-05-25T23:40:07.029600Z

2021-05-25T23:40:10.030Z

like this

2021-05-25T23:40:15.030200Z

I'm getting some error

2021-05-25T23:40:27.030300Z

2021-05-25T23:40:31.030700Z

why this?