1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +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:
stephan
2022-11-03 22:14:47 +00:00
parent 4df2ab575f
commit b0ab21dee4
5 changed files with 76 additions and 16 deletions

View File

@ -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("")
);
}