@cereusdb/standard 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,6 +68,9 @@ export class CereusDB {
68
68
  tables(): any;
69
69
  /**
70
70
  * Get version information.
71
+ *
72
+ * Release builds set `CEREUSDB_VERSION` to the full npm version, including
73
+ * prerelease suffixes; other builds fall back to the crate version.
71
74
  */
72
75
  version(): string;
73
76
  }
@@ -106,10 +109,18 @@ export interface InitOutput {
106
109
  readonly abort: () => void;
107
110
  readonly emscripten_builtin_free: (a: number) => void;
108
111
  readonly emscripten_builtin_malloc: (a: number) => number;
112
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
113
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
114
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
115
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
116
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
117
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
118
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
119
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
109
120
  readonly __cpp_exception: WebAssembly.Tag;
110
- readonly wasm_bindgen__closure__destroy__h2bfbe8d19302e783: (a: number, b: number) => void;
111
- readonly wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6: (a: number, b: number, c: any) => [number, number];
112
- readonly wasm_bindgen__convert__closures_____invoke__h62da4917f540b667: (a: number, b: number, c: any, d: any) => void;
121
+ readonly wasm_bindgen__closure__destroy__h8db467765ce434ac: (a: number, b: number) => void;
122
+ readonly wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504: (a: number, b: number, c: any) => [number, number];
123
+ readonly wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0: (a: number, b: number, c: any, d: any) => void;
113
124
  readonly __wbindgen_malloc: (a: number, b: number) => number;
114
125
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
115
126
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -1,8 +1,8 @@
1
- import { createEnvImports, createWasiImports, setMemory } from "./env_shim.js?v=ehfix-20260406-1";
1
+ import { createEnvImports, createWasiImports, setMemory } from "./env_shim.js?v=emsdk6-20261001-2";
2
2
  const __env = createEnvImports();
3
3
  const __wasi = createWasiImports();
4
4
  /* @ts-self-types="./cereusdb.d.ts" */
5
- import { cereusdbFetch, cereusdbSetFetchConcurrency } from './snippets/cereusdb-object-store-3803cd296f83ecfa/inline0.js';
5
+ import { cereusdbFetch, cereusdbSetFetchConcurrency } from './snippets/cereusdb-object-store-0da8c74e50551289/inline0.js';
6
6
 
7
7
  /**
8
8
  * Main CereusDB instance for browser use.
@@ -272,6 +272,9 @@ export class CereusDB {
272
272
  }
273
273
  /**
274
274
  * Get version information.
275
+ *
276
+ * Release builds set `CEREUSDB_VERSION` to the full npm version, including
277
+ * prerelease suffixes; other builds fall back to the crate version.
275
278
  * @returns {string}
276
279
  */
277
280
  version() {
@@ -314,26 +317,26 @@ const import12 = __wasi;
314
317
  const import13 = __env;
315
318
  const import14 = __env;
316
319
  const import15 = __env;
317
- const import16 = __wasi;
320
+ const import16 = __env;
318
321
  const import17 = __env;
319
322
  const import18 = __env;
320
323
  const import19 = __env;
321
324
  const import20 = __env;
322
- const import21 = __env;
325
+ const import21 = __wasi;
323
326
  const import22 = __env;
324
327
  const import23 = __env;
325
328
  const import24 = __env;
326
- const import25 = __wasi;
327
- const import26 = __env;
329
+ const import25 = __env;
330
+ const import26 = __wasi;
328
331
  const import27 = __env;
329
332
  const import28 = __env;
330
333
  const import29 = __env;
331
334
  const import30 = __env;
332
335
  const import31 = __env;
333
336
  const import32 = __env;
334
- const import33 = __env;
337
+ const import33 = __wasi;
335
338
  const import34 = __wasi;
336
- const import35 = __wasi;
339
+ const import35 = __env;
337
340
  const import36 = __env;
338
341
  const import37 = __env;
339
342
  const import38 = __env;
@@ -341,8 +344,7 @@ const import39 = __env;
341
344
  const import40 = __env;
342
345
  const import41 = __env;
343
346
  const import42 = __env;
344
- const import43 = __env;
345
- const import44 = __wasi;
347
+ const import43 = __wasi;
346
348
 
347
349
  function __wbg_get_imports() {
348
350
  const import0 = {
@@ -449,11 +451,11 @@ function __wbg_get_imports() {
449
451
  const ret = arg0.call(arg1);
450
452
  return ret;
451
453
  },
452
- __wbg_cereusdbFetch_deb849058cc19990: function(arg0) {
454
+ __wbg_cereusdbFetch_ef03c6e2e53e5d27: function(arg0) {
453
455
  const ret = cereusdbFetch(arg0);
454
456
  return ret;
455
457
  },
456
- __wbg_cereusdbSetFetchConcurrency_fca2c11ec07fc658: function(arg0) {
458
+ __wbg_cereusdbSetFetchConcurrency_5dba4b72020a565e: function(arg0) {
457
459
  cereusdbSetFetchConcurrency(arg0 >>> 0);
458
460
  },
459
461
  __wbg_done_08ce71ee07e3bd17: function(arg0) {
@@ -614,7 +616,7 @@ function __wbg_get_imports() {
614
616
  const a = state0.a;
615
617
  state0.a = 0;
616
618
  try {
617
- return wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(a, state0.b, arg0, arg1);
619
+ return wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(a, state0.b, arg0, arg1);
618
620
  } finally {
619
621
  state0.a = a;
620
622
  }
@@ -726,8 +728,8 @@ function __wbg_get_imports() {
726
728
  return ret;
727
729
  },
728
730
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
729
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7576, function: Function { arguments: [Externref], shim_idx: 24828, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
730
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h2bfbe8d19302e783, wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6);
731
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7619, function: Function { arguments: [Externref], shim_idx: 24967, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
732
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h8db467765ce434ac, wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504);
731
733
  return ret;
732
734
  },
733
735
  __wbindgen_cast_0000000000000002: function(arg0) {
@@ -780,26 +782,26 @@ function __wbg_get_imports() {
780
782
  "env": import13,
781
783
  "env": import14,
782
784
  "env": import15,
783
- "wasi_snapshot_preview1": import16,
785
+ "env": import16,
784
786
  "env": import17,
785
787
  "env": import18,
786
788
  "env": import19,
787
789
  "env": import20,
788
- "env": import21,
790
+ "wasi_snapshot_preview1": import21,
789
791
  "env": import22,
790
792
  "env": import23,
791
793
  "env": import24,
792
- "wasi_snapshot_preview1": import25,
793
- "env": import26,
794
+ "env": import25,
795
+ "wasi_snapshot_preview1": import26,
794
796
  "env": import27,
795
797
  "env": import28,
796
798
  "env": import29,
797
799
  "env": import30,
798
800
  "env": import31,
799
801
  "env": import32,
800
- "env": import33,
802
+ "wasi_snapshot_preview1": import33,
801
803
  "wasi_snapshot_preview1": import34,
802
- "wasi_snapshot_preview1": import35,
804
+ "env": import35,
803
805
  "env": import36,
804
806
  "env": import37,
805
807
  "env": import38,
@@ -807,8 +809,7 @@ function __wbg_get_imports() {
807
809
  "env": import40,
808
810
  "env": import41,
809
811
  "env": import42,
810
- "env": import43,
811
- "wasi_snapshot_preview1": import44,
812
+ "wasi_snapshot_preview1": import43,
812
813
  };
813
814
  }
814
815
 
@@ -833,11 +834,11 @@ function __wbg_handle_catch(e) {
833
834
  getInt32ArrayMemory0()[__wbg_terminated_addr] = 1;
834
835
  throw e;
835
836
  }
836
- function wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6(arg0, arg1, arg2) {
837
+ function wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2) {
837
838
  let ret;
838
839
  __wbg_termination_guard();
839
840
  try {
840
- ret = wasm.wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6(arg0, arg1, arg2);;
841
+ ret = wasm.wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504(arg0, arg1, arg2);;
841
842
  } catch(e) {
842
843
  __wbg_handle_catch(e);
843
844
  }
@@ -846,10 +847,10 @@ function wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6(arg0, arg
846
847
  }
847
848
  }
848
849
 
849
- function wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(arg0, arg1, arg2, arg3) {
850
+ function wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3) {
850
851
  __wbg_termination_guard();
851
852
  try {
852
- wasm.wasm_bindgen__convert__closures_____invoke__h62da4917f540b667(arg0, arg1, arg2, arg3);
853
+ wasm.wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0(arg0, arg1, arg2, arg3);
853
854
  } catch(e) {
854
855
  __wbg_handle_catch(e);
855
856
  }
Binary file
@@ -31,10 +31,18 @@ export const realloc: (a: number, b: number) => number;
31
31
  export const abort: () => void;
32
32
  export const emscripten_builtin_free: (a: number) => void;
33
33
  export const emscripten_builtin_malloc: (a: number) => number;
34
+ export const rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
35
+ export const rust_zstd_wasm_shim_free: (a: number) => void;
36
+ export const rust_zstd_wasm_shim_malloc: (a: number) => number;
37
+ export const rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
38
+ export const rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
39
+ export const rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
40
+ export const rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
41
+ export const rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
34
42
  export const __cpp_exception: WebAssembly.Tag;
35
- export const wasm_bindgen__closure__destroy__h2bfbe8d19302e783: (a: number, b: number) => void;
36
- export const wasm_bindgen__convert__closures_____invoke__h3c10a375d8fa7de6: (a: number, b: number, c: any) => [number, number];
37
- export const wasm_bindgen__convert__closures_____invoke__h62da4917f540b667: (a: number, b: number, c: any, d: any) => void;
43
+ export const wasm_bindgen__closure__destroy__h8db467765ce434ac: (a: number, b: number) => void;
44
+ export const wasm_bindgen__convert__closures_____invoke__h7573a8a64f443504: (a: number, b: number, c: any) => [number, number];
45
+ export const wasm_bindgen__convert__closures_____invoke__h3bcc27440de746c0: (a: number, b: number, c: any, d: any) => void;
38
46
  export const __wbindgen_malloc: (a: number, b: number) => number;
39
47
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
40
48
  export const __wbindgen_free: (a: number, b: number, c: number) => void;
@@ -26,6 +26,48 @@ function writeU64(ptr, value) {
26
26
  }
27
27
  }
28
28
 
29
+ const _textDecoder = new TextDecoder();
30
+ const _pendingOutput = new Map();
31
+
32
+ // Gathers a WASI iovec array. Writers such as musl's fwrite retry until every
33
+ // byte is reported as written, so the full length must always be returned.
34
+ function readIovs(iovs, iovcnt) {
35
+ const view = getDataView();
36
+ if (!view) {
37
+ return { bytes: new Uint8Array(0), length: 0 };
38
+ }
39
+ let length = 0;
40
+ for (let i = 0; i < iovcnt; i++) {
41
+ length += view.getUint32(iovs + i * 8 + 4, true);
42
+ }
43
+ const bytes = new Uint8Array(length);
44
+ let offset = 0;
45
+ for (let i = 0; i < iovcnt; i++) {
46
+ const ptr = view.getUint32(iovs + i * 8, true);
47
+ const len = view.getUint32(iovs + i * 8 + 4, true);
48
+ bytes.set(new Uint8Array(_memory.buffer, ptr, len), offset);
49
+ offset += len;
50
+ }
51
+ return { bytes, length };
52
+ }
53
+
54
+ // Forwards stdout/stderr from the C/C++ libraries (GDAL, PROJ, ...) to the
55
+ // console, one line at a time.
56
+ function forwardOutput(fd, bytes) {
57
+ if (fd !== 1 && fd !== 2) {
58
+ return;
59
+ }
60
+ const text = (_pendingOutput.get(fd) ?? "") + _textDecoder.decode(bytes);
61
+ const lines = text.split("\n");
62
+ _pendingOutput.set(fd, lines.pop());
63
+ const log = fd === 2 ? console.warn : console.log;
64
+ for (const line of lines) {
65
+ if (line.trim()) {
66
+ log(`[cereusdb] ${line}`);
67
+ }
68
+ }
69
+ }
70
+
29
71
  function createCppException(ptr, type, destructor, message = "C++ exception") {
30
72
  const error = new WebAssembly.RuntimeError(message);
31
73
  error.__cxa_exception_ptr = ptr >>> 0;
@@ -60,7 +102,10 @@ export function createEnvImports() {
60
102
 
61
103
  // Minimal C++ EH shims. These are enough to satisfy instantiation and
62
104
  // propagate exceptions back to JS on paths that actually throw.
105
+ // LLVM in Emscripten < 6 calls _Unwind_CallPersonality; newer versions
106
+ // import the personality routine directly.
63
107
  _Unwind_CallPersonality: () => 0,
108
+ __gxx_wasm_personality_v0: () => 0,
64
109
  __cxa_begin_catch: (ptr) => {
65
110
  const value = ptr >>> 0;
66
111
  _caughtCxaExceptions.push(value);
@@ -109,6 +154,7 @@ export function createEnvImports() {
109
154
  __syscall_prlimit64: () => UNSUPPORTED_ERRNO,
110
155
  __syscall_dup3: () => UNSUPPORTED_ERRNO,
111
156
  __syscall_pipe: () => UNSUPPORTED_ERRNO,
157
+ __syscall_pipe2: () => UNSUPPORTED_ERRNO,
112
158
  __syscall_wait4: () => UNSUPPORTED_ERRNO,
113
159
  __syscall_getuid32: () => 0,
114
160
  __syscall_geteuid32: () => 0,
@@ -143,16 +189,18 @@ export function createEnvImports() {
143
189
  export function createWasiImports() {
144
190
  return {
145
191
  fd_close: () => 0,
146
- fd_write: (_fd, _iovs, _iovcnt, pnum) => {
147
- writeU32(pnum, 0);
192
+ fd_write: (fd, iovs, iovcnt, pnum) => {
193
+ const { bytes, length } = readIovs(iovs, iovcnt);
194
+ forwardOutput(fd, bytes);
195
+ writeU32(pnum, length);
148
196
  return 0;
149
197
  },
150
198
  fd_read: (_fd, _iovs, _iovcnt, pnum) => {
151
199
  writeU32(pnum, 0);
152
200
  return 0;
153
201
  },
154
- fd_pwrite: (_fd, _iovs, _iovcnt, _offset, pnum) => {
155
- writeU32(pnum, 0);
202
+ fd_pwrite: (_fd, iovs, iovcnt, _offset, pnum) => {
203
+ writeU32(pnum, readIovs(iovs, iovcnt).length);
156
204
  return 0;
157
205
  },
158
206
  fd_pread: (_fd, _iovs, _iovcnt, _offset, pnum) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cereusdb/standard",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Standard CereusDB browser package with GEOS and PROJ support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -11,6 +11,10 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js"
13
13
  },
14
+ "./external": {
15
+ "types": "./dist/external.d.ts",
16
+ "import": "./dist/external.js"
17
+ },
14
18
  "./wasm": "./dist/wasm/cereusdb_bg.wasm",
15
19
  "./wasm/*": "./dist/wasm/*"
16
20
  },