| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-04 19:27:25 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-04 19:28:26 UTC |
| parent | 39baab55b01eb8bc0c837680a52a09bd9d2135d3 |
| borogove/JsonPrinter.hx | +1 | -0 |
| borogove/Persistence.hx | +1 | -0 |
| borogove/persistence/KeyValueStore.hx | +1 | -0 |
| optional-sqlite.awk | +12 | -1 |
diff --git a/borogove/JsonPrinter.hx b/borogove/JsonPrinter.hx index 83a4452..672c08c 100644 --- a/borogove/JsonPrinter.hx +++ b/borogove/JsonPrinter.hx @@ -30,6 +30,7 @@ package borogove; @see https://haxe.org/manual/std-Json-encoding.html **/ +@:expose class JsonPrinter { /** Encodes `o`'s value and returns the resulting JSON string. diff --git a/borogove/Persistence.hx b/borogove/Persistence.hx index f167df7..1ab8fbf 100644 --- a/borogove/Persistence.hx +++ b/borogove/Persistence.hx @@ -19,6 +19,7 @@ using borogove.SignalProtocol; @:build(HaxeCBridge.expose()) @:build(HaxeSwiftBridge.expose()) #end +@:expose interface Persistence { public function lastId(accountId: String, chatId: Null<String>): Promise<Null<String>>; public function storeChats(accountId: String, chats: Array<Chat>):Void; diff --git a/borogove/persistence/KeyValueStore.hx b/borogove/persistence/KeyValueStore.hx index 05eb9d0..f301a7c 100644 --- a/borogove/persistence/KeyValueStore.hx +++ b/borogove/persistence/KeyValueStore.hx @@ -10,6 +10,7 @@ import HaxeCBridge; @:build(HaxeCBridge.expose()) @:build(HaxeSwiftBridge.expose()) #end +@:expose interface KeyValueStore { public function get(k: String): Promise<Null<String>>; public function set(k: String, v: Null<String>): Promise<Bool>; diff --git a/optional-sqlite.awk b/optional-sqlite.awk index a430607..bf8d286 100644 --- a/optional-sqlite.awk +++ b/optional-sqlite.awk @@ -5,6 +5,7 @@ BEGIN { /^import \{ sqlite3Worker1Promiser as borogove_persistence_Worker1 \} from "@sqlite\.org\/sqlite-wasm";/ { print > "npm/sqlite-wasm.js" + print "import * as borogove from \"./borogove-browser.js\"" >> "npm/sqlite-wasm.js" print "var $global = globalThis;" >> "npm/sqlite-wasm.js" next } @@ -28,7 +29,13 @@ BEGIN { } skipping { - print >> "npm/sqlite-wasm.js" + line = $0 + gsub(/borogove_persistence_Sqlite/, "__TEMP_KEEP__", line) + gsub(/borogove_persistence_Worker1/, "__TEMP_KEEP2__", line) + gsub(/borogove_/, "borogove.borogove_", line) + gsub("__TEMP_KEEP__", "borogove_persistence_Sqlite", line) + gsub("__TEMP_KEEP2__", "borogove_persistence_Worker1", line) + print line >> "npm/sqlite-wasm.js" if (extra > 0) { extra-- @@ -40,3 +47,7 @@ skipping { { print > "npm/browser-no-sqlite.js" } + +END { + print "export { borogove_Map }" >> "npm/browser-no-sqlite.js" +}