Skip to content

Commit 4c1afa0

Browse files
committed
Update dependencies and Node.js requirement.
- **BREAKING**: Remove Node.js 12 testing and support due to `ky-universal` use of top-level `await`. The core code should still otherwise function with older Node.js releases in this release but a custom document loader may be needed. - Update to `@digitalbazaar/http-client@3.1.0`. - Remove code to deal with accessing `response.data`.
1 parent 3f66c02 commit 4c1afa0

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
timeout-minutes: 10
99
strategy:
1010
matrix:
11-
node-version: [12.x, 14.x, 16.x]
11+
node-version: [14.x, 16.x]
1212
steps:
1313
- uses: actions/checkout@v2
1414
- name: Use Node.js ${{ matrix.node-version }}

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# jsonld ChangeLog
22

3-
## 5.3.0 - 2022-xx-xx
3+
## 6.0.0 - 2022-xx-xx
44

55
### Changed
6+
- **BREAKING**: Drop testing and support for Node.js 12.x. The majority of the
7+
code will still run on Node.js 12.x. However, the
8+
`@digitalbazaar/http-client@3` update uses a newer `ky-universal` which uses
9+
a top-level `await` that is unsupported in older Node.js versions. That
10+
causes the included `node` `documentLoader` to not function and tests to
11+
fail. If you wish to still use earlier Node.js versions, you may still be
12+
able to do so with your own custom `documentLoader`.
613
- Update to `@digitalbazaar/http-client@3`:
714
- Pulls in newer `ky` and `ky-universal` that should address security alerts
815
and provide other improvements.

lib/documentLoaders/node.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,7 @@ async function _fetch({url, headers, strictSSL, httpAgent, httpsAgent}) {
181181
}
182182
}
183183
const res = await httpClient.get(url, options);
184-
// @digitalbazaar/http-client may use node-fetch, which can output
185-
// a warning if response.data is accessed and no json was parsed.
186-
// Used here is the same type detection logic so the data field is
187-
// accessed only if the client likely tried to parse JSON.
188-
const contentType = res.headers.get('content-type');
189-
const hasJson = contentType && contentType.includes('json');
190-
return {res, body: hasJson ? res.data : null};
184+
return {res, body: res.data};
191185
} catch(e) {
192186
// HTTP errors have a response in them
193187
// ky considers redirects HTTP errors

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"lib/**/*.js"
3030
],
3131
"dependencies": {
32-
"@digitalbazaar/http-client": "^3.0.1",
32+
"@digitalbazaar/http-client": "^3.1.0",
3333
"canonicalize": "^1.0.1",
3434
"lru-cache": "^6.0.0",
3535
"rdf-canonize": "^3.0.0"
@@ -78,7 +78,7 @@
7878
"webpack-merge": "^5.7.3"
7979
},
8080
"engines": {
81-
"node": ">=12"
81+
"node": ">=14"
8282
},
8383
"keywords": [
8484
"JSON",

0 commit comments

Comments
 (0)