From 19b8ace60e61b4526ec42ba1cd1d8d977d44e613 Mon Sep 17 00:00:00 2001 From: ChenYong Date: Mon, 22 Jun 2020 11:04:20 +0800 Subject: [PATCH] add defer; fix validation; alpha release --- calcit.cirru | 78 +++++++++++++++++++++++++++++++++------- release.edn | 2 +- src/shell_page/core.cljs | 25 +++++++++---- src/shell_page/main.cljs | 2 +- 4 files changed, 86 insertions(+), 21 deletions(-) diff --git a/calcit.cirru b/calcit.cirru index 241fe53..97ab7bf 100644 --- a/calcit.cirru +++ b/calcit.cirru @@ -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 $ {} @@ -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) @@ -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) @@ -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) @@ -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) @@ -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 @@ -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 $ {} diff --git a/release.edn b/release.edn index 41f0c31..aa0f11f 100644 --- a/release.edn +++ b/release.edn @@ -1,4 +1,4 @@ -{:version "0.1.12", +{:version "0.1.13-a1", :group-id "mvc-works", :artifact-id "shell-page", :skip-tag true, diff --git a/src/shell_page/core.cljs b/src/shell_page/core.cljs index 8c0788e..cf970bf 100644 --- a/src/shell_page/core.cljs +++ b/src/shell_page/core.cljs @@ -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] @@ -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") @@ -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 {} diff --git a/src/shell_page/main.cljs b/src/shell_page/main.cljs index 2c4b387..56f32ec 100644 --- a/src/shell_page/main.cljs +++ b/src/shell_page/main.cljs @@ -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 "", :append-html "", :manifest "manifest.json"})))