mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Experimentally use clang's C preprocessor to filter #ifdef's out of the generated sqlite3-api.js, the goal being to see if we can feasibly use cpp to include ES6 module-specific code in the main code base and conditionally filter it out.
FossilOrigin-Name: 718a6d371e61359d73c8f80afdb248e3d9b4d8df4c4e5c122ac884344e31035b
This commit is contained in:
@ -29,6 +29,10 @@ sqlite3InitModuleState.debugModule('self.location =',self.location);
|
||||
4) If none of the above apply, (prefix+path) is returned.
|
||||
*/
|
||||
Module['locateFile'] = function(path, prefix) {
|
||||
#ifdef SQLITE_JS_ESM
|
||||
return new URL(path, import.meta.url).href;
|
||||
#else
|
||||
'use strict';
|
||||
let theFile;
|
||||
const up = this.urlParams;
|
||||
if(up.has(path)){
|
||||
@ -47,6 +51,7 @@ Module['locateFile'] = function(path, prefix) {
|
||||
"result =", theFile
|
||||
);
|
||||
return theFile;
|
||||
#endif /* SQLITE_JS_EMS */
|
||||
}.bind(sqlite3InitModuleState);
|
||||
|
||||
/**
|
||||
@ -65,7 +70,7 @@ Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
|
||||
const uri = Module.locateFile(
|
||||
callee.uri, (
|
||||
('undefined'===typeof scriptDirectory/*var defined by Emscripten glue*/)
|
||||
? '' : scriptDirectory)
|
||||
? "" : scriptDirectory)
|
||||
);
|
||||
sqlite3InitModuleState.debugModule(
|
||||
"instantiateWasm() uri =", uri
|
||||
|
Reference in New Issue
Block a user