Skip to content

Commit

Permalink
add defer; fix validation; alpha release
Browse files Browse the repository at this point in the history
  • Loading branch information
ChenYong committed Jun 22, 2020
1 parent 638307c commit 19b8ace
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 21 deletions.
78 changes: 66 additions & 12 deletions calcit.cirru
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@
|v $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758609827)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758610098) (:text |[]) (:id |P13hLmeFJ4)
|yr $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794995092) (:text |boolean+) (:id |vxpsg6y3yH)
|yT $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758811999) (:text |or+) (:id |p-m2wdLPsp)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758611787) (:text |dev-check) (:id |G-NLhNqFKE)
|r $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758633805) (:text |record+) (:id |ZttyBa6g_n)
|v $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758635682) (:text |string+) (:id |hGHy5h7wv)
|x $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758647627) (:text |vector+) (:id |qLauNV7n3)
|y $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758690845) (:text |optional+) (:id |XqH_w2OUad)
|yT $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758811999) (:text |or+) (:id |p-m2wdLPsp)
|v $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758635682) (:text |string+) (:id |hGHy5h7wv)
|yj $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758847119) (:text |keyword+) (:id |yC2Bhu0jt-)
|r $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758633805) (:text |record+) (:id |ZttyBa6g_n)
|y $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758690845) (:text |optional+) (:id |XqH_w2OUad)
:id |lVeDoVeDxK
:id |0Datg9luSo
:defs $ {}
Expand Down Expand Up @@ -361,6 +362,21 @@
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592743069148) (:text |:type) (:id |8V3_HjnUHM)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592743077144) (:text "|\"module") (:id |UOodW0-ZCY)
:id |NKBPhjntGQ
|r $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794680158)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794693343) (:text |:defer) (:id |9o1LNSPRVleaf)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794687990)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794688987) (:text |if) (:id |Ckv3ViFg9)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794689312)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794690679) (:text |:defer?) (:id |IR7ambHY_)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794700364) (:text |path) (:id |TNS5Fvwis)
:id |Qu4byjf2Wl
|r $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794702008) (:text |true) (:id |otu8SeaTp1)
|v $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794792095) (:text |false) (:id |Cfw1mGHZm)
:id |jQUrPhGUC
:id |9o1LNSPRV
:id |pvdfGLuY2N
:id |PxkeGboM6m
|L $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592739595629)
Expand Down Expand Up @@ -400,6 +416,21 @@
|D $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592739617192) (:text |:src) (:id |E9jfEHQ7Pt)
:id |pQO0NouE7Q
:id |UIQaFSpRN4
|r $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794709133)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |:defer) (:id |3dzAu-CqT8)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794709133)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |if) (:id |TEHrsPoZ-T)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794709133)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |:defer?) (:id |wYl7mba09U)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |path) (:id |l0KZXrrkT9)
:id |hmz3IjOhms
|r $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |true) (:id |C8hd1YQ--0)
|v $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794709133) (:text |false) (:id |QXDksF3HL0)
:id |nSHRj0apHK
:id |fLPUW-z_rV
:id |pvdfGLuY2N
:id |PxkeGboM6m
|L $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592739595629)
Expand Down Expand Up @@ -664,7 +695,24 @@
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758838763) (:text |string+) (:id |8XRWSWEMqB)
:id |bUuNAGL83A
:id |NII_VnhEF
|v $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758834516)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794987933) (:text |:defer?) (:id |NII_VnhEFleaf)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758837688)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794985146) (:text |boolean+) (:id |8XRWSWEMqB)
:id |bUuNAGL83A
:id |Q4Piqg0hi
:id |g-bv-a6rL7
|r $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794966735)
:data $ {}
|T $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794890323)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794890323) (:text |:exact-keys?) (:id |rEdajZlIrn)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794890323) (:text |true) (:id |g0DQkwYFf3)
:id |tDflazWTeR
|D $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794967209) (:text |{}) (:id |MBjG50JQdA)
:id |4bCjvVnCYz
:id |XT8OCQamIc
:id |NgBU_f1W07
|D $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758817053) (:text |or+) (:id |YsAZ4WykNx)
Expand Down Expand Up @@ -695,18 +743,14 @@
|v $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758666091)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758683858) (:text |:ssr) (:id |2-od6jvugZ)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758685063)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758675729)
:data $ {}
|T $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758675729)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758676831) (:text |string+) (:id |DBQbfxVguO)
:id |xoPHkEW28y
|D $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758687947) (:text |optional+) (:id |poaUX4Mt_n)
:id |FX9a6e7n7
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758676831) (:text |string+) (:id |DBQbfxVguO)
:id |xoPHkEW28y
:id |gv-g9KsDPg
|yj $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758666091)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758730471) (:text |:inner-html) (:id |2-od6jvugZ)
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794937325) (:text |:inline-html) (:id |2-od6jvugZ)
|j $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592758745553)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758745553) (:text |string+) (:id |mPvY6c6wYW)
Expand Down Expand Up @@ -749,6 +793,11 @@
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758768969) (:text |:all-optional?) (:id |dmt45nHL8H)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592758769559) (:text |true) (:id |yh0I0biy_)
:id |8J721FxYb3
|r $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794879407)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794884961) (:text |:exact-keys?) (:id |gkD8WPqiQleaf)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794885774) (:text |true) (:id |gBirnnhzd)
:id |gkD8WPqiQ
:id |ZJUqzvvSi
:id |S5IaGUFMwF
:id |sNB_I3lh7P
Expand Down Expand Up @@ -840,6 +889,11 @@
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592740112279) (:text |:src) (:id |JUgNAE2XMeleaf)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592740116453) (:text "|\"main.js") (:id |KCDGrUcwJj)
:id |JUgNAE2XMe
|v $ {} (:type :expr) (:by |UI0sFmATo) (:at 1592794734803)
:data $ {}
|T $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794737943) (:text |:defer?) (:id |70rAbeuAXwleaf)
|j $ {} (:type :leaf) (:by |UI0sFmATo) (:at 1592794787775) (:text |false) (:id |g7W96Z1HN)
:id |70rAbeuAXw
:id |IAm-LZvgZg
|xT $ {} (:type :expr) (:id |HyeOnfvJ1M) (:by |root) (:at 1510073008262)
:data $ {}
Expand Down
2 changes: 1 addition & 1 deletion release.edn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{:version "0.1.12",
{:version "0.1.13-a1",
:group-id "mvc-works",
:artifact-id "shell-page",
:skip-tag true,
Expand Down
25 changes: 18 additions & 7 deletions src/shell_page/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
:refer
[html <> head title script style meta' div link body style list->])
[respo.render.html :refer [make-string]]
[lilac.core :refer [dev-check record+ string+ vector+ optional+ or+ keyword+]]
[lilac.core
:refer
[dev-check record+ string+ vector+ optional+ or+ keyword+ boolean+]]
["fs" :as fs]))

(defn get-indexed [xs]
Expand All @@ -14,14 +16,19 @@
(record+
{:title (string+),
:icon (string+),
:ssr (optional+ (string+)),
:ssr (string+),
:styles (vector+ (string+)),
:inline-styles (vector+ (string+)),
:scripts (vector+ (or+ [(string+) (record+ {:type (keyword+), :src (string+)})])),
:inner-html (string+),
:scripts (vector+
(or+
[(string+)
(record+
{:type (keyword+), :src (string+), :defer? (boolean+)}
{:exact-keys? true})])),
:inline-html (string+),
:append-html (string+),
:manifest (string+)}
{:all-optional? true}))
{:all-optional? true, :exact-keys? true}))

(defn make-page [html-content resources]
(assert (string? html-content) "1st argument should be string")
Expand Down Expand Up @@ -53,8 +60,12 @@
(cond
(string? path) (script {:src path})
(and (map? path) (= :module (:type path)))
(script {:type "module", :src (:src path)})
(and (map? path) (= :script (:type path))) (script {:src (:src path)})
(script
{:type "module",
:src (:src path),
:defer (if (:defer? path) true false)})
(and (map? path) (= :script (:type path)))
(script {:src (:src path), :defer (if (:defer? path) true false)})
:else (println "[Shell Page]: unknown path" path))))))))
(body
{}
Expand Down
2 changes: 1 addition & 1 deletion src/shell_page/main.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:ssr "respo-ssr",
:styles ["/main.css"],
:inline-styles [".app{color:#aaa;}"],
:scripts ["/main.js" {:type :module, :src "main.js"}],
:scripts ["/main.js" {:type :module, :src "main.js", :defer? false}],
:inline-html "<script>console.log('nothing')</script>",
:append-html "<script>console.log('appended');</script>",
:manifest "manifest.json"})))

0 comments on commit 19b8ace

Please sign in to comment.