aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api
diff options
context:
space:
mode:
Diffstat (limited to 'ext/wasm/api')
-rw-r--r--ext/wasm/api/extern-post-js.c-pp.js23
-rw-r--r--ext/wasm/api/pre-js.c-pp.js4
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.c-pp.js21
3 files changed, 16 insertions, 32 deletions
diff --git a/ext/wasm/api/extern-post-js.c-pp.js b/ext/wasm/api/extern-post-js.c-pp.js
index 691ad7685..a577a63e1 100644
--- a/ext/wasm/api/extern-post-js.c-pp.js
+++ b/ext/wasm/api/extern-post-js.c-pp.js
@@ -9,7 +9,7 @@
Emscripten-generated module init scope, in the current
global scope. */
//#if target=es6-module
-const toExportForES6 =
+const toExportForESM =
//#endif
(function(){
/**
@@ -45,23 +45,14 @@ const toExportForES6 =
moduleScript: self?.document?.currentScript,
isWorker: ('undefined' !== typeof WorkerGlobalScope),
location: self.location,
- urlParams:
-//#if target=es6-bundler-friendly
- undefined
-//#else
- new URL(self.location.href).searchParams
-//#endif
+ urlParams: new URL(self.location.href).searchParams
});
initModuleState.debugModule =
-//#if target=es6-bundler-friendly
- ()=>{}
-//#else
- (new URL(self.location.href).searchParams).has('sqlite3.debugModule')
+ initModuleState.urlParams.has('sqlite3.debugModule')
? (...args)=>console.warn('sqlite3.debugModule:',...args)
: ()=>{};
-//#endif
- if(initModuleState.urlParams && initModuleState.urlParams.has('sqlite3.dir')){
+ if(initModuleState.urlParams.has('sqlite3.dir')){
initModuleState.sqlite3Dir = initModuleState.urlParams.get('sqlite3.dir') +'/';
}else if(initModuleState.moduleScript){
const li = initModuleState.moduleScript.src.split('/');
@@ -116,8 +107,8 @@ const toExportForES6 =
}
//#ifnot target=es6-module
// Emscripten does not inject these module-loader bits in ES6 module
-// build and including them here breaks JS bundlers, so elide them
-// from ES6 builds.
+// builds and including them here breaks JS bundlers, so elide them
+// from ESM builds.
/* Replace the various module exports performed by the Emscripten
glue... */
if (typeof exports === 'object' && typeof module === 'object'){
@@ -131,5 +122,5 @@ const toExportForES6 =
return self.sqlite3InitModule /* required for ESM */;
})();
//#if target=es6-module
-export default toExportForES6;
+export default toExportForESM;
//#endif
diff --git a/ext/wasm/api/pre-js.c-pp.js b/ext/wasm/api/pre-js.c-pp.js
index c27c2fe0d..a25c7ce77 100644
--- a/ext/wasm/api/pre-js.c-pp.js
+++ b/ext/wasm/api/pre-js.c-pp.js
@@ -55,9 +55,9 @@ Module['locateFile'] = function(path, prefix) {
"result =", theFile
);
return theFile;
-//#endif //target=es6-module
+//#endif target=es6-module
}.bind(sqlite3InitModuleState);
-//#endif //ifnot target=es6-bundler-friendly
+//#endif ifnot target=es6-bundler-friendly
/**
Bug warning: a custom Module.instantiateWasm() does not work
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index aeda62aa2..451f0019c 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -100,20 +100,13 @@ const installOpfsVfs = function callee(options){
if(!options || 'object'!==typeof options){
options = Object.create(null);
}
- const urlParams =
-//#if target=es6-bundler-friendly
- undefined;
-//#else
- new URL(self.location.href).searchParams;
-//#endif
- if(urlParams){
- if(undefined===options.verbose){
- options.verbose = urlParams.has('opfs-verbose')
- ? (+urlParams.get('opfs-verbose') || 2) : 1;
- }
- if(undefined===options.sanityChecks){
- options.sanityChecks = urlParams.has('opfs-sanity-check');
- }
+ const urlParams = new URL(self.location.href).searchParams;
+ if(undefined===options.verbose){
+ options.verbose = urlParams.has('opfs-verbose')
+ ? (+urlParams.get('opfs-verbose') || 2) : 1;
+ }
+ if(undefined===options.sanityChecks){
+ options.sanityChecks = urlParams.has('opfs-sanity-check');
}
if(undefined===options.proxyUri){
options.proxyUri = callee.defaultProxyUri;