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

Minor internal cleanups in JS code.

FossilOrigin-Name: 21a2ca9fc46bf746874579897872e2a45cb07f278abb670dd22b122f7d6a9a6c
This commit is contained in:
stephan
2023-07-20 23:25:32 +00:00
parent 0b518b8d65
commit 35325a37ce
5 changed files with 24 additions and 21 deletions

View File

@ -59,7 +59,7 @@ const toExportForESM =
initModuleState.sqlite3Dir = li.join('/') + '/';
}
globalThis.sqlite3InitModule = async function ff(...args){
globalThis.sqlite3InitModule = function ff(...args){
//console.warn("Using replaced sqlite3InitModule()",globalThis.location);
return originalInit(...args).then((EmscriptenModule)=>{
if('undefined'!==typeof WorkerGlobalScope &&

View File

@ -1861,6 +1861,9 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
client: undefined,
/**
This function is not part of the public interface, but a
piece of internal bootstrapping infrastructure.
Performs any optional asynchronous library-level initialization
which might be required. This function returns a Promise which
resolves to the sqlite3 namespace object. Any error in the
@ -1884,15 +1887,15 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
In Emscripten-based builds, this function is called
automatically and deleted from this object.
*/
asyncPostInit: function ff(){
if(ff.ready instanceof Promise) return ff.ready;
asyncPostInit: async function ff(){
if(ff.isReady instanceof Promise) return ff.isReady;
let lip = sqlite3ApiBootstrap.initializersAsync;
delete sqlite3ApiBootstrap.initializersAsync;
if(!lip || !lip.length){
return ff.ready = Promise.resolve(sqlite3);
return ff.isReady = Promise.resolve(sqlite3);
}
lip = lip.map((f)=>{
return (f instanceof Promise) ? f : f(sqlite3);
return (f instanceof Function) ? async x=>f(sqlite3) : f;
});
const catcher = (e)=>{
config.error("an async sqlite3 initializer failed:",e);
@ -1907,7 +1910,7 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
/* It's conceivable that we might want to expose
StructBinder to client-side code, but it's only useful if
clients build their own sqlite3.wasm which contains their
one C struct types. */
own C struct types. */
delete sqlite3.StructBinder;
}
return sqlite3;
@ -1917,12 +1920,12 @@ globalThis.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
advantage is that it allows us to have post-init cleanup
defined outside of this routine at the end of the list and
have it run at a well-defined time. */
let p = lip.shift();
let p = Promise.resolve(sqlite3);
while(lip.length) p = p.then(lip.shift());
return ff.ready = p.then(postInit).catch(catcher);
return ff.isReady = p.then(postInit).catch(catcher);
}else{
/* Run them in an arbitrary order. */
return ff.ready = Promise.all(lip).then(postInit).catch(catcher);
return ff.isReady = Promise.all(lip).then(postInit).catch(catcher);
}
},
/**
@ -1983,7 +1986,7 @@ globalThis.sqlite3ApiBootstrap.initializers = [];
specifically for initializers which are asynchronous. All entries in
this list must be either async functions, non-async functions which
return a Promise, or a Promise. Each function in the list is called
with the sqlite3 ojbect as its only argument.
with the sqlite3 object as its only argument.
The resolved value of any Promise is ignored and rejection will kill
the asyncPostInit() process (at an indeterminate point because all

View File

@ -1367,7 +1367,7 @@ globalThis.sqlite3ApiBootstrap.initializersAsync.push(async (sqlite3)=>{
});
}catch(e){
sqlite3.config.error("installOpfsVfs() exception:",e);
throw e;
return Promise.reject(e);
}
});
}/*sqlite3ApiBootstrap.initializers.push()*/);

View File

@ -1,5 +1,5 @@
C Filter\sthe\sOPFS\sVFSes\sout\sof\sthe\ssqlite3-node.mjs\sbuild.\sAdd\sanother\slevel\sof\ssubdirectory\sto\sthe\ssahpool\sto\slater\senable\stransparent\ssupport\sof\sclient-provided\sfiles\sunder\sthe\sVFS's\sroot\sdir.\sRework\sthe\sawkward\ssahpool-via-oo1\smapping.
D 2023-07-20T09:06:42.459
C Minor\sinternal\scleanups\sin\sJS\scode.
D 2023-07-20T23:25:32.031
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -489,7 +489,7 @@ F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md 5eb44fa02e9c693a1884a3692428647894b0380b24bca120866b7a24c8786134
F ext/wasm/api/extern-post-js.c-pp.js 80f288131f9f4486a66e79dbf42d4402dc23e3cb4ef605377ae69f0545a6b8e6
F ext/wasm/api/extern-post-js.c-pp.js 116749b7e55b7519129de06d3d353e19df68cfb24b12204aa4dc30c9a83023fe
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
@ -497,13 +497,13 @@ F ext/wasm/api/pre-js.c-pp.js ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057af
F ext/wasm/api/sqlite3-api-cleanup.js 23ceec5ef74a0e649b19694ca985fd89e335771e21f24f50df352a626a8c81bf
F ext/wasm/api/sqlite3-api-glue.js f1b2dcb944de5138bb5bd9a1559d2e76a4f3ec25260963d709e8237476688803
F ext/wasm/api/sqlite3-api-oo1.js 9678dc4d9a5d39632b6ffe6ea94a023119260815bf32f265bf5f6c36c9516db8
F ext/wasm/api/sqlite3-api-prologue.js d747cbb379e13881c9edf39dce019cbbbae860c456ababe9d550b4b27666a1c9
F ext/wasm/api/sqlite3-api-prologue.js fdd8b72323f09684a7addfb622d427477a58cd5a35523f150ce77236b56352a7
F ext/wasm/api/sqlite3-api-worker1.js 9f32af64df1a031071912eea7a201557fe39b1738645c0134562bb84e88e2fec
F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
F ext/wasm/api/sqlite3-opfs-async-proxy.js 8cf8a897726f14071fae6be6648125162b256dfb4f96555b865dbb7a6b65e379
F ext/wasm/api/sqlite3-v-helper.js 7daa0eab0a513a25b05e9abae7b5beaaa39209b3ed12f86aeae9ef8d2719ed25
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js d9abf3cde87aea55ea901e80f70e55b36055e8e5120ed47321af35afb9facdaa w ext/wasm/api/sqlite3-vfs-opfs-sahpool.js
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 7b6aa73e8af0379f96d17eb874bc02ed13e901c6924aa3804a075f7bc58c3146
F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js d9abf3cde87aea55ea901e80f70e55b36055e8e5120ed47321af35afb9facdaa
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js e7a690e0e78ff4d563f2eca468f91db69f001ff4b79c6d2304cbb6f62dca437d
F ext/wasm/api/sqlite3-wasm.c 8867f1d41c112fb4a2cfe22ff224eccaf309fcdea266cee0ec554f85db72ef0f
F ext/wasm/api/sqlite3-worker1-promiser.c-pp.js bc06df0d599e625bde6a10a394e326dc68da9ff07fa5404354580f81566e591f
F ext/wasm/api/sqlite3-worker1.c-pp.js da509469755035e919c015deea41b4514b5e84c12a1332e6cc8d42cb2cc1fb75
@ -2044,8 +2044,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 64ccf6177a019eab46fb3345ad1e8ba80eaf2c9da55767031f9f04ccd16afb4d
R 9b88832176f0fa72b79f47fe01f46afd
P 080a4d0aba30d8f3802b49be4a113205f069b3bdea8cebf525d654055642ff62
R 729d5d7f424013b7282496b5ada001e8
U stephan
Z 925e0249217422a96f201bda7e782884
Z fa107c664214632c0e2de6d34ddd182b
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
080a4d0aba30d8f3802b49be4a113205f069b3bdea8cebf525d654055642ff62
21a2ca9fc46bf746874579897872e2a45cb07f278abb670dd22b122f7d6a9a6c