1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Further wasm build cleanups and tweaks. No functional changes.

FossilOrigin-Name: 3b72a143431537ec275aefae739e56330c1d445c9ea80885882a2b9aa2201179
This commit is contained in:
stephan
2024-09-24 00:31:08 +00:00
parent 6ed21e8fd7
commit 405ae974ee
7 changed files with 107 additions and 63 deletions

View File

@ -59,6 +59,7 @@ Module['locateFile'] = function(path, prefix) {
}.bind(sqlite3InitModuleState);
//#endif ifnot target=es6-bundler-friendly
//#if custom-Module.instantiateModule
/**
Bug warning: a custom Module.instantiateWasm() does not work
in WASMFS builds:
@ -67,7 +68,15 @@ Module['locateFile'] = function(path, prefix) {
In such builds we must disable this.
*/
const xNameOfInstantiateWasm = false
const xNameOfInstantiateWasm =
//#if wasmfs
false
//#else
true /* This works, but it does not have the testing coverage in the
wild which Emscripten's default impl does, so we'll save
this option until we really need a custom
Module.instantiateWasm() */
//#endif
? 'instantiateWasm'
: 'emscripten-bug-17951';
Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
@ -80,6 +89,7 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
sqlite3InitModuleState.debugModule(
"instantiateWasm() uri =", uri
);
//console.warn("Custom instantiateModule",uri);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>{
@ -105,6 +115,7 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
scripts.
*/
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';
//#endif custom-Module.instantiateModule
/* END FILE: api/pre-js.js, noting that the build process may add a
line after this one to change the above .uri to a build-specific
one. */