Skip to content

Commit

Permalink
sci-config require
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Apr 17, 2024
1 parent 56493af commit ef4de1c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 20 deletions.
12 changes: 4 additions & 8 deletions demo/deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"resources"
"target/webly"]
:deps {org.pinkgorilla/goldly {:local/root ".." :deps/manifest :deps}
org.pinkgorilla/webly {:mvn/version "0.5.666"}
org.pinkgorilla/webly {:mvn/version "0.5.669"}
org.pinkgorilla/ui-repl {:mvn/version "0.1.102"}
org.pinkgorilla/ui-site {:mvn/version "0.0.30"}
org.pinkgorilla/ui-binaryclock {:mvn/version "0.2.19"}
;org.pinkgorilla/ui-input {:mvn/version "0.2.44"} ; spaces
org.pinkgorilla/ui-tailwind {:mvn/version "0.0.5"}
;org.pinkgorilla/devtools {:mvn/version "0.0.17"}
org.pinkgorilla/pinkie {:mvn/version "0.5.232"} ; higher version
org.pinkgorilla/pinkie {:mvn/version "0.5.232"} ; higher version
org.pinkgorilla/ui-bidi {:mvn/version "0.0.30"} ; higher version
}

Expand All @@ -20,8 +20,7 @@
:main-opts ["-m" "cljfmt.main"
"--indents" "cljfmt.edn"]}


; goldy-demo
; goldy-demo
; this is a complete deps.edn project used to test goldly.

; tests:
Expand All @@ -46,13 +45,10 @@
:config ["test-config.edn"]
:services "test-services.edn"}}


:nbeval {:exec-fn modular.system/start!
:nbeval {:exec-fn modular.system/start!
:exec-args {:run reval.task/eval-all-collections
:config ["test-config.edn"]
:services "task-services.edn"}}



;
}}
15 changes: 13 additions & 2 deletions goldly-sci/src/goldly/sci/loader/shadow_add.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
[taoensso.timbre :as timbre :refer-macros [debug debugf info warn error]]
[promesa.core :as p]
[sci.core :as sci]
[goldly.sci.loader.shadow-load :refer [load-shadow-ns]]))
[webly.module.build :refer [load-namespace-raw simple-namespace? assemble-simple-ns]]))

(defn load-shadow-ns [libname]
(info "webly-shadow-ns load: " libname " type: " (type libname))
(load-namespace-raw libname))


(defn add-shadow-module [{:keys [ctx libname ns opts sci-mod]}]
(info "load-shadow-module: ns: " libname)
Expand All @@ -15,7 +20,13 @@
(-> shadow-p
(p/then (fn [res]
(info "received shadow-module for libname: " libname "ns: " ns)
(sci/add-namespace! ctx libname res)
(if (simple-namespace? libname)
(let [x (assemble-simple-ns libname res)]
(info "ns " libname " is a simple namespace; adding ns..")
(sci/add-namespace! ctx libname x))
(do
(error "ns " libname " is a sci-configs-namespace ; adding ns ..")
(sci/add-namespace! ctx libname res)))
;; empty map return value, SCI will still process `:as` and `:refer`
(p/resolve! r-p {})))
(p/catch (fn [err]
Expand Down
8 changes: 0 additions & 8 deletions goldly-sci/src/goldly/sci/loader/shadow_load.cljs

This file was deleted.

2 changes: 1 addition & 1 deletion reval-sci/src/reval/kernel/cljs_sci.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
compile-p (compile-code-async code)]
(-> compile-p
(p/then (fn [r]
(info "eval clj result: " r)
(info "eval result: " r)
(reset! cur-ns (:ns r))
(p/resolve! r-p (viz-adjust r))))
(p/catch (fn [err]
Expand Down
14 changes: 14 additions & 0 deletions sci-configs/resources/demo/notebook/javelin.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(ns demo.notebook.javelin
(:require
[javelin.core :refer [cell] :refer-macros [cell=]]))

(defn start []
(let [a (cell 0) ;; input cell with initial value of 0.
b (cell= (inc a)) ;; formula cell of a+1.
c (cell= (+ 123 a b))] ;; formula cell of a+b+123.
(cell= (.log js/console c)) ;; anonymous formula cell for side effects.
;; c's initial value, 124, is printed.
(swap! a inc)
;; a was incremented, and its new value propagated (consistently)
;; through b and c. c's new value, 126, is printed to the console.
))
2 changes: 1 addition & 1 deletion sci-configs/resources/demo/notebook/jsinterop.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ js/Error ; could not resolve symbol

(String/fromCharCode 67)

def o #js {"a" 44 "b" "B"})
(def o #js {"a" 44 "b" "B"})

;; Read
(j/get o :x)
Expand Down

0 comments on commit ef4de1c

Please sign in to comment.