Skip to content

Commit

Permalink
bump deps. add corepack. bump yarn. remove react native bignumber.
Browse files Browse the repository at this point in the history
  • Loading branch information
shamilovtim committed Sep 16, 2024
1 parent 9192f46 commit 59692bc
Show file tree
Hide file tree
Showing 5 changed files with 7,892 additions and 6,575 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ local.properties
#
node_modules/
npm-debug.log
yarn-error.log

# yarn
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Bundle artifacts
*.jsbundle
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
34 changes: 16 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,27 @@ Don't use this package if:

## Polyfills

| Package | Description |
| ------------------------------------- | ---------------------------------------------------------------------------------------- |
| `react-native-bignumber` | Supply `bn.js` with C++ instead of JS |
| `@craftzdog/react-native-buffer` | Supply node `Buffer` with C++ |
| `react-native-blob-jsi-helper` | Supply `Blob` arrayBuffers with C++. |
| `blob-polyfill.ts` | Supply `Blob.stream()` with C++. Add Uint8Array support for `Blob.constructor()` with JS |
| `react-native-quick-crypto` | Supply the node `crypto` API with C++ OpenSSL |
| `@peculiar/webcrypto` | Supply the `crypto.subtle` webcrypto API with `react-native-quick-crypto` C++ OpenSSL |
| `event-target-polyfill` | Supply `new EventTarget()` with JS |
| `realistic-structured-clone` | Supply `global.structuredClone` with JS |
| `web-streams-polyfill` | Supply `ReadableStream` `WritableStream` with JS |
| `readable-stream` | Supply node `stream` with JS |
| `react-native-url-polyfill` | Supply the web & node `new URL()` API with JS |
| `text-encoding` | Supply `new TextDecoder()` with JS |
| `@azure/core-asynciterator-polyfill ` | Supply `AsyncIterator` with JS |
| Package | Description |
| ------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `@craftzdog/react-native-buffer` | Supply node `Buffer` with C++ |
| `react-native-blob-jsi-helper` | Supply `Blob` arrayBuffers with C++. |
| `blob-polyfill.ts` | Supply `Blob.stream()` and `Blob.arrayBuffer()`. Add Uint8Array support for `Blob.constructor()`. |
| `react-native-quick-crypto` | Supply the node `crypto` API with C++ OpenSSL |
| `@peculiar/webcrypto` | Supply the `crypto.subtle` webcrypto API with `react-native-quick-crypto` C++ OpenSSL |
| `event-target-polyfill` | Supply `new EventTarget()` with JS |
| `realistic-structured-clone` | Supply `global.structuredClone` with JS |
| `web-streams-polyfill` | Supply `ReadableStream` `WritableStream` with JS |
| `readable-stream` | Supply node `stream` with JS |
| `react-native-url-polyfill` | Supply the web & node `new URL()` API with JS |
| `text-encoding` | Supply `new TextDecoder()` with JS |
| `@azure/core-asynciterator-polyfill ` | Supply `AsyncIterator` with JS |

## Usage

Install this package along with the following peer packages:

```
yarn add @tbd54566975/web5-react-native-polyfills react-native-quick-crypto@^0.7.0-rc.2 @craftzdog/react-native-buffer react-native-bignumber react-native-blob-jsi-helper
yarn add @tbd54566975/web5-react-native-polyfills react-native-quick-crypto @craftzdog/react-native-buffer react-native-blob-jsi-helper
```

Add the following code to the top of your index.js entrypoint:
Expand All @@ -62,8 +61,7 @@ Add the following two entries inside the `plugins` key of your babel.config.js:
alias: {
crypto: "react-native-quick-crypto",
stream: "readable-stream",
buffer: "@craftzdog/react-native-buffer",
"bn.js": "react-native-bignumber",
buffer: "@craftzdog/react-native-buffer"
},
},
],
Expand Down
21 changes: 6 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "@tbd54566975/web5-react-native-polyfills",
"version": "2.0.0",
"packageManager": "yarn@4.2.2+sha256.1aa43a5304405be7a7cb9cb5de7b97de9c4e8ddd3273e4dad00d6ae3eb39f0ef",
"description": "An opinionated polyfill setup to enable web5 to work on react native",
"main": "lib/index.js",
"module": "lib/index.js",
Expand Down Expand Up @@ -35,8 +36,8 @@
"dependencies": {
"@azure/core-asynciterator-polyfill": "^1.0.2",
"@babel/plugin-proposal-private-methods": "^7.18.6",
"@noble/hashes": "^1.4.0",
"@peculiar/webcrypto": "^1.4.6",
"@noble/hashes": "^1.5.0",
"@peculiar/webcrypto": "^1.5.0",
"event-target-polyfill": "^0.0.4",
"react-native-blob-jsi-helper": "^0.3.1",
"react-native-url-polyfill": "^2.0.0",
Expand All @@ -49,24 +50,14 @@
"@craftzdog/react-native-buffer": "*",
"@web5/agent": "*",
"@web5/api": "*",
"@web5/common": "*",
"@web5/credentials": "*",
"@web5/crypto": "*",
"@web5/dids": "*",
"react-native-bignumber": "*",
"react-native-blob-jsi-helper": "*",
"react-native-quick-crypto": "*"
},
"peerDependenciesMeta": {
"react-native-bignumber": {
"optional": true
}
},
"devDependencies": {
"@types/react-native": "^0.73.0",
"prettier": "^3.2.5",
"release-it": "^17.2.1",
"typescript": "^5.3.3"
"prettier": "^3.3.3",
"release-it": "^17.6.0",
"typescript": "^5.6.2"
},
"release-it": {
"git": {
Expand Down
Loading

0 comments on commit 59692bc

Please sign in to comment.