Skip to content

Commit

Permalink
chore: update native fetch
Browse files Browse the repository at this point in the history
Similar to #93, updates `native-fetch` and removes vendored filed.

I get a TS error when trying to generate types though, might have to
wait until TS 4.2:

```
> [email protected] prepare /Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils
> aegir build --no-bundle

/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:87003
                throw e;
                ^

TypeError: Cannot read property 'kind' of undefined
    at getRootDeclaration (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:12609:21)
    at Object.isCatchClauseVariableDeclarationOrBindingElement (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:10439:20)
    at getTypeOfVariableOrParameterOrPropertyWorker (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:41796:20)
    at getTypeOfVariableOrParameterOrProperty (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:41775:28)
    at getTypeOfSymbol (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:42079:24)
    at getTypeOfAlias (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:42025:23)
    at getTypeOfSymbol (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:42091:24)
    at checkIdentifier (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:53527:49)
    at checkExpressionWorker (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:59973:28)
    at checkExpression (/Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/node_modules/typescript/lib/tsc.js:59928:38)
Command failed with exit code 1: tsc --build /Users/alex/Documents/Workspaces/ipfs/js-ipfs-utils/tsconfig-types.aegir.json
```
  • Loading branch information
achingbrain committed Feb 3, 2021
1 parent 4ccbc5c commit 600e2c4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 121 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"merge-options": "^3.0.4",
"nanoid": "^3.1.20",
"native-abort-controller": "0.0.3",
"native-fetch": "2.0.1",
"native-fetch": "^3.0.0",
"node-fetch": "^2.6.1",
"stream-to-it": "^0.2.2",
"web-encoding": "^1.0.6"
Expand Down
2 changes: 1 addition & 1 deletion src/http.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-undef */
'use strict'

const { fetch, Request, Headers } = require('./http/fetch')
const { default: fetch, Request, Headers } = require('./http/fetch')
const { TimeoutError, HTTPError } = require('./http/error')
const merge = require('merge-options').bind({ ignoreUndefined: true })
const { URL, URLSearchParams } = require('iso-url')
Expand Down
2 changes: 1 addition & 1 deletion src/http/fetch.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class ResponseWithURL extends Response {
}

module.exports = {
fetch: fetchWith,
default: fetchWith,
Request,
Headers,
ResponseWithURL
Expand Down
2 changes: 1 addition & 1 deletion src/http/fetch.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const iterateBodyWithProgress = async function * (body, onUploadProgress) {
}

module.exports = {
fetch,
default: fetch,
Request,
Headers
}
117 changes: 0 additions & 117 deletions types/native-fetch/index.d.ts

This file was deleted.

0 comments on commit 600e2c4

Please sign in to comment.