diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eef08c5..e396a7ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ A preview of the next release can be installed from [Babashka](https://github.com/babashka/babashka): Native, fast starting Clojure interpreter for scripting +## Unreleased + +- [#1592](https://github.com/babashka/babashka/issues/1592): expose `sci.core` in babashka + ## 1.3.182 (2023-07-20) - [#1579](https://github.com/babashka/babashka/issues/1579): add `clojure.tools.reader/resolve-symbol` diff --git a/src/babashka/impl/sci.clj b/src/babashka/impl/sci.clj new file mode 100644 index 00000000..fbb9f606 --- /dev/null +++ b/src/babashka/impl/sci.clj @@ -0,0 +1,8 @@ +(ns babashka.impl.sci + {:no-doc true} + (:require [sci.core :as sci])) + +(def sns (sci/create-ns 'sci.core nil)) + +(def sci-core-namespace + (sci/copy-ns sci.core sns)) diff --git a/src/babashka/main.clj b/src/babashka/main.clj index 44c37f44..f1602e8a 100644 --- a/src/babashka/main.clj +++ b/src/babashka/main.clj @@ -45,6 +45,7 @@ [babashka.impl.reify2 :refer [reify-fn]] [babashka.impl.repl :as repl] [babashka.impl.rewrite-clj :as rewrite] + [babashka.impl.sci :refer [sci-core-namespace]] [babashka.impl.server :refer [clojure-core-server-namespace]] [babashka.impl.socket-repl :as socket-repl] [babashka.impl.tasks :as tasks :refer [tasks-namespace]] @@ -354,8 +355,6 @@ Use bb run --help to show this help output. (defn catvec [& xs] (into [] cat xs)) -(def sci-ns (sci/create-ns 'sci.core)) - (def main-var (sci/new-var 'main nil {:ns clojure-main-ns})) (def namespaces @@ -418,13 +417,7 @@ Use bb run --help to show this help output. {'catvec (sci/copy-var catvec (sci/create-ns 'clojure.core.rrb-vector))}) 'edamame.core edamame-namespace - 'sci.core {'format-stacktrace (sci/copy-var sci/format-stacktrace sci-ns) - 'stacktrace (sci/copy-var sci/stacktrace sci-ns) - ;; 'eval-string (sci/copy-var sci/eval-string sci-ns) - ;; 'eval-string* (sci/copy-var sci/eval-string* sci-ns) - ;; 'init (sci/copy-var sci/init sci-ns) - ;; 'fork (sci/copy-var sci/fork sci-ns) - } + 'sci.core sci-core-namespace 'babashka.cli cli/cli-namespace 'babashka.http-client http-client-namespace} features/xml? (assoc 'clojure.data.xml @(resolve 'babashka.impl.xml/xml-namespace)