diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c0926a8..ca7802b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # jsonld ChangeLog +## 8.3.3 - + +### Added +- Add `"react-native"` section to `package.json` and instructions on using + React Native in the README. + ## 8.3.2 - 2023-12-06 ### Fixed diff --git a/README.md b/README.md index 98299837..a7862a33 100644 --- a/README.md +++ b/README.md @@ -364,6 +364,17 @@ The `safe` options flag set to `true` enables this behavior: const expanded = await jsonld.expand(data, {safe: true}); ``` +### Using with React Native + +Using this library with React Native requires a polyfill such as +[`data-integrity-rn`](https://github.com/digitalcredentials/data-integrity-rn) +to be imported before this library: + +```js +import '@digitalcredentials/data-integrity-rn'; +import * as jsonld from 'jsonld'; +``` + Tests ----- diff --git a/package.json b/package.json index d1e84e37..7c55f7b6 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ }, "license": "BSD-3-Clause", "main": "lib/index.js", + "types": "types/index.d.ts", "files": [ "dist/*.js", "dist/*.js.map", @@ -29,10 +30,10 @@ "lib/**/*.js" ], "dependencies": { - "@digitalbazaar/http-client": "^3.4.1", + "@digitalbazaar/http-client": "^4.1.0", "canonicalize": "^1.0.1", "lru-cache": "^6.0.0", - "rdf-canonize": "^3.4.0" + "rdf-canonize": "^4.0.1" }, "devDependencies": { "@babel/core": "^7.21.8", @@ -122,5 +123,15 @@ "request": false, "url": false, "util": false + }, + "react-native": { + "./lib/index.js": "./lib/jsonld.js", + "./lib/platform.js": "./lib/platform-browser.js", + "crypto": false, + "http": false, + "jsonld-request": false, + "request": false, + "url": false, + "util": false } } diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 00000000..629d4542 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1 @@ +declare module 'jsonld';