@logseq/nbb-logseq
Version:
Nbb with additional libraries like datascript included
13 lines • 5 kB
JavaScript
import { $APP, shadow$provide, $jscomp } from "./nbb_core.js";
import "./nbb_api.js";
import "./nbb_impl_main.js";
const shadow_esm_import = function(x) { return import(x) };
import*as esm_import$path from"path";
var VDa=function(a){var b=$APP.ok.h(a),c=$APP.Dg(b);return $APP.Xl("\n(require '[babashka.cli])\n(require '$1)\n(let [the-var (resolve '$2)\n the-var-meta (meta the-var)\n ns (:ns (meta the-var))\n ns-meta (meta ns)\n cli-opts (babashka.cli/merge-opts (:org.babashka/cli ns-meta)\n (:org.babashka/cli the-var-meta))\n opts (babashka.cli/parse-opts *command-line-args* cli-opts)]\n (the-var opts))\n",/\$(\d)/,function(d){d=$APP.re(d);switch(d){case "1":return c;
case "2":return b;default:throw Error(["No matching clause: ",$APP.p.h(d)].join(""));}})},WDa=function(a){a=$APP.ok.h(a);var b=$APP.Fg(a)?$APP.ok.g($APP.p.h(a),"-main"):a,c=$APP.Dg(b);return $APP.Xl("(require '$1) (apply $2 *command-line-args*)",/\$(\d)/,function(d){d=$APP.re(d);switch(d){case "1":return c;case "2":return b;default:throw Error(["No matching clause: ",$APP.p.h(d)].join(""));}})},XDa=function(a){for(var b=$APP.ah,c=a;;)if($APP.l(c)){var d=$APP.v(c);a=$APP.y(c);switch(d){case "--help":case "-h":return $APP.yj.j(b,
$APP.rA,!0);case "--version":case "-v":return $APP.yj.j(b,$APP.eBa,!0);case "-e":b=$APP.yj.j(b,$APP.Xo,$APP.v(a));c=a=$APP.y(a);continue;case "-m":case "--main":return $APP.yj.l(b,$APP.Xo,WDa($APP.v(a)),$APP.C([$APP.Zn,$APP.y(a)]));case "-x":case "--exec":return $APP.yj.l(b,$APP.Xo,VDa($APP.v(a)),$APP.C([$APP.Zn,$APP.y(a)]));case "-cp":case "--classpath":b=$APP.yj.j(b,$APP.$Q,$APP.v(a));c=a=$APP.y(a);continue;case "--config":b=$APP.yj.j(b,$APP.gz,$APP.v(a));c=a=$APP.y(a);continue;case "--debug":b=
$APP.yj.j(b,$APP.Bu,!0);c=a;continue;case "nrepl-server":b=$APP.yj.j(b,$APP.IS,!0);c=a;continue;case "socket-repl":b=$APP.yj.j(b,$APP.JS,!0);c=a;continue;case ":port":case "--port":b=$APP.yj.j(b,$APP.ZQ,$APP.v(a));c=a=$APP.y(a);continue;case ":host":case "--host":b=$APP.yj.j(b,$APP.uya,$APP.v(a));c=a=$APP.y(a);continue;case "repl":b=$APP.yj.j(b,$APP.dBa,!0);c=a;continue;case "bundle":return $APP.yj.j(b,$APP.HI,$APP.CM.g(a,new $APP.k(null,1,[$APP.bs,new $APP.k(null,2,[$APP.fBa,$APP.Wqa,$APP.gBa,$APP.rA],
null)],null)));default:if($APP.vb($APP.Xo.h(c)))return $APP.yj.l(b,$APP.cBa,d,$APP.C([$APP.Zn,$APP.y(c)]));throw $APP.Sm.g(["Unrecognized options:",$APP.p.h(c)].join(""),$APP.ah);}}else return b};process.on("unhandledRejection",function(a){console.error($APP.gl(a));return process.exitCode=1});(function(){var a=$APP.u(process.argv);$APP.v(a);a=$APP.y(a);$APP.v(a);a=$APP.y(a);var b=XDa(a);$APP.Fh($APP.hBa,b);var c=$APP.cBa.h(b),d=$APP.Xo.h(b);a=$APP.$Q.h(b);$APP.l(a)&&$APP.Hp(a);a=$APP.IS.h(b);var e=function(){var g=$APP.dBa.h(b);if($APP.l(g))return g;g=$APP.JS.h(b);return $APP.l(g)?g:$APP.Ge($APP.Im.l(b,$APP.$Q,$APP.C([$APP.Bu,$APP.gz])))}(),f=$APP.HI.h(b);$APP.l($APP.rA.h(b))&&($APP.Gw.l($APP.C([$APP.Va("nbb"),"version:",$APP.dv()])),$APP.Gw.l($APP.C(["\nHelp:\n\n -h / --help: print this help text and exit.\n -v / --version: print the current version of nbb.\n\nGlobal options:\n\n --debug: print additional debug info.\n -cp / --classpath: set the classpath.\n\nEvaluation:\n\n -e: execute expression\n -m / --main: execute main function\n -x / --exec: execute function using babashka.cli\n\nREPL:\n\n repl: start console REPL.\n nrepl-server: start nrepl server. [1,2]\n socket-repl: start socket repl server. [1]\n\n 1: Provide :port \x3cport\x3e to specify port\n 2: Provide :host \x3chost\x3e to specify host\n\nTooling:\n\n bundle: produce single JS file for usage with bundlers.\n"])),
process.exit(0));$APP.l($APP.eBa.h(b))&&($APP.Gw.l($APP.C([["nbb v",$APP.dv()].join("")])),process.exit(0));return $APP.l($APP.l(c)?c:$APP.l(d)?d:$APP.l(a)?a:$APP.l(e)?e:f)?($APP.UO.g($APP.uwa,$APP.Bh($APP.Zn.h(b))),Promise.resolve($APP.SQ($APP.l(e)?esm_import$path.resolve("script.cljs"):c,b)).then(function(){return($APP.l(c)?$APP.oya(c):$APP.l(d)?$APP.pya(d):$APP.l($APP.IS.h(b))?shadow_esm_import("./nbb_nrepl_server.js").then(function(){var g=$APP.D.g($APP.D.g($APP.Rq.h($APP.q($APP.Mq.h($APP.Eu()))),
$APP.Ux),$APP.YQ);return g.h?g.h(b):g.call(null,b)}):$APP.l($APP.l(e)?$APP.JS.h(b):e)?shadow_esm_import("./nbb_repl.js").then(function(){var g=new $APP.k(null,1,[$APP.ZQ,$APP.ZQ.h(b)],null),m=$APP.D.g($APP.D.g($APP.Rq.h($APP.q($APP.Mq.h($APP.Eu()))),$APP.$w),$APP.WQ);return m.h?m.h(g):m.call(null,g)}):$APP.l($APP.HI.h(b))?shadow_esm_import("./nbb_bundler.js"):$APP.l(e)?shadow_esm_import("./nbb_repl.js").then(function(){var g=$APP.D.g($APP.D.g($APP.Rq.h($APP.q($APP.Mq.h($APP.Eu()))),$APP.$w),$APP.XQ);
return g.C?g.C():g.call(null)}):null).then(function(g){$APP.l($APP.l(d)?null!=g:d)&&$APP.gt.l($APP.C([g]));return g}).catch(function(g){$APP.Kia(g,b);$APP.l($APP.Bu.h(b))&&console.error(g);throw Error($APP.gl(g));})})):console.error("Usage: nbb \x3cscript\x3e or nbb -e \x3cexpr\x3e.")})();