Gathering detailed insights and metrics for react-native-polyfill-globals
Gathering detailed insights and metrics for react-native-polyfill-globals
Gathering detailed insights and metrics for react-native-polyfill-globals
Gathering detailed insights and metrics for react-native-polyfill-globals
web-encoding
TextEncoder and TextDecoder APIs from Encoding Standard APIs in a universal package
web-streams-polyfill
Web Streams, based on the WHATWG spec reference implementation
react-native-url-polyfill
A lightweight and trustworthy URL polyfill for React Native
eslint-plugin-react-native-globals
ESLint Environment for React Native
npm install react-native-polyfill-globals
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
45 Stars
44 Commits
4 Forks
3 Watching
1 Branches
1 Contributors
Updated on 29 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-6.4%
1,355
Compared to previous day
Last week
4.8%
8,192
Compared to previous week
Last month
23.2%
33,801
Compared to previous month
Last year
167.6%
255,119
Compared to previous year
6
20
Polyfills and patches missing or partially supported web and core APIs.
There are several APIs which React Native does not support. When available, they usally are not spec-conformant. This package aims to fill that gap by providing polyfills and patches to said APIs.
As of React Native v0.63.3:
URL
and URLSearchParams
are partially implemented.
FormData
is partially implemented
FileReader.readAsArrayBuffer
is not implemented
ReadableStream
is not supported and, by extension, Response.body
is not implemented. Related discussions:
btoa
and atob
are not supportedTextEncoder
and TextDecoder
are not supported1$ npm install react-native-polyfill-globals
Install the above as necessary.
FormData.set
Blob
s by FormData
FileReader.readAsArrayBuffer
URL
and URLSearchParams
provided by react-native-url-polyfillReadableStream
provided by web-streams-polyfillbtoa
and atob
provided by base-64TextEncoder
and TextDecoder
provided by text-encodingfetch
for text streaming provided by react-native-fetch-apicrypto.getRandomValues
provided by react-native-get-random-valuesImport the polyfill
function and call it whenever.
1import { polyfill } from 'react-native-polyfill-globals'; 2 3polyfill();
Add the following import to the top of your app's entry file, index.js
, located at the root of your project.
1import 'react-native-polyfill-globals/auto';
1import { polyfill as polyfillBase64 } from 'react-native-polyfill-globals/src/base64'; 2import { polyfill as polyfillEncoding } from 'react-native-polyfill-globals/src/encoding'; 3import { polyfill as polyfillReadableStream } from 'react-native-polyfill-globals/src/readable-stream'; 4import { polyfill as polyfillURL } from 'react-native-polyfill-globals/src/url'; 5import { polyfill as polyfillFetch } from 'react-native-polyfill-globals/src/fetch'; 6import { polyfill as polyfillCrypto } from 'react-native-polyfill-globals/src/crypto';
Patch files located at the patches directory provide additional polyfills and fixes.
Apply all at once with patch-package
:
1$ npm install -D patch-package 2$ npx patch-package --patch-dir node_modules/react-native-polyfill-globals/patches
Apply invidually with Git:
1$ git apply --ignore-whitespace node_modules/react-native-polyfill-globals/react-native+0.63.3.patch
Apply invidually with patch
:
1$ patch -p1 -i node_modules/react-native-polyfill-globals/react-native+0.63.3.patch
Note that Metro, React Native's bundler, at this time does not support tree-shaking nor dead code elimination. As such, beware that even if you apply polyfills selectively and don't use them at runtime, the code will be included in the production bundle regardless. If you don't need a given polyfill, do not import it at all.
MIT © André Costa Lima
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 4
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
63 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More