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

More work on creating a separate sqlite3.js build which is hopefully friendly to JS bundlers.

FossilOrigin-Name: b7b896fb448a7f46eb88eadadb1359255aec637a384cabcdd526276a02f4f0b4
This commit is contained in:
stephan
2023-01-27 03:18:16 +00:00
parent 67bfea4ea6
commit a0013fbe87
8 changed files with 53 additions and 24 deletions

View File

@ -45,14 +45,23 @@ const toExportForES6 =
moduleScript: self?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: self.location,
urlParams: new URL(self.location.href).searchParams
urlParams:
//#if target=es6-bundler-friendly
undefined
//#else
new URL(self.location.href).searchParams
//#endif
});
initModuleState.debugModule =
(new URL(self.location.href).searchParams).has('sqlite3.debugModule')
//#if target=es6-bundler-friendly
()=>{}
//#else
(new URL(self.location.href).searchParams).has('sqlite3.debugModule')
? (...args)=>console.warn('sqlite3.debugModule:',...args)
: ()=>{};
//#endif
if(initModuleState.urlParams.has('sqlite3.dir')){
if(initModuleState.urlParams && initModuleState.urlParams.has('sqlite3.dir')){
initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/';
}else if(initModuleState.moduleScript){
const li = initModuleState.moduleScript.src.split('/');