From e1f7ec65fd547c0c7bffda9b07f83a98cc4ad42f Mon Sep 17 00:00:00 2001 From: stephan Date: Fri, 14 Nov 2025 17:23:24 +0000 Subject: [PATCH] Slight restructure of the previous checkin. FossilOrigin-Name: 8ff98747c072c8c333b1b37cf4ec9344e84f081bd4e6d3b5e75f37b1e1ce9e84 --- ext/wasm/api/sqlite3-api-cleanup.js | 81 ++++++++++++++--------------- manifest | 12 ++--- manifest.uuid | 2 +- 3 files changed, 46 insertions(+), 49 deletions(-) diff --git a/ext/wasm/api/sqlite3-api-cleanup.js b/ext/wasm/api/sqlite3-api-cleanup.js index d039a65535..9296523e0e 100644 --- a/ext/wasm/api/sqlite3-api-cleanup.js +++ b/ext/wasm/api/sqlite3-api-cleanup.js @@ -32,47 +32,44 @@ pre-js.c-pp.js and friends. */ 'use strict'; -if( 'undefined' === typeof EmscriptenModule/*from post-js-header.js*/ ){ - /* Not an Emscripten build. Nothing to do. */ - return; -} -try{ - /* Config options for sqlite3ApiBootstrap(). */ - const bootstrapConfig = Object.assign( - Object.create(null), - globalThis.sqlite3ApiBootstrap.defaultConfig, // default options - globalThis.sqlite3ApiConfig || {}, // optional client-provided options - /** The WASM-environment-dependent configuration for sqlite3ApiBootstrap() */ - { - memory: ('undefined'!==typeof wasmMemory) - ? wasmMemory - : EmscriptenModule['wasmMemory'], - exports: ('undefined'!==typeof wasmExports) - ? wasmExports /* emscripten >=3.1.44 */ - : (Object.prototype.hasOwnProperty.call(EmscriptenModule,'wasmExports') - ? EmscriptenModule['wasmExports'] - : EmscriptenModule['asm']/* emscripten <=3.1.43 */) - } - ); +if( 'undefined' !== typeof EmscriptenModule/*from post-js-header.js*/ ){ + try{ + /* Config options for sqlite3ApiBootstrap(). */ + const bootstrapConfig = Object.assign( + Object.create(null), + globalThis.sqlite3ApiBootstrap.defaultConfig, // default options + globalThis.sqlite3ApiConfig || {}, // optional client-provided options + /** The WASM-environment-dependent configuration for sqlite3ApiBootstrap() */ + { + memory: ('undefined'!==typeof wasmMemory) + ? wasmMemory + : EmscriptenModule['wasmMemory'], + exports: ('undefined'!==typeof wasmExports) + ? wasmExports /* emscripten >=3.1.44 */ + : (Object.prototype.hasOwnProperty.call(EmscriptenModule,'wasmExports') + ? EmscriptenModule['wasmExports'] + : EmscriptenModule['asm']/* emscripten <=3.1.43 */) + } + ); - sqlite3InitScriptInfo.debugModule("Bootstrapping lib config", bootstrapConfig); + sqlite3InitScriptInfo.debugModule("Bootstrapping lib config", bootstrapConfig); - /** - For purposes of the Emscripten build, call sqlite3ApiBootstrap(). - Ideally clients should be able to inject their own config here, - but that's not practical in this particular build constellation - because of the order everything happens in. Clients may either - define globalThis.sqlite3ApiConfig or modify - globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default - configuration used by a no-args call to sqlite3ApiBootstrap(), - but must have first loaded their WASM module in order to be able - to provide the necessary configuration state. - */ - const p = globalThis.sqlite3ApiBootstrap(bootstrapConfig); - delete globalThis.sqlite3ApiBootstrap; - return p /* the eventual result of globalThis.sqlite3InitModule() */; -}catch(e){ - console.error("sqlite3ApiBootstrap() error:",e); - throw e; -} -throw new Error("Maintenance required: this line should never be reached"); + /** + For purposes of the Emscripten build, call sqlite3ApiBootstrap(). + Ideally clients should be able to inject their own config here, + but that's not practical in this particular build constellation + because of the order everything happens in. Clients may either + define globalThis.sqlite3ApiConfig or modify + globalThis.sqlite3ApiBootstrap.defaultConfig to tweak the default + configuration used by a no-args call to sqlite3ApiBootstrap(), + but must have first loaded their WASM module in order to be able + to provide the necessary configuration state. + */ + const p = globalThis.sqlite3ApiBootstrap(bootstrapConfig); + delete globalThis.sqlite3ApiBootstrap; + return p /* the eventual result of globalThis.sqlite3InitModule() */; + }catch(e){ + console.error("sqlite3ApiBootstrap() error:",e); + throw e; + } +}/*Emscripten post-load lib init*/ diff --git a/manifest b/manifest index db9f8db6f7..1aa500ef58 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\ssqlite3-api-cleanup.js,\sif\sno\sEmscripten\smodule\sis\sdetected\sthen\ssimply\sreturn,\srather\sthan\sthrow.\sThis\sshould\senable\sthe\sgenerated\ssqliet3-api.js\s(normally\san\sintermediary\sfile)\sto\sbe\sused\sas-is,\swith\sthe\scaveat\sthat\sthe\scaller\shas\sto\sbootstrap\sthe\slibrary\sthemselves. -D 2025-11-14T16:56:51.732 +C Slight\srestructure\sof\sthe\sprevious\scheckin. +D 2025-11-14T17:23:24.208 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -590,7 +590,7 @@ F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e F ext/wasm/api/post-js-footer.js 5bd7170b5e8ce7b62102702bbcf47ef7b3b49cd56ed40c043fd990aa715b74ee F ext/wasm/api/post-js-header.js 79d078aec33d93b640a19c574b504d88bb2446432f38e2fbb3bb8e36da436e70 F ext/wasm/api/pre-js.c-pp.js b1a7a09d14df1f36de11e801ba06cb92c0ddeb520e5b2f28836af0ec8146e288 -F ext/wasm/api/sqlite3-api-cleanup.js e7eb4603854e174595312405d050b77832138c1c3ff04580792768882c54bebd +F ext/wasm/api/sqlite3-api-cleanup.js f0a408704e56d6e59d5c0a2f6d84651b71dc2af39a2a4017256213ee29c65cc4 F ext/wasm/api/sqlite3-api-glue.c-pp.js 79a54b54ca6324d28e31e19b56bbaebb7d2cc4b3079066e7e901333fa5047c53 F ext/wasm/api/sqlite3-api-oo1.c-pp.js 31dbfd470c91ffd96d77399b749bab6b69e3ba9074188833f97ac13f087cf07b F ext/wasm/api/sqlite3-api-prologue.js 68cf99ffc9742462323da3f3b207027472214727a750a952c6c10d53b11a3fa6 @@ -2167,8 +2167,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 4b4a6fbe20d51689e0abc65beed078bbb9418383e69eb8ec13f0657e2cf13bfd -R a6f298fbc5319b1727a975801ed91de9 +P d64c9cd4c7a1ffe04de6c75126563d7bbb24266e13d41406f6d55720b8199037 +R f06d7f34f6dadc86bcd344e9d449291d U stephan -Z 0eb231e00af475eb5c4cb9987cfaaed2 +Z 1decf52e01f67a53cd6c240f3ee45008 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 5ef1f8866d..db118e518d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d64c9cd4c7a1ffe04de6c75126563d7bbb24266e13d41406f6d55720b8199037 +8ff98747c072c8c333b1b37cf4ec9344e84f081bd4e6d3b5e75f37b1e1ce9e84 -- 2.47.3