aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-opfs.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-11-03 22:14:47 +0000
committerstephan <stephan@noemail.net>2022-11-03 22:14:47 +0000
commitb0ab21dee40144d8aec92df4a0c98eb069badeb3 (patch)
treedd60a8f10bef28cd2f0f8f18e75d057870e64d3a /ext/wasm/api/sqlite3-api-opfs.js
parent4df2ab575facacd8987b65078202cc638e0252ae (diff)
downloadsqlite-b0ab21dee40144d8aec92df4a0c98eb069badeb3.tar.gz
sqlite-b0ab21dee40144d8aec92df4a0c98eb069badeb3.zip
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
Diffstat (limited to 'ext/wasm/api/sqlite3-api-opfs.js')
-rw-r--r--ext/wasm/api/sqlite3-api-opfs.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js
index 86285df1d..3cb5c8a3e 100644
--- a/ext/wasm/api/sqlite3-api-opfs.js
+++ b/ext/wasm/api/sqlite3-api-opfs.js
@@ -166,7 +166,12 @@ const installOpfsVfs = function callee(options){
opfsVfs.dispose();
return promiseReject_(err);
};
- const W = new Worker(options.proxyUri);
+ const W =
+#ifdef SQLITE_JS_ESM
+ new Worker(new URL(options.proxyUri, import.meta.url));
+#else
+ new Worker(options.proxyUri);
+#endif
W._originalOnError = W.onerror /* will be restored later */;
W.onerror = function(err){
// The error object doesn't contain any useful info when the
@@ -566,7 +571,7 @@ const installOpfsVfs = function callee(options){
const ndx = Math.random() * (f._n * 64) % f._n | 0;
a[i] = f._chars[ndx];
}
- return a.join('');
+ return a.join("");
};
/**
@@ -1155,7 +1160,7 @@ const installOpfsVfs = function callee(options){
be set here.
*/
//"pragma cache_size=-8388608;"
- ].join('')
+ ].join("")
);
}