@cereusdb/minimal 0.1.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.
- package/README.md +94 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +108 -0
- package/dist/wasm/cereusdb.d.ts +132 -0
- package/dist/wasm/cereusdb.js +894 -0
- package/dist/wasm/cereusdb_bg.wasm +0 -0
- package/dist/wasm/cereusdb_bg.wasm.d.ts +42 -0
- package/dist/wasm/env_shim.js +195 -0
- package/package.json +52 -0
|
Binary file
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wasm_call_ctors: () => void;
|
|
5
|
+
export const __libc_calloc: (a: number, b: number) => number;
|
|
6
|
+
export const calloc: (a: number, b: number) => number;
|
|
7
|
+
export const __libc_free: (a: number) => void;
|
|
8
|
+
export const free: (a: number) => void;
|
|
9
|
+
export const __libc_malloc: (a: number) => number;
|
|
10
|
+
export const malloc: (a: number) => number;
|
|
11
|
+
export const __wbg_cereusdb_free: (a: number, b: number) => void;
|
|
12
|
+
export const _abort_js: () => void;
|
|
13
|
+
export const cereusdb_create: () => [number, number, number];
|
|
14
|
+
export const cereusdb_drop_table: (a: number, b: number, c: number) => [number, number];
|
|
15
|
+
export const cereusdb_register_geojson: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
16
|
+
export const cereusdb_register_geotiff_buffer: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
17
|
+
export const cereusdb_register_parquet_buffer: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
18
|
+
export const cereusdb_register_raster_buffer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
|
19
|
+
export const cereusdb_register_remote_parquet: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
20
|
+
export const cereusdb_sql: (a: number, b: number, c: number) => any;
|
|
21
|
+
export const cereusdb_sql_json: (a: number, b: number, c: number) => any;
|
|
22
|
+
export const cereusdb_tables: (a: number) => [number, number, number];
|
|
23
|
+
export const cereusdb_version: (a: number) => [number, number];
|
|
24
|
+
export const emscripten_builtin_malloc_usable_size: (a: number) => number;
|
|
25
|
+
export const malloc_usable_size: (a: number) => number;
|
|
26
|
+
export const emscripten_builtin_memalign: (a: number, b: number) => number;
|
|
27
|
+
export const posix_memalign: (a: number, b: number, c: number) => number;
|
|
28
|
+
export const realloc: (a: number, b: number) => number;
|
|
29
|
+
export const abort: () => void;
|
|
30
|
+
export const emscripten_builtin_free: (a: number) => void;
|
|
31
|
+
export const emscripten_builtin_malloc: (a: number) => number;
|
|
32
|
+
export const __cpp_exception: WebAssembly.Tag;
|
|
33
|
+
export const wasm_bindgen__closure__destroy__he74b42d6a982a3c3: (a: number, b: number) => void;
|
|
34
|
+
export const wasm_bindgen__convert__closures_____invoke__hf2284274f3d5489c: (a: number, b: number, c: any) => [number, number];
|
|
35
|
+
export const wasm_bindgen__convert__closures_____invoke__h34d4f60983fa9e41: (a: number, b: number, c: any, d: any) => void;
|
|
36
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
37
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
38
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
39
|
+
export const __externref_table_alloc: () => number;
|
|
40
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
41
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
42
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Emscripten runtime shim for wasm32-unknown-unknown builds with C/C++ deps.
|
|
2
|
+
|
|
3
|
+
let _memory = null;
|
|
4
|
+
const _caughtCxaExceptions = [];
|
|
5
|
+
const UNSUPPORTED_ERRNO = -38;
|
|
6
|
+
|
|
7
|
+
export function setMemory(mem) {
|
|
8
|
+
_memory = mem;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function getDataView() {
|
|
12
|
+
return _memory ? new DataView(_memory.buffer) : null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function writeU32(ptr, value) {
|
|
16
|
+
const view = getDataView();
|
|
17
|
+
if (view && ptr) {
|
|
18
|
+
view.setUint32(ptr, value >>> 0, true);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function writeU64(ptr, value) {
|
|
23
|
+
const view = getDataView();
|
|
24
|
+
if (view && ptr) {
|
|
25
|
+
view.setBigUint64(ptr, BigInt(value), true);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function createCppException(ptr, type, destructor, message = "C++ exception") {
|
|
30
|
+
const error = new WebAssembly.RuntimeError(message);
|
|
31
|
+
error.__cxa_exception_ptr = ptr >>> 0;
|
|
32
|
+
error.__cxa_type = type >>> 0;
|
|
33
|
+
error.__cxa_destructor = destructor >>> 0;
|
|
34
|
+
return error;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function createEnvImports() {
|
|
38
|
+
const longjmpTag = typeof WebAssembly.Tag === "function"
|
|
39
|
+
? new WebAssembly.Tag({ parameters: ["i32"] })
|
|
40
|
+
: null;
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
emscripten_resize_heap: (requestedSize) => {
|
|
44
|
+
if (!_memory) {
|
|
45
|
+
console.error("[env_shim] emscripten_resize_heap called but no memory set");
|
|
46
|
+
return 0;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const oldBytes = _memory.buffer.byteLength;
|
|
50
|
+
if (requestedSize <= oldBytes) return 1;
|
|
51
|
+
const pagesToGrow = Math.ceil((requestedSize - oldBytes) / 65536);
|
|
52
|
+
_memory.grow(pagesToGrow);
|
|
53
|
+
return 1;
|
|
54
|
+
} catch(e) {
|
|
55
|
+
console.error("[env_shim] memory.grow failed:", e);
|
|
56
|
+
return 0;
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
emscripten_get_heap_max: () => 2147483648,
|
|
60
|
+
|
|
61
|
+
// Minimal C++ EH shims. These are enough to satisfy instantiation and
|
|
62
|
+
// propagate exceptions back to JS on paths that actually throw.
|
|
63
|
+
_Unwind_CallPersonality: () => 0,
|
|
64
|
+
__cxa_begin_catch: (ptr) => {
|
|
65
|
+
const value = ptr >>> 0;
|
|
66
|
+
_caughtCxaExceptions.push(value);
|
|
67
|
+
return value;
|
|
68
|
+
},
|
|
69
|
+
__cxa_end_catch: () => {
|
|
70
|
+
_caughtCxaExceptions.pop();
|
|
71
|
+
},
|
|
72
|
+
__cxa_throw: (ptr, type, destructor) => {
|
|
73
|
+
throw createCppException(ptr, type, destructor);
|
|
74
|
+
},
|
|
75
|
+
__cxa_rethrow: () => {
|
|
76
|
+
const ptr = _caughtCxaExceptions.length
|
|
77
|
+
? _caughtCxaExceptions[_caughtCxaExceptions.length - 1]
|
|
78
|
+
: 0;
|
|
79
|
+
throw createCppException(ptr, 0, 0, "C++ exception rethrown");
|
|
80
|
+
},
|
|
81
|
+
__c_longjmp: longjmpTag,
|
|
82
|
+
|
|
83
|
+
emscripten_date_now: () => Date.now(),
|
|
84
|
+
emscripten_get_now: () => performance.now(),
|
|
85
|
+
_localtime_js: () => {},
|
|
86
|
+
_tzset_js: () => {},
|
|
87
|
+
|
|
88
|
+
__syscall_openat: () => UNSUPPORTED_ERRNO,
|
|
89
|
+
__syscall_fcntl64: () => UNSUPPORTED_ERRNO,
|
|
90
|
+
__syscall_ioctl: () => UNSUPPORTED_ERRNO,
|
|
91
|
+
__syscall_fstat64: () => UNSUPPORTED_ERRNO,
|
|
92
|
+
__syscall_stat64: () => UNSUPPORTED_ERRNO,
|
|
93
|
+
__syscall_lstat64: () => UNSUPPORTED_ERRNO,
|
|
94
|
+
__syscall_newfstatat: () => UNSUPPORTED_ERRNO,
|
|
95
|
+
__syscall_getcwd: () => UNSUPPORTED_ERRNO,
|
|
96
|
+
__syscall_mkdirat: () => UNSUPPORTED_ERRNO,
|
|
97
|
+
__syscall_rmdir: () => UNSUPPORTED_ERRNO,
|
|
98
|
+
__syscall_unlinkat: () => UNSUPPORTED_ERRNO,
|
|
99
|
+
__syscall_renameat: () => UNSUPPORTED_ERRNO,
|
|
100
|
+
__syscall_readlinkat: () => UNSUPPORTED_ERRNO,
|
|
101
|
+
__syscall_getdents64: () => UNSUPPORTED_ERRNO,
|
|
102
|
+
__syscall_statfs64: () => UNSUPPORTED_ERRNO,
|
|
103
|
+
__syscall_faccessat: () => UNSUPPORTED_ERRNO,
|
|
104
|
+
__syscall_chmod: () => UNSUPPORTED_ERRNO,
|
|
105
|
+
__syscall_fchmod: () => UNSUPPORTED_ERRNO,
|
|
106
|
+
__syscall_fchown32: () => UNSUPPORTED_ERRNO,
|
|
107
|
+
__syscall_fdatasync: () => 0,
|
|
108
|
+
__syscall_ftruncate64: () => UNSUPPORTED_ERRNO,
|
|
109
|
+
__syscall_prlimit64: () => UNSUPPORTED_ERRNO,
|
|
110
|
+
__syscall_dup3: () => UNSUPPORTED_ERRNO,
|
|
111
|
+
__syscall_pipe: () => UNSUPPORTED_ERRNO,
|
|
112
|
+
__syscall_wait4: () => UNSUPPORTED_ERRNO,
|
|
113
|
+
__syscall_getuid32: () => 0,
|
|
114
|
+
__syscall_geteuid32: () => 0,
|
|
115
|
+
__syscall_getgid32: () => 0,
|
|
116
|
+
__syscall_getegid32: () => 0,
|
|
117
|
+
__syscall_utimensat: () => UNSUPPORTED_ERRNO,
|
|
118
|
+
|
|
119
|
+
emscripten_errn: () => 0,
|
|
120
|
+
emscripten_stack_snapshot: () => 0,
|
|
121
|
+
emscripten_stack_unwind_buffer: () => 0,
|
|
122
|
+
emscripten_asm_const_int: () => 0,
|
|
123
|
+
HaveOffsetConverter: () => 0,
|
|
124
|
+
emscripten_pc_get_function: () => 0,
|
|
125
|
+
|
|
126
|
+
malloc_usable_size: () => 0,
|
|
127
|
+
_mmap_js: () => -1,
|
|
128
|
+
_munmap_js: () => -1,
|
|
129
|
+
__wasm_longjmp: () => {
|
|
130
|
+
throw new WebAssembly.RuntimeError("longjmp is not supported in the browser runtime");
|
|
131
|
+
},
|
|
132
|
+
dlopen: () => 0,
|
|
133
|
+
__dlsym: () => 0,
|
|
134
|
+
vfork: () => -1,
|
|
135
|
+
fork: () => -1,
|
|
136
|
+
execve: () => -1,
|
|
137
|
+
|
|
138
|
+
_abort_js: () => { console.warn("[env_shim] abort called (ignored)"); },
|
|
139
|
+
exit: (code) => { console.warn(`exit(${code})`); },
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function createWasiImports() {
|
|
144
|
+
return {
|
|
145
|
+
fd_close: () => 0,
|
|
146
|
+
fd_write: (_fd, _iovs, _iovcnt, pnum) => {
|
|
147
|
+
writeU32(pnum, 0);
|
|
148
|
+
return 0;
|
|
149
|
+
},
|
|
150
|
+
fd_read: (_fd, _iovs, _iovcnt, pnum) => {
|
|
151
|
+
writeU32(pnum, 0);
|
|
152
|
+
return 0;
|
|
153
|
+
},
|
|
154
|
+
fd_pwrite: (_fd, _iovs, _iovcnt, _offset, pnum) => {
|
|
155
|
+
writeU32(pnum, 0);
|
|
156
|
+
return 0;
|
|
157
|
+
},
|
|
158
|
+
fd_pread: (_fd, _iovs, _iovcnt, _offset, pnum) => {
|
|
159
|
+
writeU32(pnum, 0);
|
|
160
|
+
return 0;
|
|
161
|
+
},
|
|
162
|
+
fd_seek: (_fd, _offset, _whence, newOffset) => {
|
|
163
|
+
writeU64(newOffset, 0);
|
|
164
|
+
return 0;
|
|
165
|
+
},
|
|
166
|
+
fd_sync: () => 0,
|
|
167
|
+
fd_fdstat_get: () => 0,
|
|
168
|
+
clock_res_get: (_clockId, resolutionPtr) => {
|
|
169
|
+
writeU64(resolutionPtr, 1_000_000);
|
|
170
|
+
return 0;
|
|
171
|
+
},
|
|
172
|
+
clock_time_get: (clockId, _precision, timePtr) => {
|
|
173
|
+
const nowNs = clockId === 1
|
|
174
|
+
? Math.floor(performance.now() * 1_000_000)
|
|
175
|
+
: Date.now() * 1_000_000;
|
|
176
|
+
writeU64(timePtr, nowNs);
|
|
177
|
+
return 0;
|
|
178
|
+
},
|
|
179
|
+
environ_get: () => 0,
|
|
180
|
+
environ_sizes_get: (countPtr, sizePtr) => {
|
|
181
|
+
writeU32(countPtr, 0);
|
|
182
|
+
writeU32(sizePtr, 0);
|
|
183
|
+
return 0;
|
|
184
|
+
},
|
|
185
|
+
proc_exit: (code) => {
|
|
186
|
+
throw new WebAssembly.RuntimeError(`proc_exit(${code})`);
|
|
187
|
+
},
|
|
188
|
+
random_get: (buf, len) => {
|
|
189
|
+
if (!_memory) return -1;
|
|
190
|
+
const bytes = new Uint8Array(_memory.buffer, buf, len);
|
|
191
|
+
crypto.getRandomValues(bytes);
|
|
192
|
+
return 0;
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cereusdb/minimal",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Minimal CereusDB browser package with GEOS-backed spatial SQL",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./wasm": "./dist/wasm/cereusdb_bg.wasm",
|
|
15
|
+
"./wasm/*": "./dist/wasm/*"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "node ../../scripts/build-npm-package.mjs minimal",
|
|
23
|
+
"prepack": "npm run build",
|
|
24
|
+
"test": "cd ../../js && npm run test:minimal"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"cereusdb",
|
|
31
|
+
"geospatial",
|
|
32
|
+
"spatial",
|
|
33
|
+
"sql",
|
|
34
|
+
"wasm",
|
|
35
|
+
"webassembly",
|
|
36
|
+
"geos"
|
|
37
|
+
],
|
|
38
|
+
"author": "tobilg",
|
|
39
|
+
"license": "Apache-2.0",
|
|
40
|
+
"repository": {
|
|
41
|
+
"type": "git",
|
|
42
|
+
"url": "https://github.com/tobilg/cereusdb",
|
|
43
|
+
"directory": "packages/minimal"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/tobilg/cereusdb/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/tobilg/cereusdb#readme",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=22.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|