feat: Provide an easily reusable Web SDK #2615
Merged
+14
−30
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Using the AssemblyScript compiler on the Web currently requires multiple steps to make it work, which includes manually updating the import map on version bumps and optionally providing a shim for import maps. Instead of providing a workaround by exposing the import map in a script plus longish instructions, this PR changes the mechanism to a single script that sets everything up.
Usage is
where
latest
can be any version since the change, and additional query parameters can be used to modify behavior:web.js?noinstall
does not install the import mapweb.js?noshim
does not install the import map shim,
Regardless of the parameters used, the following global variables are always available:
ASSEMBLYSCRIPT_VERSION
containing the current compiler versionASSEMBLYSCRIPT_IMPORTMAP
containing the import map, which includes all relevant versions in the URLsRemoves the
web.html
andimportmap.js
artifacts, withimportmap.json
(for documentation) andweb.js
remaining. Reverts e1a5fce.