From: stephan Date: Sun, 29 Jan 2023 05:09:39 +0000 (+0000) Subject: Correct the handling of the worker1 and promiser JS files in the face of the bundler... X-Git-Tag: version-3.41.0~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f5330036d19b0dcbf82f7a29c6192ce7ca9df93;p=thirdparty%2Fsqlite.git Correct the handling of the worker1 and promiser JS files in the face of the bundler-friendly changes. Those files require separate, bundler-friendly copies. FossilOrigin-Name: 9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 --- diff --git a/ext/wasm/GNUmakefile b/ext/wasm/GNUmakefile index 92173e79f1..7ffd866f24 100644 --- a/ext/wasm/GNUmakefile +++ b/ext/wasm/GNUmakefile @@ -327,8 +327,6 @@ sqlite3-api.jses += $(dir.api)/sqlite3-api-cleanup.js # "External" API files which are part of our distribution # but not part of the sqlite3-api.js amalgamation. SOAP.js := $(dir.api)/sqlite3-opfs-async-proxy.js -sqlite3-worker1.js := $(dir.api)/sqlite3-worker1.js -sqlite3-worker1-promiser.js := $(dir.api)/sqlite3-worker1-promiser.js # COPY_XAPI = a $(call)able function to copy $1 to $(dir.dout), where # $1 must be one of the "external" JS API files. define COPY_XAPI @@ -336,7 +334,7 @@ sqlite3-api.ext.jses += $$(dir.dout)/$$(notdir $(1)) $$(dir.dout)/$$(notdir $(1)): $(1) $$(MAKEFILE) cp $$< $$@ endef -$(foreach X,$(SOAP.js) $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js),\ +$(foreach X,$(SOAP.js),\ $(eval $(call COPY_XAPI,$(X)))) all quick: $(sqlite3-api.ext.jses) q: quick @@ -715,6 +713,29 @@ $(sqlite3.mjs): $(sqlite3.js) $(sqlite3-bundler-friendly.mjs): $(sqlite3.mjs) CLEAN_FILES += $(sqlite3.wasm) +######################################################################## +# We need separate copies of certain supplementary JS files for the +# bundler-friendly build. Concretely, any supplemental JS files which +# themselves use importScripts() or Workers or URL() constructors +# which refer to other in-tree (m)JS files quire a bundler-friendly +# copy. +sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js +sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js +sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js +sqlite3-worker1-promiser.js := $(dir.dout)/sqlite3-worker1-promiser.js +sqlite3-worker1-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-bundler-friendly.js +sqlite3-worker1-promiser-bundler-friendly.js := $(dir.dout)/sqlite3-worker1-promiser-bundler-friendly.js +$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1.js))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1.js.in),$(sqlite3-worker1-bundler-friendly.js),\ + $(c-pp.D.bundler-friendly))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),$(sqlite3-worker1-promiser.js))) +$(eval $(call C-PP.FILTER,$(sqlite3-worker1-promiser.js.in),\ + $(sqlite3-worker1-promiser-bundler-friendly.js),\ + $(c-pp.D.bundler-friendly))) +$(sqlite3-bundler-friendly.mjs): $(sqlite3-worker1-bundler-friendly.js) \ + $(sqlite3-worker1-promiser-bundler-friendly.js) +$(sqlite3.js) $(sqlite3.mjs): $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) + ######################################################################## # batch-runner.js is part of one of the test apps which reads in SQL # dumps generated by $(speedtest1) and executes them. diff --git a/ext/wasm/README-dist.txt b/ext/wasm/README-dist.txt index db0862628b..6656a2072a 100644 --- a/ext/wasm/README-dist.txt +++ b/ext/wasm/README-dist.txt @@ -11,9 +11,12 @@ build: - jswasm/sqlite3.mjs is the same but in ES6 module form -- jswasm/sqlite3-bundler-friendly.mjs is the same as the ES6 module - with small tweaks to make it compatible with "bundler" tools - commonly seen in node.js-based projects. +- jswasm/*-bundler-friendly.js and .mjs are variants which are + intended to be compatible with "bundler" tools commonly seen in + node.js-based projects. Projects using such tools should use those + variants, where available, instead of files without the + "-bundler-friendly" suffix. Some files do not have separate + variants. - jswasm/sqlite3.wasm is the binary WASM file imported by all of the above-listed JS files. diff --git a/ext/wasm/dist.make b/ext/wasm/dist.make index ffc2613703..d2fa920be7 100644 --- a/ext/wasm/dist.make +++ b/ext/wasm/dist.make @@ -56,6 +56,18 @@ dist.common.extras := \ $(dir.common)/SqliteTestUtil.js .PHONY: dist snapshot +define DIST_STRIP_COMMENTS +# $1 = source js file +# $2 = flags for $(bin.stripcomments) +$(bin.stripccomments) $(2) < $(1) > $(dist-dir.jswasm)/$(notdir $(1)); +endef +# STRIP_K1.js = list of JS files which need to be passed through +# $(bin.stripcomments) with a single -k flag. +STRIP_K1.js := $(sqlite3-worker1.js) $(sqlite3-worker1-promiser.js) \ + $(sqlite3-worker1-bundler-friendly.js) $(sqlite3-worker1-promiser-bundler-friendly.js) +# STRIP_K2.js = list of JS files which need to be passed through +# $(bin.stripcomments) with two -k flags. +STRIP_K2.js := $(sqlite3.js) $(sqlite3.mjs) $(sqlite3-bundler-friendly.mjs) ######################################################################## # dist: create the end-user deliverable archive. # @@ -71,7 +83,7 @@ dist.common.extras := \ # target name equal to the archive name. dist: \ $(bin.stripccomments) $(bin.version-info) \ - $(dist.build) \ + $(dist.build) $(STRIP_K1.js) $(STRIP_K2.js) \ $(MAKEFILE) $(MAKEFILE.dist) @echo "Making end-user deliverables..." @rm -fr $(dist-dir.top) @@ -80,12 +92,8 @@ dist: \ @cp -p README-dist.txt $(dist-dir.top)/README.txt @cp -p index-dist.html $(dist-dir.top)/index.html @cp -p $(dist.jswasm.extras) $(dist-dir.jswasm) - @$(bin.stripccomments) -k -k < $(sqlite3.js) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3.js)) - @$(bin.stripccomments) -k -k < $(sqlite3.mjs) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3.mjs)) - @$(bin.stripccomments) -k -k < $(sqlite3-bundler-friendly.mjs) \ - > $(dist-dir.jswasm)/$(notdir $(sqlite3-bundler-friendly.mjs)) + $(foreach JS,$(STRIP_K1.js),$(call DIST_STRIP_COMMENTS,$(JS),-k)) + $(foreach JS,$(STRIP_K2.js),$(call DIST_STRIP_COMMENTS,$(JS),-k -k)) @cp -p $(dist.common.extras) $(dist-dir.common) @set -e; \ vnum=$$($(bin.version-info) --download-version); \ diff --git a/ext/wasm/index.html b/ext/wasm/index.html index 767cc5e74a..969d9553eb 100644 --- a/ext/wasm/index.html +++ b/ext/wasm/index.html @@ -131,7 +131,7 @@ diff --git a/manifest b/manifest index 99b0ff4c5e..6275e3d92e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\sassume\sthat\ssub-queries\sthat\scontain\swindow\sfunctions\sare\suncorrelated. -D 2023-01-28T21:06:15.825 +C Correct\sthe\shandling\sof\sthe\sworker1\sand\spromiser\sJS\sfiles\sin\sthe\sface\sof\sthe\sbundler-friendly\schanges.\sThose\sfiles\srequire\sseparate,\sbundler-friendly\scopies. +D 2023-01-29T05:09:39.456 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -466,8 +466,8 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3 F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04 F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c -F ext/wasm/GNUmakefile 6fee35e99b82c948a1a4675bb4d1d037800c2171274bd8ab3779fac53aca6d1a -F ext/wasm/README-dist.txt 4a1db3677d0341a12434d1fd6c97aae2f96785d734641407a201b719f5d94f44 +F ext/wasm/GNUmakefile 5418b4702f4ad0f2162a7e0d128042e8d9219827e3d36978bd2dd6e26ce8f68e +F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576 F ext/wasm/README.md ef39861aa21632fdbca0bdd469f78f0096f6449a720f3f39642594af503030e9 F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api d6a5078f48a5301ed17b9a30331075d9b2506e1360c1f0dee0c7816c10acd9ab F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287 @@ -506,14 +506,14 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98 F ext/wasm/demo-worker1-promiser.js b99c550763fa792c204e9a7cceadd976004036d9fc3e22fab7051712e30d207d F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d F ext/wasm/demo-worker1.js a619adffc98b75b66c633b00f747b856449a134a9a0357909287d80a182d70fa -F ext/wasm/dist.make b50668a4f79d4464a59c3378b6b53968bb0652a06737b1e0b07544458de28f3d +F ext/wasm/dist.make 836176877b8d4ae1d4217dcc1f3c057c7d7c5546df012532b9f5ff83061b24fd F ext/wasm/fiddle.make d5308b5c35f691758ef20badd25f91f3780b20415760daf0d98afbe4f24921b9 F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f F ext/wasm/fiddle/fiddle-worker.js b4a0c8ab6c0983218543ca771c45f6075449f63a1dcf290ae5a681b2cba8800d F ext/wasm/fiddle/fiddle.js 974b995119ac443685d7d94d3b3c58c6a36540e9eb3fed7069d5653284071715 F ext/wasm/fiddle/index.html 5daf54e8f3d7777cbb1ca4f93affe28858dbfff25841cb4ab81d694efed28ec2 F ext/wasm/index-dist.html c806b6005145b71d64240606e9c6e0bf56878ee8829c66fe7486cebf34b0e6b1 -F ext/wasm/index.html cc8b174ff01be282b399e64b58bdf3c921d7020da5d4e22e88bbbb4a6787a209 +F ext/wasm/index.html 6b7139e64eef500aee9315deac5e4ac84ef31453aaf053b794bb0505859dcde5 F ext/wasm/jaccwabyt/jaccwabyt.js 06f2ef1ad640c26c593def3d960336e9bb789819b920516480895c38ed5f58fa F ext/wasm/jaccwabyt/jaccwabyt.md 37911f00db12cbcca73aa1ed72594430365f30aafae2fa9c886961de74e5e0eb F ext/wasm/module-symbols.html 841de62fc198988b8330e238c260e70ec93028b096e1a1234db31b187a899d10 @@ -2045,8 +2045,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 3d05dddd0bc826a73a8cecd6b116168082fb46b6e4868d03438c0a5a546d2f97 -R 15c7aa257d7f9f8322c2cff93b9d4aee -U dan -Z b5cdea142483e57c2a66955139fc295d +P f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac +R 667e12e7399fd0840589fd5b12faf9a7 +U stephan +Z 6f0092c7605698427bc685848784d5f5 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index b782372af7..6a5ce342cf 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f27804484df57de76be9dbd1a9e5869916617684ee407101c978df7da30b34ac \ No newline at end of file +9062b31174618c0e67e86441e14eac420c734a0cc321f7eebc7d89ff8a449c10 \ No newline at end of file