p2p-db / shadow-cljs.edn
219 words
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
;; Test-only build config. ird-p2p-db is a source git dependency (see README);
;; consumers compile src/ with their own shadow-cljs/cljs build and never need
;; this file. Dependencies and source paths come from deps.edn (:test alias).
;;
;; :prepend defines the ESM dynamic-import helper in the entry file, which Node
;; loads natively (so its import() has a dynamic-import callback). helia,
;; @orbitdb/core and the libp2p packages are ESM-only; ird.p2p.db.impl.helia
;; and ird.p2p.db.impl.orbitdb call this helper (the same global the sibling
;; ird-p2p-cljs uses, so an app loading both defines it once). Under :node-test
;; the compiled runtime is loaded without an import callback, so import() from
;; inside it would fail with ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING.
;;
;; The browser suite (ird.p2p.db.browser.*) is a plain :browser build whose
;; page (test/browser/index.html) defines the same helper over the esbuild
;; vendor chunk of browser/vendor-entry.mjs; ird.p2p.db.browser-peer-test in
;; the Node suite serves it and runs it in headless Chrome. `npm test` builds
;; both and runs the Node suite, which runs the browser one.
{:deps {:aliases [:test]}
 :builds
 {;; the Node suite: every ird.p2p.db.*-test namespace except the browser ones
  :test {:target    :node-test
         :output-to "target/test.js"
         :ns-regexp "^ird\\.p2p\\.db\\.(?!browser\\.).+-test$"
         :prepend   "globalThis.ird_dyn_import = function (n) { return import(n); };\n"}
  ;; the browser suite: ird.p2p.db.browser.runner runs ird.p2p.db.browser.*-test
  :browser-test {:target     :browser
                 :output-dir "target/browser-test/js"
                 :asset-path "/js"
                 :modules    {:test {:init-fn ird.p2p.db.browser.runner/init}}}}}

static mirror of HEAD · about · clone: git clone https://ird.cod-sursa.ro/p2p-db.git