Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add the fetch and more APIs to the JavaScript kit #169

Merged
merged 3 commits into from
Jul 6, 2023

Conversation

Angelmmiguel
Copy link
Contributor

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 and TextDecoder
  • A more complete Response implementation
  • Better error management

It 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 the kits/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:

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jul 4, 2023
@Angelmmiguel Angelmmiguel added this to the v1.4.0 milestone Jul 4, 2023
@Angelmmiguel Angelmmiguel requested a review from a team July 4, 2023 11:52
@Angelmmiguel Angelmmiguel self-assigned this Jul 4, 2023
@Angelmmiguel Angelmmiguel force-pushed the 165-add-fetch-to-js-kit branch 3 times, most recently from 68f91f0 to 0d501eb Compare July 4, 2023 14:57
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! A couple minor comments.

kits/javascript/src/error.rs Outdated Show resolved Hide resolved
@Angelmmiguel Angelmmiguel force-pushed the 165-add-fetch-to-js-kit branch from c51311f to 5023752 Compare July 6, 2023 07:02
@Angelmmiguel Angelmmiguel changed the base branch from 165-add-http-bindings to main July 6, 2023 07:02
@Angelmmiguel Angelmmiguel merged commit bcbf473 into main Jul 6, 2023
@Angelmmiguel Angelmmiguel deleted the 165-add-fetch-to-js-kit branch July 6, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants