Comments (1)
A .wasm
file will declare a bunch of functions it needs to execute properly. WASI and WASIX are standard sets of such functions. A pure WASI/WASIX web assembly program can be run in a WASI/WASIX runtime like wasmer
without changes. At the moment, PGlite ships a wasm binary with a JS file that provides many custom Emscripten non-standard functions that wasmer
doesn't have.
// postgres.js (generated)
var wasmImports = {
//...
emscripten_date_now: _emscripten_date_now,
emscripten_dispatch_result: emscripten_dispatch_result,
emscripten_get_heap_max: _emscripten_get_heap_max,
emscripten_get_now: _emscripten_get_now,
emscripten_get_now_res: _emscripten_get_now_res,
emscripten_memcpy_js: _emscripten_memcpy_js,
emscripten_resize_heap: _emscripten_resize_heap,
environ_get: _environ_get,
environ_sizes_get: _environ_sizes_get,
exit: _exit,
fd_close: _fd_close,
fd_fdstat_get: _fd_fdstat_get,
fd_pread: _fd_pread,
fd_pwrite: _fd_pwrite,
fd_read: _fd_read,
fd_seek: _fd_seek,
fd_sync: _fd_sync,
fd_write: _fd_write,
// ...
}
A WASIX (note the x, not WASI) build of pglite shouldn't be too tough because it has a very broad API. You link the wasix libc and that libc will compile imports in the .wasm
binary that wasmer
understands. You could even compile totally vanilla postgres to wasm32-wasix-none
. I'd love to use a wasix pg instead of bloated, ram hungry docker pg! https://wasix.org/docs/language-guide/c/usage.
WASI should be possible through Emscripten by using the -sWASM_STANDALONE=1
linker flag. It can work, but will take some finagling to pass tests.
from pglite.
Related Issues (20)
- `affectedRows` not being returned in UPDATE `.query` method
- initdb failing to complete in Bun HOT 1
- Generic Extension Strategy HOT 6
- `import("module")).default` is undefined HOT 3
- Calling `execProtocol` when PGlite is not ready HOT 2
- Throw error when main db instance method used inside an interactive transaction HOT 1
- Options for WASM and shareDir bundle location
- Feature: Add foreign data wrapper HOT 1
- Attempting to change column type throws error HOT 1
- Add lock to indexeddb vfs so that the database can only be opened once. HOT 10
- Able to create custom fs
- React native support
- OOB when select() with over about 1k response? HOT 2
- missing WebSocket dependency for node environments HOT 2
- `PGlite.exec()` returns result objects with misplaced `affectedRows`
- "memory access out of bounds" or "null function or function signature mismatch" with plpgsql; but works in Postgres 13/14.5/15.1 HOT 4
- error performing snapshot: error: unrecognized node type: 67143218
- db enters invalid state, causing many subsequent errors and requiring a reload HOT 1
- Error: expected magic word 00 61 73 6d, found 3c 21 44 4f @+0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pglite.