diff --git a/browser.js b/browser.js index 6f73765..65c3d6b 100644 --- a/browser.js +++ b/browser.js @@ -1,2 +1 @@ export {default} from 'ky'; -export * from 'ky'; diff --git a/index.d.ts b/index.d.ts index 6f73765..65c3d6b 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,2 +1 @@ export {default} from 'ky'; -export * from 'ky'; diff --git a/index.js b/index.js index e9527e1..84a47a9 100644 --- a/index.js +++ b/index.js @@ -1,16 +1,7 @@ 'use strict'; -const {URL, URLSearchParams} = require('url'); const fetch = require('node-fetch'); const AbortController = require('abort-controller'); -if (!global.URL) { - global.URL = URL; -} - -if (!global.URLSearchParams) { - global.URLSearchParams = URLSearchParams; -} - if (!global.fetch) { global.fetch = fetch; } @@ -31,13 +22,4 @@ if (!global.AbortController) { global.AbortController = AbortController; } -const { - default: ky, - HTTPError, - TimeoutError -} = require('ky/umd'); - -module.exports = ky; -module.exports.default = ky; -module.exports.HTTPError = HTTPError; -module.exports.TimeoutError = TimeoutError; +module.exports = require('ky/umd'); diff --git a/package.json b/package.json index f6ed252..7631e3c 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "description": "Use Ky in both Node.js and browsers", "license": "MIT", "repository": "sindresorhus/ky-universal", + "funding": "https://github.com/sindresorhus/ky-universal?sponsor=1", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", "url": "sindresorhus.com" }, "engines": { - "node": ">=8" + "node": ">=10" }, "scripts": { "test": "xo && ava" @@ -56,12 +57,12 @@ "node-fetch": "^2.6.0" }, "devDependencies": { - "ava": "^2.2.0", - "ky": "^0.12.0", - "xo": "^0.24.0" + "ava": "^2.4.0", + "ky": "^0.17.0", + "xo": "^0.25.3" }, "peerDependencies": { - "ky": ">=0.12.0" + "ky": ">=0.17.0" }, "browser": "browser.js", "ava": { diff --git a/readme.md b/readme.md index 68efded..a8d9742 100644 --- a/readme.md +++ b/readme.md @@ -15,7 +15,6 @@ Keep in mind that Ky targets [modern browsers](https://github.com/sindresorhus/k **If you only target Node.js, I would strongly recommend using [Got](https://github.com/sindresorhus/got) instead.** - ## Install ``` @@ -24,7 +23,6 @@ $ npm install ky ky-universal *Note that you also need to install `ky`.* - ## Usage ```js @@ -37,12 +35,10 @@ const ky = require('ky-universal'); })(); ``` - ## API The API is exactly the same as the [Ky API](https://github.com/sindresorhus/ky#api). - ## FAQ #### How do I use this with a web app (React, Vue.js, etc.) that uses server-side rendering (SSR)? @@ -77,7 +73,6 @@ Put the following in package.json: The library that uses Ky will now *just work* in AVA tests. - ## Related - [ky](https://github.com/sindresorhus/ky) - Tiny and elegant HTTP client based on the browser Fetch API