feat: add the fetch and more APIs to the JavaScript kit #169
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.
This PR is built on top of #168. We will need to merge and rebase this branch before
The goal of this PR is to introduce more methods and common APIs to the JavaScript kit. It introduces the following APIs:
fetch
console
URLSearchParams
TextEncoder
andTextDecoder
Response
implementationIt refs #165
Building the shim
Before, the shim was a single
glue.js
file. All JavaScript code was hardcoded as we were not using any bundling system. To start using external libraries, I added esbuild, a fast bundler for JavaScript. The shim code is available in thekits/javascript/shims
folder and it contains all the files and references different external libraries.As part of the build process of the JS engine, it builds the shim and injects it in the final Wasm module.
External libraries
To avoid re-implementing all these APIs manually, we are using existing libraries: