add node modules
This commit is contained in:
21
node_modules/cross-fetch/LICENSE
generated
vendored
Normal file
21
node_modules/cross-fetch/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Leonardo Quixadá
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
164
node_modules/cross-fetch/README.md
generated
vendored
Normal file
164
node_modules/cross-fetch/README.md
generated
vendored
Normal file
@@ -0,0 +1,164 @@
|
||||
cross-fetch<br>
|
||||
[](https://www.npmjs.com/package/cross-fetch)
|
||||
[](https://www.npmjs.com/package/cross-fetch)
|
||||
[](https://opensource.org/licenses/MIT)
|
||||
[](https://github.com/lquixada/cross-fetch/actions/workflows/ci.yml)
|
||||
[](https://codecov.io/gh/lquixada/cross-fetch)
|
||||
================
|
||||
|
||||
Universal WHATWG Fetch API for Node, Browsers, Workers and React Native. The scenario that cross-fetch really shines is when the same JavaScript codebase needs to run on different platforms.
|
||||
|
||||
- **Platform agnostic**: browsers, Node or React Native
|
||||
- **Optional polyfill**: it's up to you if something is going to be added to the global object or not
|
||||
- **Simple interface**: no instantiation, no configuration and no extra dependency
|
||||
- **WHATWG compliant**: it works the same way wherever your code runs
|
||||
- **TypeScript support**: better development experience with types.
|
||||
- **Worker support**: works on different types of workers such as Service Workers and CloudFlare Workers
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
## Table of Contents
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Demo \& API](#demo--api)
|
||||
- [FAQ](#faq)
|
||||
- [Yet another fetch library?](#yet-another-fetch-library)
|
||||
- [Why polyfill might not be a good idea?](#why-polyfill-might-not-be-a-good-idea)
|
||||
- [How does cross-fetch work?](#how-does-cross-fetch-work)
|
||||
- [Who's Using It?](#whos-using-it)
|
||||
- [Thanks](#thanks)
|
||||
- [License](#license)
|
||||
- [Author](#author)
|
||||
|
||||
* * *
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install --save cross-fetch
|
||||
```
|
||||
|
||||
As a [ponyfill](https://github.com/sindresorhus/ponyfill) (imports locally):
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules with Babel or TypeScript
|
||||
import fetch from 'cross-fetch';
|
||||
|
||||
// Using CommonJS modules
|
||||
const fetch = require('cross-fetch');
|
||||
```
|
||||
|
||||
As a polyfill (installs globally):
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules
|
||||
import 'cross-fetch/polyfill';
|
||||
|
||||
// Using CommonJS modules
|
||||
require('cross-fetch/polyfill');
|
||||
```
|
||||
|
||||
|
||||
The CDN build is also available on unpkg:
|
||||
|
||||
```html
|
||||
<script src="//unpkg.com/cross-fetch/dist/cross-fetch.js"></script>
|
||||
```
|
||||
|
||||
This adds the fetch function to the window object. Note that this is not UMD compatible.
|
||||
|
||||
|
||||
* * *
|
||||
|
||||
## Usage
|
||||
|
||||
With [promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise):
|
||||
|
||||
```javascript
|
||||
import fetch from 'cross-fetch';
|
||||
// Or just: import 'cross-fetch/polyfill';
|
||||
|
||||
fetch('//api.github.com/users/lquixada')
|
||||
.then(res => {
|
||||
if (res.status >= 400) {
|
||||
throw new Error("Bad response from server");
|
||||
}
|
||||
return res.json();
|
||||
})
|
||||
.then(user => {
|
||||
console.log(user);
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
```
|
||||
|
||||
With [async/await](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function):
|
||||
|
||||
```javascript
|
||||
import fetch from 'cross-fetch';
|
||||
// Or just: import 'cross-fetch/polyfill';
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const res = await fetch('//api.github.com/users/lquixada');
|
||||
|
||||
if (res.status >= 400) {
|
||||
throw new Error("Bad response from server");
|
||||
}
|
||||
|
||||
const user = await res.json();
|
||||
|
||||
console.log(user);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
## Demo & API
|
||||
|
||||
You can find a comprehensive doc at [Github's fetch](https://github.github.io/fetch/) page. If you want to play with cross-fetch, check our [**JSFiddle playground**](https://jsfiddle.net/lquixada/3ypqgacp/).
|
||||
|
||||
> **Tip**: Run the fiddle on various browsers and with different settings (for instance: cross-domain requests, wrong urls or text requests). Don't forget to open the console in the test suite page and play around.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
#### Yet another fetch library?
|
||||
|
||||
I did a lot of research in order to find a fetch library that could be simple, cross-platform and provide polyfill as an option. There's a plethora of libs out there but none could match those requirements.
|
||||
|
||||
#### Why polyfill might not be a good idea?
|
||||
|
||||
In a word? Risk. If the spec changes in the future, it might be problematic to debug. Read more about it on [sindresorhus's ponyfill](https://github.com/sindresorhus/ponyfill#how-are-ponyfills-better-than-polyfills) page. It's up to you if you're fine with it or not.
|
||||
|
||||
#### How does cross-fetch work?
|
||||
|
||||
Just like isomorphic-fetch, it is just a proxy. If you're in node, it delivers you the [node-fetch](https://github.com/bitinn/node-fetch/) library, if you're in a browser or React Native, it delivers you the github's [whatwg-fetch](https://github.com/github/fetch/). The same strategy applies whether you're using polyfill or ponyfill.
|
||||
|
||||
|
||||
## Who's Using It?
|
||||
|
||||
|[](https://www.nytimes.com/)|[](https://github.com/apollographql/apollo-client/)|[](https://github.com/facebook/fbjs/)|[](https://swagger.io/)|[](http://vulcanjs.org)|[](https://github.com/prisma/graphql-request)|
|
||||
|:---:|:---:|:---:|:---:|:---:|:---:|
|
||||
|The New York Times|Apollo GraphQL|Facebook|Swagger|VulcanJS|graphql-request|
|
||||
|
||||
|
||||
## Thanks
|
||||
|
||||
Heavily inspired by the works of [matthew-andrews](https://github.com/matthew-andrews). Kudos to him!
|
||||
|
||||
|
||||
## License
|
||||
|
||||
cross-fetch is licensed under the [MIT license](https://github.com/lquixada/cross-fetch/blob/main/LICENSE) © [Leonardo Quixadá](https://twitter.com/lquixada/)
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|[](https://github.com/lquixada)|
|
||||
|:---:|
|
||||
|[@lquixada](http://www.github.com/lquixada)|
|
||||
14
node_modules/cross-fetch/index.d.ts
generated
vendored
Normal file
14
node_modules/cross-fetch/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
/// <reference lib="dom" />
|
||||
|
||||
declare const _fetch: typeof fetch;
|
||||
declare const _Request: typeof Request;
|
||||
declare const _Response: typeof Response;
|
||||
declare const _Headers: typeof Headers;
|
||||
|
||||
declare module "cross-fetch" {
|
||||
export const fetch: typeof _fetch;
|
||||
export const Request: typeof _Request;
|
||||
export const Response: typeof _Response;
|
||||
export const Headers: typeof _Headers;
|
||||
export default fetch;
|
||||
}
|
||||
129
node_modules/cross-fetch/package.json
generated
vendored
Normal file
129
node_modules/cross-fetch/package.json
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
{
|
||||
"name": "cross-fetch",
|
||||
"version": "4.1.0",
|
||||
"description": "Universal WHATWG Fetch API for Node, Browsers and React Native",
|
||||
"homepage": "https://github.com/lquixada/cross-fetch",
|
||||
"main": "dist/node-ponyfill.js",
|
||||
"browser": "dist/browser-ponyfill.js",
|
||||
"react-native": "dist/react-native-ponyfill.js",
|
||||
"types": "index.d.ts",
|
||||
"scripts": {
|
||||
"commit": "cz",
|
||||
"prepare": "husky install",
|
||||
"prepublishOnly": "rimraf dist && make dist"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"standard --fix"
|
||||
]
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "cz-conventional-changelog"
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"env": [
|
||||
"browser",
|
||||
"mocha",
|
||||
"serviceworker"
|
||||
],
|
||||
"globals": [
|
||||
"expect",
|
||||
"assert",
|
||||
"chai",
|
||||
"Mocha"
|
||||
],
|
||||
"ignore": [
|
||||
"/dist/",
|
||||
"api.spec.js",
|
||||
"bundle.js",
|
||||
"test.js",
|
||||
"*.bundle.js",
|
||||
"*.ts"
|
||||
]
|
||||
},
|
||||
"mocha": {
|
||||
"require": [
|
||||
"chai/register-expect.js",
|
||||
"chai/register-assert.js"
|
||||
],
|
||||
"check-leaks": true
|
||||
},
|
||||
"nyc": {
|
||||
"temp-dir": ".reports/.coverage"
|
||||
},
|
||||
"commitlint": {
|
||||
"extends": [
|
||||
"@commitlint/config-conventional"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/lquixada/cross-fetch.git"
|
||||
},
|
||||
"author": "Leonardo Quixada <lquixada@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/lquixada/cross-fetch/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "17.6.6",
|
||||
"@commitlint/config-conventional": "17.6.6",
|
||||
"@types/chai": "4.3.5",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.13",
|
||||
"body-parser": "1.20.2",
|
||||
"chai": "4.3.7",
|
||||
"codecov": "3.8.3",
|
||||
"commitizen": "4.3.0",
|
||||
"cz-conventional-changelog": "3.3.0",
|
||||
"express": "4.18.2",
|
||||
"husky": "8.0.3",
|
||||
"lint-staged": "13.2.3",
|
||||
"mocha": "10.2.0",
|
||||
"mocha-headless-chrome": "4.0.0",
|
||||
"nock": "13.3.1",
|
||||
"nyc": "15.1.0",
|
||||
"rimraf": "5.0.1",
|
||||
"rollup": "3.26.0",
|
||||
"rollup-plugin-copy": "3.4.0",
|
||||
"rollup-plugin-esbuild": "6.1.1",
|
||||
"rollup-plugin-esbuild-minify": "1.1.2",
|
||||
"semver": "7.5.3",
|
||||
"serve-index": "1.9.1",
|
||||
"standard": "17.1.0",
|
||||
"standard-version": "9.5.0",
|
||||
"typescript": "5.1.6",
|
||||
"webpack": "5.88.1",
|
||||
"webpack-cli": "5.1.4",
|
||||
"whatwg-fetch": "3.6.20",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"polyfill",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"fetch",
|
||||
"http",
|
||||
"url",
|
||||
"promise",
|
||||
"async",
|
||||
"await",
|
||||
"isomorphic",
|
||||
"universal",
|
||||
"node",
|
||||
"react",
|
||||
"native",
|
||||
"browser",
|
||||
"ponyfill",
|
||||
"whatwg",
|
||||
"xhr",
|
||||
"ajax"
|
||||
]
|
||||
}
|
||||
9
node_modules/cross-fetch/polyfill/package.json
generated
vendored
Normal file
9
node_modules/cross-fetch/polyfill/package.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"name": "cross-fetch-polyfill",
|
||||
"version": "0.0.0",
|
||||
"main": "../dist/node-polyfill.js",
|
||||
"browser": "../dist/browser-polyfill.js",
|
||||
"react-native": "../dist/react-native-polyfill.js",
|
||||
"types": "../index.d.ts",
|
||||
"license": "MIT"
|
||||
}
|
||||
Reference in New Issue
Block a user