Commit Graph

639 Commits

Author SHA1 Message Date
Richie Bendall d15476bb5d
Compile CJS modules as a seperate set of files (#778)
* Switch to seperate babel compilation

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* resolve merge conflict

* add missing devDependency

* fix wrong name

* Specify ES version under `module` property and specify `sideEffects`

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
2020-04-14 13:03:24 +02:00
Max Dumas 736baf300b
fix: Import URL and URLSearchParams in typings (#761)
This change adds an explicit import for the URL and URLSearchParams typings from the Node standard library `'url'` module.

This was needed to prevent the TypeScript compiler from issuing errors when compiling against targets where URL and URLSearchParams are not ambiently available.

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
2020-04-14 12:20:02 +02:00
Antoni Kepinski 766204fede
update coverage badge 2020-04-14 12:03:27 +02:00
Antoni Kepinski 8f3c540794
fix coverage report & update scripts 2020-04-14 11:59:32 +02:00
Antoni Kepinski 5ecb48eec6
add @pika/plugin-build-node to @pika/pack pipeline 2020-04-13 16:48:21 +02:00
Saksama Terminal 33532c29e0
fix: Ensure search parameters are included in URL path (#759)
* fix search params missing from url path

* fix search params missing from url path

* Trigger travis ci

Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
2020-04-13 16:23:26 +02:00
Antoni Kepinski b1bd179891
update dependencies 2020-04-13 13:42:53 +02:00
Antoni Kepinski 55b6004581
lint 2020-04-13 13:42:35 +02:00
Richie Bendall bb9c96de80
Fix indention
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-04-04 17:07:01 +13:00
Antoni Kepinski c167190c6e
revert fix: Properly export fetch 2020-03-28 19:03:23 +01:00
Antoni Kepinski 48a9886fc5
update dependencies 2020-03-28 19:03:13 +01:00
Richie Bendall 7c66f9ce82
fix: Properly export fetch
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-03-14 23:08:36 +13:00
Richie Bendall d75bed0da1
chore: Correctly import typings
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-03-14 11:07:56 +13:00
Richie Bendall b44c29521d
chore: Remove unneeded build stages
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-03-14 11:06:13 +13:00
Richie Bendall 62b5f2cc86
chore: Reference the correct file
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-03-14 10:54:40 +13:00
Richie Bendall 9e1302ea98
chore: Fix publishing
Signed-off-by: Richie Bendall <richiebendall@gmail.com>
2020-03-14 09:59:54 +13:00
David Frank 6f2a5efbb6
Fix package.json (#746)
* fix main and remove module export

* fix types export

* 3.0.0-beta.2

* we no longer need main export in package.json, the actual export will live under dist/ folder

* adding version script per pika
2020-03-14 03:00:26 +08:00
Antoni Kepinski e59db18432
Lint example code 2020-03-13 18:01:45 +01:00
Antoni Kepinski 3c3558e259
Update README.md 2020-03-13 17:56:12 +01:00
Antoni Kepinski 93cb0e77df
typo 2020-03-13 17:25:14 +01:00
Antoni Kepinski 47d579249e
Change release name to `3.0.0-beta.1`, remove unnecessary comment 2020-03-13 17:22:39 +01:00
Antoni Kepinski fcdf3d13a4
typo 2020-03-13 17:20:08 +01:00
David Frank 0959ca9739
merge 3.x into master branch (#745)
* feat: Migrate TypeScript types (#669)

* style: Introduce linting via XO

* fix: Fix tests

* chore!: Drop support for nodejs 4 and 6

* chore: Fix Travis CI yml

* Use old Babel (needs migration)

* chore: lint everything

* chore: Migrate to microbundle

* Default response.statusText should be blank (#578)

* fix: Use correct AbortionError message

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Use modern @babel/register

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Remove redundant packages

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Readd form-data

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* fix: Fix tests and force utf8-encoded urls

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* lint index.js

* Update devDependencies & ignore `test` directory in linter options

* Remove unnecessary eslint-ignore comment

* Update the `lint` script to run linter on every file

* Remove unused const & unnecessary import

* TypeScript: Fix Body.blob() wrong type (DefinitelyTyped/DefinitelyTyped#33721)

* chore: Lint as part of the build process

* fix: Convert Content-Encoding to lowercase (#672)

* fix: Better object checks (#673)

* Fix stream piping (#670)

* chore: Remove useless check

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* style: Fix lint

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* style: Fix lint

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* refactor: Modernise code

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Ensure all files are properly included

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Update deps and utf8 should be in dependencies

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* test: Drop Node v4 from tests

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* test: Modernise code

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Move errors to seperate directory

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* refactor: Add fetch-blob (#678)

* feat: Migrate data uri integration

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Allow setting custom highWaterMark via node-fetch options (#386) (#671)

* Expose highWaterMark option to body clone function

* Add highWaterMark to responseOptions

* Add highWaterMark as node-fetch-only option

* a way to silently pass highWaterMark to clone

* Chai helper

* Server helper

* Tests

* Remove debug comments

* Document highWaterMark option

* Add TypeScript types for the new highWaterMark option

* feat: Include system error in FetchError if one occurs (#654)

* style: Add editorconfig

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore!: Drop NodeJS v8

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Remove legacy code for node < 8

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Use proper checks for ArrayBuffer and AbortError

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Use explicitly set error name in checks

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Propagate size and timeout to cloned response (#664)

* Remove --save option as it isn't required anymore (#581)

* Propagate size and timeout to cloned response


Co-authored-by: Steve Moser <contact@stevemoser.org>
Co-authored-by: Antoni Kepinski <xxczaki@pm.me>

* Update Response types

* Update devDependencies

* feat: Fallback to blob type (Closes: #607)

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* style: Update formatting

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* style: Fix linting issues

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: Add info on patching the global object

* docs: Added non-globalThis polyfill

* Replace deprecated `url.resolve` with the new WHATWG URL

* Update devDependencies

* Format code in examples to use `xo` style

* Verify examples with RunKit and edit them if necessary

* Add information about TypeScript support

* Document the new `highWaterMark` option

* Add Discord badge & information about Open Collective

* Style change

* Edit acknowledgement & add "Team" section

* fix table

* Format example code to use xo style

* chore: v3 release changelog

* Add the recommended way to fix `highWaterMark` issues

* docs: Add simple Runkit example

* fix: Properly set the name of the errors.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: Add AbortError to documented types

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: AbortError proper typing parameters

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: Add example code for Runkit

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Replace microbundle with @pika/pack (#689)

* gitignore the pkg/ directory

* Move TypeScript types to the root of the project

* Replace microbundle with @pika/pack

* chore: Remove @pika/plugin-build-web and revert ./dist output directory

Signed-off-by: Richie Bendall <richiebendall@gmail.com>


Co-authored-by: Richie Bendall <richiebendall@gmail.com>

* fix incorrect statement in changelog

* chore: v3.x upgrade guide

* Change the Open Collective button

* docs: Encode support button as Markdown instead of HTML

* chore: Ignore proper directory in xo

* Add an "Upgrading" section to readme

* Split the upgrade guide into 2 files & add the missing changes about v3.x

* style: Lint test and example files

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Move *.md files to the `docs` folder (except README.md)

* Update references to files

* Split LIMITS.md into 2 files (as of v2.x and v3.x)

* chore: Remove logging statement

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* style: Fix lint

* docs: Correct typings for systemError in FetchError (Fixes #697)

* refactor: Replace `encoding` with `fetch-charset-detection`. (#694)

* refactor: Replace `encoding` with `fetch-charset-detection`.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* refactor: Move writing to stream back to body.js

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* refactor: Only put convertBody in fetch-charset-detection and refactor others.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* test: Readd tests for getTotalBytes and extractContentType

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Revert package.json indention

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Remove optional dependency

* docs: Replace code for fetch-charset-detection with documentation.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Remove iconv-lite

* fix: Use default export instead of named export for convertBody

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Remove unneeded installation of fetch-charset-detection in the build

* docs: Fix typo

* fix: Throw SyntaxError instead of FetchError in case of invalid… (#700)

* fix: Throw SyntaxError instead of FetchError in case of invalid JSON

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: Add to upgrade guide

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Remove deprecated url.parse from test

* Remove deprecated url.parse from server

* fix: Proper data uri to buffer conversion (#703)

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Add funding info

* fix: Flawed property existence test (#706)

Fix a problem where not all prototype methods are copied from the Body via the mixin method due to a failure to properly detect properties in the target. The current code uses the `in` operator, which may return properties lower down the inheritance chain, thus causing them to fail the copy. The new code properly calls the `.hasOwnProperty()` method to make the determination.

* fix: Properly handle stream pipeline double-fire

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: Fix spelling

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Add `funding` field to package.json (#708)

* Fix: Do not set ContentLength to NaN (#709)

* do not set ContentLength to NaN

* lint

* docs: Add logo

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Update repository name from bitinn/node-fetch to node-fetch/node-fetch.

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Fix unit tests

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore(deps): Bump @pika/plugin-copy-assets from 0.7.1 to 0.8.1 (#713)

Bumps [@pika/plugin-copy-assets](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore(deps): Bump @pika/plugin-build-types from 0.7.1 to 0.8.1 (#710)

Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump nyc from 14.1.1 to 15.0.0 (#714)

Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0.
- [Release notes](https://github.com/istanbuljs/nyc/releases)
- [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
- [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore: Update travis ci url

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore(deps): Bump mocha from 6.2.2 to 7.0.0 (#711)

Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.0.
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mochajs/mocha/compare/v6.2.2...v7.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: Allow excluding a user agent in a fetch request by setting… (#715)

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* Bump @pika/plugin-build-node from 0.7.1 to 0.8.1 (#717)

Bumps [@pika/plugin-build-node](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @pika/plugin-standard-pkg from 0.7.1 to 0.8.1 (#716)

Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.7.1 to 0.8.1.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.7.1...v0.8.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump form-data from 2.5.1 to 3.0.0 (#712)

Bumps [form-data](https://github.com/form-data/form-data) from 2.5.1 to 3.0.0.
- [Release notes](https://github.com/form-data/form-data/releases)
- [Commits](https://github.com/form-data/form-data/compare/v2.5.1...v3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix: typo

* update suggestion

* feat: Added missing redirect function (#718)

* added missing redirect function
* chore: Add types

Co-authored-by: Richie Bendall <richiebendall@gmail.com>

* fix: Use req.setTimeout for timeout (#719)

* chore: Update typings comment

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* chore: Update deps

Signed-off-by: Richie Bendall <richiebendall@gmail.com>

* docs: center badges & Open Collective button

* docs: add missing comma

* Remove current stable & LTS node version numbers from the comments

I don't think we really want to update them

* Bump xo from 0.25.4 to 0.26.1 (#730)

Bumps [xo](https://github.com/xojs/xo) from 0.25.4 to 0.26.1.
- [Release notes](https://github.com/xojs/xo/releases)
- [Commits](https://github.com/xojs/xo/compare/v0.25.4...v0.26.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @pika/plugin-build-types from 0.8.3 to 0.9.2 (#729)

Bumps [@pika/plugin-build-types](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @pika/plugin-standard-pkg from 0.8.3 to 0.9.2 (#726)

Bumps [@pika/plugin-standard-pkg](https://github.com/pikapkg/builders) from 0.8.3 to 0.9.2.
- [Release notes](https://github.com/pikapkg/builders/releases)
- [Commits](https://github.com/pikapkg/builders/compare/v0.8.3...v0.9.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* docs: Update information about `req.body` type in v3.x release

* Add information about removed body type to the v3 upgrade guide

* add awesome badge

* Show 2 ways of importing node-fetch (CommonJS & ES module)

* update dependencies

* lint

* refactor: Replace `url.parse` with `new URL()` (#701)

* chore: replace `url.parse` with `new URL()`

* lint

* handle relative URLs

* Change error message

* detect whether the url is absolute or not

* update tests

* drop relative url support

* lint

* fix tests

* typo

* Add information about dropped arbitrary URL support in v3.x upgrade guide

* set xo linting rule (node/no-deprecated-api) to on

* remove the `utf8` dependency

* fix

* refactor: split tests into several files, create the `utils` directory

* Update package.json scripts & remove unnecessary xo linting rules

* refactor: turn on some xo linting rules to improve code quality

* fix tests

* Remove invalid urls

* fix merge conflict

* update the upgrade guide

* test if URLs are encoded as UTF-8

* update xo to 0.28.0

* chore: Build before publishing

* v3.0.0-beta.1

* fix lint on test/main.js

Co-authored-by: Richie Bendall <richiebendall@gmail.com>
Co-authored-by: Antoni Kepinski <xxczaki@pm.me>
Co-authored-by: aeb-sia <50743092+aeb-sia@users.noreply.github.com>
Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
Co-authored-by: Steve Moser <contact@stevemoser.org>
Co-authored-by: Erick Calder <e@arix.com>
Co-authored-by: Yaacov Rydzinski <yaacovCR@gmail.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Jimmy Wärting <jimmy@warting.se>
2020-03-13 23:06:25 +08:00
Alessandro Zanardi cd33d22378
docs: fix code coverage badge (#733) 2020-02-19 19:46:36 +01:00
Sesamestrong 8c197f8982 docs: Fix typos and grammatical errors in README.md (#686) 2019-10-21 15:32:52 +13:00
Ramit Mittal 1e99050f94 fix: Change error message thrown with redirect mode set to error (#653)
The original error message does not provide enough information about what went wrong. It simply states a configuration setting.
2019-10-11 09:26:58 +13:00
Richie Bendall 244e6f63d4
docs: Show backers in README 2019-10-07 20:23:11 +13:00
dsuket 6a5d192034 fix: Properly parse meta tag when parameters are reversed (#682) 2019-10-07 19:58:27 +13:00
Richie Bendall 47a24a03eb
chore: Add opencollective badge 2019-10-02 22:00:55 +13:00
Richie Bendall 7b136627c5
chore: Add funding link 2019-10-02 21:50:00 +13:00
Boris Bosiljcic 5535c2ed47 fix: Check for global.fetch before binding it (#674) 2019-09-16 23:52:22 +12:00
Richie Bendall 1d5778ad0d
docs: Add Discord badge 2019-09-08 10:00:54 +12:00
Richie Bendall eb3a57255b
feat: Data URI support (#659)
Adds support for Data URIs using native methods in Node 5.10.0+
2019-09-08 09:44:40 +12:00
Steve Moser 086be6fc74 Remove --save option as it isn't required anymore (#581) 2019-08-09 11:17:25 +02:00
David Frank 95286f52bb
v2.6.0 (#638)
* Update readme and changelog for `options.agent`
- Fix content-length issue introduced in v2.5.0
* More test coverage for `extractContentType`
* Slightly improve test performance
* `Response.url` should not return null
* Document `Headers.raw()` usage better
* 2.6.0
2019-05-16 14:38:28 +08:00
edgraaff bf8b4e8db3 Allow agent option to be a function (#632)
Enable users to return HTTP/HTTPS-specific agent based on request url
2019-05-05 20:12:33 +08:00
David Frank 0c2294ec48
2.5.0 release (#630)
* redirected property
* changelog update
* readme update
* 2.5.0
2019-05-01 13:05:32 +08:00
David Frank 0fc414c2a8
Allow third party blob implementation (#629)
* Support making request with any blob that have stream() method
* don't clone blob when cloning request
* check for blob api that node-fetch uses
2019-05-01 11:44:27 +08:00
Justin Beckwith d8f5ba0e97 build: disable generation of package-lock since it is not used (#623) 2019-05-01 11:19:06 +08:00
Justin Beckwith 1fe1358642 test: enable --throw-deprecation for tests (#625) 2019-05-01 11:15:05 +08:00
Justin Beckwith a35dcd14a3 chore(deps): address deprecated url-search-params package (#622) 2019-05-01 11:14:11 +08:00
David Frank b3ecba5e81
2.4.1 release (#619)
* changelog update
* package.json update
2019-04-27 14:50:25 +08:00
mcuppi 1a88481fbd Fix Blob for older node versions and webpack. (#618)
`Readable` isn't a named export
2019-04-27 14:34:01 +08:00
David Frank c9805a2868
2.4.0 release (#616)
* changelog update
* package.json update
2019-04-27 01:20:20 +08:00
David Frank 49d77600a7
Pass custom timeout to subsequent requests on redirect (#615) 2019-04-27 00:46:53 +08:00
Andrew Leedham cfc8e5bad2 Swap packagephobia badge for flat style (#592) 2019-04-27 00:27:31 +08:00
Muhammet Öztürk 2a2d4384af Adding Brotli Support (#598)
* adding brotli support
* support old node versions
* better test
2019-04-27 00:20:15 +08:00
David Frank 05f5ac12a2
Node 12 compatibility (#614)
* dev package bump
* test invalid header differently as node 12 no longer accepts invalid headers in response
* add node v10 in travis test list as node 12 has been released
2019-04-27 00:11:52 +08:00
Jimmy Wärting 432c9b01ea support reading blob with stream (#608) 2019-04-16 18:29:17 +08:00
Jimmy Wärting 0ad136d49f Added new reading method to blob 2019-04-15 22:46:11 +02:00