From: stephan Date: Tue, 21 Apr 2026 10:19:38 +0000 (+0000) Subject: Reformulate how the OPFS async proxy Worker is loaded for the bundler-friendly builds... X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=d3abfd77f5cfe9f38b2810933fd8f720ad01256b;p=thirdparty%2Fsqlite.git Reformulate how the OPFS async proxy Worker is loaded for the bundler-friendly builds to work around a bug in Vite in which it incompatibly rewrites the Worker's URL arguments. Addresses the discussion at [https://github.com/sqlite/sqlite-wasm/pull/159|npm package PR 159] and patch validated by Jure Rotar. FossilOrigin-Name: ec877a30f5c5db30b9154745140744c5cc80d89673d79e50901d7377599cf2b4 --- diff --git a/ext/wasm/api/opfs-common-shared.c-pp.js b/ext/wasm/api/opfs-common-shared.c-pp.js index 24ae2632fb..6316fd1a22 100644 --- a/ext/wasm/api/opfs-common-shared.c-pp.js +++ b/ext/wasm/api/opfs-common-shared.c-pp.js @@ -1099,20 +1099,21 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){ return promiseResolve_(sqlite3); }; const options = opfsUtil.options; - let proxyUri = options.proxyUri +( +//#if not target:es6-bundler-friendly + const proxyUri = options.proxyUri +( (options.proxyUri.indexOf('?')<0) ? '?' : '&' )+'vfs='+vfsName; //sqlite3.config.error("proxyUri",options.proxyUri, (new Error())); +//#/if const W = opfsVfs.worker = //#if target:es6-bundler-friendly (()=>{ /* _Sigh_... */ - switch(vfsName){ - case 'opfs': - return new Worker(new URL("sqlite3-opfs-async-proxy.js?vfs=opfs", import.meta.url)); - case 'opfs-wl': - return new Worker(new URL("sqlite3-opfs-async-proxy.js?vfs=opfs-wl", import.meta.url)); - } + /* Discussion explaining this formulation: + https://github.com/sqlite/sqlite-wasm/pull/159 */ + const url = new URL('sqlite3-opfs-async-proxy.js', import.meta.url); + url.searchParams.set('vfs', vfsName); + return new Worker(url.toString()); })(); //#elif target:es6-module new Worker(new URL(proxyUri, import.meta.url)); diff --git a/manifest b/manifest index bcb63af81e..914aa43df2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\sfileio\sextension\sfor\sWindows\sbuilds\sso\sthat\sit\sdoes\snot\sdepend\son\nthe\ssqlite3_win32_utf8_to_unicode()\sand\ssqlite3_win32_unicode_to_utf()\nroutines\sthat\sare\sfound\sin\sthe\sSQLite\score.\n[forum:/forumpost/2026-04-20T02:02:56Z|Forum\spost\s2026-04-20T02:02:56Z]. -D 2026-04-20T10:28:19.110 +C Reformulate\show\sthe\sOPFS\sasync\sproxy\sWorker\sis\sloaded\sfor\sthe\sbundler-friendly\sbuilds\sto\swork\saround\sa\sbug\sin\sVite\sin\swhich\sit\sincompatibly\srewrites\sthe\sWorker's\sURL\sarguments.\sAddresses\sthe\sdiscussion\sat\s[https://github.com/sqlite/sqlite-wasm/pull/159|npm\spackage\sPR\s159]\sand\spatch\svalidated\sby\sJure\sRotar. +D 2026-04-21T10:19:38.102 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -588,7 +588,7 @@ F ext/wasm/api/README.md a905d5c6bfc3e2df875bd391d6d6b7b48d41b43bdee02ad115b4724 F ext/wasm/api/extern-post-js.c-pp.js 80accc53cc6ea1e61c721595f42ba95baa7c7ea636807d9507e69403301f8c54 F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41 F ext/wasm/api/opfs-common-inline.c-pp.js 496ca858af09b7fef2efaece467960611d35f57254078424bcdeac42ded9e85d -F ext/wasm/api/opfs-common-shared.c-pp.js d0bff21d34fa05a7eb975c4ee608165f96387332101cb05e976953c77434374d +F ext/wasm/api/opfs-common-shared.c-pp.js 5b5880ced26977931a4fb33aafc6c71206fbee519e82abf9614898d8fa5ec241 F ext/wasm/api/post-js-footer.js a50c1a2c4d008aede7b2aa1f18891a7ee71437c2f415b8aeb3db237ddce2935b F ext/wasm/api/post-js-header.js f35d2dcf1ab7f22a93d565f8e0b622a2934fc4e743edf3b708e4dd8140eeff55 F ext/wasm/api/pre-js.c-pp.js d6bf82f83f60caa2904bddb95a29cb738b310f672d2796cdc5fe54463ab0d6cd @@ -2202,8 +2202,9 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 13f0fd1daaf787bff6eded4a01c2cf47c79e52cf8812bb344995e28c015a4ed1 -R 31831ad7feed5c76e5222e938d48ee50 -U drh -Z c300dd262e9088f424ba1d42dfc17467 +P fe0414a9a3caf6af67f53a5f3534efd5d4bf4978ebce1c591ef62d6961e55701 +Q +6215c9dd27ca446bf61d8ee7adcf455d35914853b19cb5f5feff5ce0f420e7b7 +R 55a624a182f8d583a740389ab62a7c54 +U stephan +Z 38cca26b2ca2f0ce38c99a4ddf10f846 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9e1826c686..af013493a6 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fe0414a9a3caf6af67f53a5f3534efd5d4bf4978ebce1c591ef62d6961e55701 +ec877a30f5c5db30b9154745140744c5cc80d89673d79e50901d7377599cf2b4