Compare commits
3 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a19eb2cf90 | ||
|
|
e4a25c7927 | ||
|
|
b8cf100209 |
7 changed files with 52 additions and 5 deletions
3
deps.edn
3
deps.edn
|
|
@ -28,7 +28,8 @@
|
|||
http-kit/http-kit {:mvn/version "2.5.0"}
|
||||
babashka/clojure-lanterna {:mvn/version "0.9.8-SNAPSHOT"}
|
||||
org.clojure/math.combinatorics {:mvn/version "0.1.6"}
|
||||
org.clojure/core.match {:mvn/version "1.0.0"}}
|
||||
org.clojure/core.match {:mvn/version "1.0.0"}
|
||||
hiccup/hiccup {:mvn/version "2.0.0-alpha2"}}
|
||||
:aliases {:main
|
||||
{:main-opts ["-m" "babashka.main"]}
|
||||
:profile
|
||||
|
|
|
|||
27
feature-hiccup/babashka/impl/hiccup.clj
Normal file
27
feature-hiccup/babashka/impl/hiccup.clj
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(ns babashka.impl.hiccup
|
||||
{:no-doc true}
|
||||
(:require [hiccup.core :as hiccup]
|
||||
[hiccup.util :as util]
|
||||
[hiccup2.core :as hiccup2]
|
||||
[sci.core :as sci :refer [copy-var]]))
|
||||
|
||||
(def hns (sci/create-ns 'hiccup.core nil))
|
||||
(def hns2 (sci/create-ns 'hiccup2.core nil))
|
||||
(def uns (sci/create-ns 'hiccup.util nil))
|
||||
|
||||
(defn html [x]
|
||||
(hiccup/html x))
|
||||
|
||||
(def hiccup-namespace
|
||||
{'html (copy-var html hns)})
|
||||
|
||||
(defn html2 [x]
|
||||
(hiccup2/html x))
|
||||
|
||||
(def hiccup2-namespace
|
||||
{'html (copy-var html2 hns2)})
|
||||
|
||||
(def hiccup-util-namespace
|
||||
{'*html-mode* (copy-var util/*html-mode* uns)
|
||||
'*escape-strings?* (copy-var util/*escape-strings?* uns)
|
||||
'raw-string (copy-var util/raw-string uns)})
|
||||
|
|
@ -48,7 +48,8 @@
|
|||
:dependencies [[babashka/clojure-lanterna "0.9.8-SNAPSHOT"]]}
|
||||
:feature/core-match {:source-paths ["feature-core-match"]
|
||||
:dependencies [[org.clojure/core.match "1.0.0"]]}
|
||||
|
||||
:feature/hiccup {:source-paths ["feature-hiccup"]
|
||||
:dependencies [[hiccup/hiccup "2.0.0-alpha2"]]}
|
||||
:test [:feature/xml
|
||||
:feature/lanterna
|
||||
:feature/yaml
|
||||
|
|
@ -61,6 +62,7 @@
|
|||
:feature/httpkit-client
|
||||
:feature/httpkit-server
|
||||
:feature/core-match
|
||||
:feature/hiccup
|
||||
{:dependencies [[clj-commons/conch "0.9.2"]
|
||||
[com.clojure-goes-fast/clj-async-profiler "0.4.1"]
|
||||
[com.opentable.components/otj-pg-embedded "0.13.3"]]}]
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ then
|
|||
export BABASHKA_FEATURE_HTTPKIT_CLIENT="${BABASHKA_FEATURE_HTTPKIT_CLIENT:-false}"
|
||||
export BABASHKA_FEATURE_HTTPKIT_SERVER="${BABASHKA_FEATURE_HTTPKIT_SERVER:-false}"
|
||||
export BABASHKA_FEATURE_CORE_MATCH="${BABASHKA_FEATURE_CORE_MATCH:-false}"
|
||||
export BABASHKA_FEATURE_HICCUP="${BABASHKA_FEATURE_HICCUP:-false}"
|
||||
fi
|
||||
|
||||
"$GRAALVM_HOME/bin/native-image" "${args[@]}"
|
||||
|
|
|
|||
|
|
@ -125,6 +125,13 @@ else
|
|||
BABASHKA_LEIN_PROFILES+=",-feature/core-match"
|
||||
fi
|
||||
|
||||
if [ "$BABASHKA_FEATURE_HICCUP" != "false" ]
|
||||
then
|
||||
BABASHKA_LEIN_PROFILES+=",+feature/hiccup"
|
||||
else
|
||||
BABASHKA_LEIN_PROFILES+=",-feature/hiccup"
|
||||
fi
|
||||
|
||||
if [ -z "$BABASHKA_JAR" ]; then
|
||||
lein with-profiles "$BABASHKA_LEIN_PROFILES,+reflection,-uberjar" do run
|
||||
lein with-profiles "$BABASHKA_LEIN_PROFILES" do clean, uberjar
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
(def httpkit-client? (not= "false" (System/getenv "BABASHKA_FEATURE_HTTPKIT_CLIENT")))
|
||||
(def httpkit-server? (not= "false" (System/getenv "BABASHKA_FEATURE_HTTPKIT_SERVER")))
|
||||
(def core-match? (not= "false" (System/getenv "BABASHKA_FEATURE_CORE_MATCH")))
|
||||
(def hiccup? (not= "false" (System/getenv "BABASHKA_FEATURE_HICCUP")))
|
||||
|
||||
;; excluded by default
|
||||
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
|
||||
|
|
|
|||
|
|
@ -97,6 +97,9 @@
|
|||
(when features/core-match?
|
||||
(require '[babashka.impl.match]))
|
||||
|
||||
(when features/hiccup?
|
||||
(require '[babashka.impl.hiccup]))
|
||||
|
||||
(sci/alter-var-root sci/in (constantly *in*))
|
||||
(sci/alter-var-root sci/out (constantly *out*))
|
||||
(sci/alter-var-root sci/err (constantly *err*))
|
||||
|
|
@ -303,7 +306,8 @@ Use -- to separate script command line args from bb command line args.
|
|||
:feature/oracledb %s
|
||||
:feature/httpkit-client %s
|
||||
:feature/lanterna %s
|
||||
:feature/core-match %s}")
|
||||
:feature/core-match %s
|
||||
:feature/hiccup %s}")
|
||||
version
|
||||
features/core-async?
|
||||
features/csv?
|
||||
|
|
@ -317,7 +321,8 @@ Use -- to separate script command line args from bb command line args.
|
|||
features/oracledb?
|
||||
features/httpkit-client?
|
||||
features/lanterna?
|
||||
features/core-match?)))
|
||||
features/core-match?
|
||||
features/hiccup?)))
|
||||
|
||||
(defn read-file [file]
|
||||
(let [f (io/file file)]
|
||||
|
|
@ -427,7 +432,10 @@ Use -- to separate script command line args from bb command line args.
|
|||
features/lanterna? (assoc 'lanterna.screen @(resolve 'babashka.impl.lanterna/lanterna-screen-namespace)
|
||||
'lanterna.terminal @(resolve 'babashka.impl.lanterna/lanterna-terminal-namespace)
|
||||
'lanterna.constants @(resolve 'babashka.impl.lanterna/lanterna-constants-namespace))
|
||||
features/core-match? (assoc 'clojure.core.match @(resolve 'babashka.impl.match/core-match-namespace))))
|
||||
features/core-match? (assoc 'clojure.core.match @(resolve 'babashka.impl.match/core-match-namespace))
|
||||
features/hiccup? (-> (assoc 'hiccup.core @(resolve 'babashka.impl.hiccup/hiccup-namespace))
|
||||
(assoc 'hiccup2.core @(resolve 'babashka.impl.hiccup/hiccup2-namespace))
|
||||
(assoc 'hiccup.util @(resolve 'babashka.impl.hiccup/hiccup-util-namespace)))))
|
||||
|
||||
(def imports
|
||||
'{ArithmeticException java.lang.ArithmeticException
|
||||
|
|
|
|||
Loading…
Reference in a new issue