Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

Conversation

dstaley
Copy link
Member

@dstaley dstaley commented Mar 3, 2020

This PR modifies the Rollup configuration to emit a Node bundle that replaces calls to browser-specific APIs with polyfilled versions. This is accomplished using @rollup/plugin-inject which replaces usage in the global scope with an import statement to the polyfill. This PR polyfills fetch, Headers, FormData, atob, and Blob. The Blob polyfill is provided by the blob.js file included at the root of the repo.

The third-party polyfills are marked as external, meaning they aren't included in the Node bundle, and need to be installed by consumers. They're marked as optional peerDependencies, which allows consumers to use any version of the polyfills newer or equal to the latest version at the time of this PR. Instructions are included in the README.

I've also bumped up the minimum Node version to v10. This enables us to ship ES2018 syntax and APIs to Node.

This PR also contains the changes originally included in #609

Fixes #683, fixes #526, fixes #470

@dstaley dstaley requested a review from leplatrem March 3, 2020 07:28
@dstaley dstaley mentioned this pull request Mar 3, 2020
This is necessary to keep checks green while we wait for Prettier to
support TypeScript 3.8 syntax.
@dstaley
Copy link
Member Author

dstaley commented Mar 4, 2020

@leplatrem So it looks like Prettier currently doesn't support the new TypeScript 3.8 syntax prettier/prettier#7263

I've added a temporary .prettierignore file ignoring index.ts until they get things sorted. I've subscribed to the issue, so as soon as it's fixed and a release is made I'll remove it.

Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

👍

@dstaley dstaley merged commit e158a9a into master Mar 5, 2020
@dstaley dstaley deleted the ds/node-polyfills branch March 5, 2020 06:02
@dstaley
Copy link
Member Author

dstaley commented Mar 5, 2020

@leplatrem Can you add me as a package maintainer for kinto-http.js on npm so that I can publish an alpha version? That's one of the things blocking Kinto/kinto.js#1172

@leplatrem
Copy link
Contributor

Done!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants