1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-24 09:53:10 +03:00

Reinstate the Module.instantiateWasm() override and simplify how the wasm filename gets injected into the JS files.

FossilOrigin-Name: e878ffd2eaa87e2978c44fcd03a1eb6114a9ae31e31101898d682f43cf81000f
This commit is contained in:
stephan
2025-09-26 17:11:39 +00:00
parent b62c26d999
commit 96c753ec56
6 changed files with 256 additions and 232 deletions

View File

@@ -45,7 +45,18 @@ const toExportForESM =
location: globalThis.location,
urlParams: globalThis?.location?.href
? new URL(globalThis.location.href).searchParams
: new URLSearchParams()
: new URLSearchParams(),
/*
It is literally impossible to reliably get the name of _this_ script
at runtime, so impossible to reliably derive X.wasm from script name
X.js. (This is apparently why Emscripten hard-codes the name of the
wasm file into their output.) Thus we need, at build-time, to set
the name of the WASM file which our custom instantiateWasm() should to
load. The build process populates this.
Module.instantiateWasm() is found in pre-js.c-pp.js.
*/
wasmFilename: '@sqlite3.wasm@' /* replaced by the build process */
});
sIMS.debugModule =
sIMS.urlParams.has('sqlite3.debugModule')