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

[DRAFT] Custom Event & File Polyfills #865

Closed

Conversation

seanmorris
Copy link
Contributor

@seanmorris seanmorris commented Dec 12, 2023

[DRAFT]

What is this PR doing?

What problem is it solving?

How is the problem addressed?

Testing Instructions

@seanmorris seanmorris changed the title [DRAFT ] Custom Event & File Polyfills [DRAFT] Custom Event & File Polyfills Dec 12, 2023
@seanmorris seanmorris changed the title [DRAFT] Custom Event & File Polyfills Custom Event & File Polyfills Dec 13, 2023
@seanmorris seanmorris changed the title Custom Event & File Polyfills [DRAFT] Custom Event & File Polyfills Dec 13, 2023
adamziel added a commit that referenced this pull request Dec 19, 2023
Adds a new `@php-wasm/node-polyfills` package to polyfill the features
missing in Node 18 and/or JSDOM environments. The goal is to make wp-now
and other Playground-based Node.js packages work in Node 18, which is
the current LTS release.

The polyfilled JavaScript features are:

* `CustomEvent` class
* `File` class
* `Blob.text()` and `Blob.arrayBuffer()` methods
* `Blob.arrayBuffer()` and `File.text()` methods
* `Blob.stream()` and `File.stream()` methods
* Ensures `File.stream().getReader({ mode: 'byob' })` is supported –
this is relevant for #851

I adapted the Blob methods from
https://github.com/bjornstar/blob-polyfill/blob/master/Blob.js as they
seemed to provide just the logic needed here and they also worked right
away.

This PR is a part of
#851 split out
into a separate PR to make it easier to review and reason about.

Supersedes #865

## Testing instructions

Confirm the unit tests pass. This PR ships a set of vite tests to
confirm the polyfills work both in vanilla Node.js and in jsdom runtime
environments.
@adamziel
Copy link
Collaborator

Superseded by #875

@adamziel adamziel closed this Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants