native-fetch
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -0,1 +1,10 @@ | ||
# [3.0.0](https://github.com/achingbrain/native-fetch/compare/v2.0.1...v3.0.0) (2021-02-03) | ||
### Features | ||
* add types ([#2](https://github.com/achingbrain/native-fetch/issues/2)) ([12a35d7](https://github.com/achingbrain/native-fetch/commit/12a35d796745a2a1868a94c668a160fd623aa5dd)) | ||
<a name="2.0.1"></a> | ||
@@ -2,0 +11,0 @@ ## [2.0.1](https://github.com/achingbrain/native-fetch/compare/v2.0.0...v2.0.1) (2020-10-06) |
{ | ||
"name": "native-fetch", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "Returns native fetch if available or the node-fetch module if not", | ||
"main": "src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"files": [ | ||
"src", | ||
"dist" | ||
], | ||
"scripts": { | ||
"test": "aegir test -t node -t browser -t webworker -t electron-main -t electron-renderer", | ||
"lint": "aegir lint", | ||
"lint": "aegir lint && aegir ts -p check", | ||
"prepare": "aegir build --no-bundle", | ||
"release": "aegir release --docs false", | ||
@@ -19,5 +25,2 @@ "release-minor": "aegir release --type minor --docs false", | ||
}, | ||
"dependencies": { | ||
"globalthis": "^1.0.1" | ||
}, | ||
"peerDependencies": { | ||
@@ -27,4 +30,5 @@ "node-fetch": "*" | ||
"devDependencies": { | ||
"node-fetch": "^2.6.0", | ||
"aegir": "^26.0.0" | ||
"@types/node-fetch": "^2.5.8", | ||
"aegir": "^30.3.0", | ||
"node-fetch": "^2.6.0" | ||
}, | ||
@@ -31,0 +35,0 @@ "contributors": [ |
@@ -5,3 +5,3 @@ # native-fetch | ||
A drop-in replacement for the `node-fetch` module that returns the native fetch if available or the polyfill if not. | ||
An (almost) drop-in replacement for the `node-fetch` module that returns the native fetch if available or the polyfill if not. | ||
@@ -25,3 +25,3 @@ ### Why? | ||
```javascript | ||
const fetch = require('native-fetch') | ||
const { default: fetch } = require('native-fetch') | ||
@@ -28,0 +28,0 @@ fetch('https://github.com/') |
'use strict' | ||
const globalThis = require('globalthis')() | ||
if (globalThis.fetch && globalThis.Headers && globalThis.Request && globalThis.Response) { | ||
module.exports = function fetch (...args) { | ||
return globalThis.fetch(...args) | ||
module.exports = { | ||
default: globalThis.fetch, | ||
Headers: globalThis.Headers, | ||
Request: globalThis.Request, | ||
Response: globalThis.Response | ||
} | ||
module.exports.Headers = globalThis.Headers | ||
module.exports.Request = globalThis.Request | ||
module.exports.Response = globalThis.Response | ||
module.exports.default = module.exports | ||
} else { | ||
module.exports = require('node-fetch') | ||
module.exports = { | ||
default: require('node-fetch').default, | ||
Headers: require('node-fetch').Headers, | ||
Request: require('node-fetch').Request, | ||
Response: require('node-fetch').Response | ||
} | ||
} |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
1
6
0
4134
3
123600
39
- Removedglobalthis@^1.0.1
- Removeddefine-data-property@1.1.4(transitive)
- Removeddefine-properties@1.2.1(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedglobalthis@1.0.4(transitive)
- Removedgopd@1.0.1(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhasown@2.0.2(transitive)
- Removedobject-keys@1.1.1(transitive)