From 7caf975812a3e2207ff6869a7d664bcf4afab963 Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Thu, 10 Aug 2023 22:30:49 -0400 Subject: [PATCH 1/5] Add react-native section to package.json --- CHANGELOG.md | 6 ++++++ README.md | 11 +++++++++++ package.json | 14 ++++++++++++-- 3 files changed, 29 insertions(+), 2 deletions(-) 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..71471a48 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 the +[`data-integrity-rn`](https://github.com/digitalcredentials/data-integrity-rn) +polyfill 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..3eb90e3d 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,10 @@ "lib/**/*.js" ], "dependencies": { - "@digitalbazaar/http-client": "^3.4.1", + "@digitalbazaar/http-client": "digitalcredentials/http-client#react-native", "canonicalize": "^1.0.1", "lru-cache": "^6.0.0", - "rdf-canonize": "^3.4.0" + "rdf-canonize": "digitalcredentials/rdf-canonize#react-native" }, "devDependencies": { "@babel/core": "^7.21.8", @@ -122,5 +122,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 } } From 7d05ccb5a93a26de2ffc0d96bc93b351f551973f Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Thu, 10 Aug 2023 23:15:16 -0400 Subject: [PATCH 2/5] Add a basic type definition for TypeScript. --- package.json | 1 + types/index.d.ts | 1 + 2 files changed, 2 insertions(+) create mode 100644 types/index.d.ts diff --git a/package.json b/package.json index 3eb90e3d..bbd1c670 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", 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'; From 9340284f3ba9f78e51ab41c5fa275f0b310b3c67 Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Fri, 29 Dec 2023 18:24:04 -0500 Subject: [PATCH 3/5] Update to published rdf-canonize version. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bbd1c670..50f4edd6 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "@digitalbazaar/http-client": "digitalcredentials/http-client#react-native", "canonicalize": "^1.0.1", "lru-cache": "^6.0.0", - "rdf-canonize": "digitalcredentials/rdf-canonize#react-native" + "rdf-canonize": "^4.0.1" }, "devDependencies": { "@babel/core": "^7.21.8", From bd780dab690bf5715d420d1b74ff789b71cc921f Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Fri, 29 Dec 2023 18:29:24 -0500 Subject: [PATCH 4/5] Fix polyfill wording. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71471a48..a7862a33 100644 --- a/README.md +++ b/README.md @@ -366,9 +366,9 @@ const expanded = await jsonld.expand(data, {safe: true}); ### Using with React Native -Using this library with React Native requires the +Using this library with React Native requires a polyfill such as [`data-integrity-rn`](https://github.com/digitalcredentials/data-integrity-rn) -polyfill to be imported before this library: +to be imported before this library: ```js import '@digitalcredentials/data-integrity-rn'; From af8e82a1b505c8cf329e92d50fd32afc3c3c387b Mon Sep 17 00:00:00 2001 From: Dmitri Zagidulin Date: Fri, 26 Jan 2024 20:39:21 -0500 Subject: [PATCH 5/5] Update to latest published http-client package. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 50f4edd6..7c55f7b6 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "lib/**/*.js" ], "dependencies": { - "@digitalbazaar/http-client": "digitalcredentials/http-client#react-native", + "@digitalbazaar/http-client": "^4.1.0", "canonicalize": "^1.0.1", "lru-cache": "^6.0.0", "rdf-canonize": "^4.0.1"