full site update
This commit is contained in:
5
node_modules/cross-fetch/CHANGELOG.md
generated
vendored
5
node_modules/cross-fetch/CHANGELOG.md
generated
vendored
@@ -1,5 +0,0 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||
|
||||
## [4.0.0](https://github.com/lquixada/cross-fetch/compare/v4.0.0-alpha.13...v4.0.0) (2023-07-03)
|
36
node_modules/cross-fetch/README.md
generated
vendored
36
node_modules/cross-fetch/README.md
generated
vendored
@@ -6,32 +6,26 @@ cross-fetch<br>
|
||||
[](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.
|
||||
Universal WHATWG Fetch API for Node, Browsers 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
|
||||
|
||||
- [Table of Contents](#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](#install)
|
||||
- [Usage](#usage)
|
||||
- [Demo & API](#demo--api)
|
||||
- [FAQ](#faq)
|
||||
- [Thanks](#thanks)
|
||||
- [License](#license)
|
||||
- [Author](#author)
|
||||
|
||||
* * *
|
||||
|
||||
@@ -41,7 +35,7 @@ Universal WHATWG Fetch API for Node, Browsers, Workers and React Native. The sce
|
||||
npm install --save cross-fetch
|
||||
```
|
||||
|
||||
As a [ponyfill](https://github.com/sindresorhus/ponyfill) (imports locally):
|
||||
As a [ponyfill](https://github.com/sindresorhus/ponyfill):
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules with Babel or TypeScript
|
||||
@@ -51,7 +45,7 @@ import fetch from 'cross-fetch';
|
||||
const fetch = require('cross-fetch');
|
||||
```
|
||||
|
||||
As a polyfill (installs globally):
|
||||
As a polyfill:
|
||||
|
||||
```javascript
|
||||
// Using ES6 modules
|
||||
@@ -119,6 +113,9 @@ import fetch from 'cross-fetch';
|
||||
})();
|
||||
```
|
||||
|
||||
> ⚠️ **Warning**: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. [es6-promise](https://github.com/jakearchibald/es6-promise) is suggested.
|
||||
|
||||
|
||||
## 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/).
|
||||
@@ -132,10 +129,17 @@ You can find a comprehensive doc at [Github's fetch](https://github.github.io/fe
|
||||
|
||||
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 not isomorphic-fetch?
|
||||
|
||||
My preferred library used to be [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) but it has this [bug](https://github.com/matthew-andrews/isomorphic-fetch/issues/125) that prevents it from running in a react native environment. It seems unlikely to be fixed since there haven't been any new commits to it since 2016. That means dependencies are outdated as well.
|
||||
|
||||
|
||||
#### 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.
|
||||
|
133
node_modules/cross-fetch/dist/browser-polyfill.js
generated
vendored
133
node_modules/cross-fetch/dist/browser-polyfill.js
generated
vendored
@@ -2,17 +2,20 @@
|
||||
|
||||
var irrelevant = (function (exports) {
|
||||
|
||||
var global =
|
||||
/* eslint-disable no-prototype-builtins */
|
||||
var g =
|
||||
(typeof globalThis !== 'undefined' && globalThis) ||
|
||||
(typeof self !== 'undefined' && self) ||
|
||||
(typeof global !== 'undefined' && global);
|
||||
// eslint-disable-next-line no-undef
|
||||
(typeof global !== 'undefined' && global) ||
|
||||
{};
|
||||
|
||||
var support = {
|
||||
searchParams: 'URLSearchParams' in global,
|
||||
iterable: 'Symbol' in global && 'iterator' in Symbol,
|
||||
searchParams: 'URLSearchParams' in g,
|
||||
iterable: 'Symbol' in g && 'iterator' in Symbol,
|
||||
blob:
|
||||
'FileReader' in global &&
|
||||
'Blob' in global &&
|
||||
'FileReader' in g &&
|
||||
'Blob' in g &&
|
||||
(function() {
|
||||
try {
|
||||
new Blob();
|
||||
@@ -21,8 +24,8 @@ var irrelevant = (function (exports) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
formData: 'FormData' in global,
|
||||
arrayBuffer: 'ArrayBuffer' in global
|
||||
formData: 'FormData' in g,
|
||||
arrayBuffer: 'ArrayBuffer' in g
|
||||
};
|
||||
|
||||
function isDataView(obj) {
|
||||
@@ -93,6 +96,9 @@ var irrelevant = (function (exports) {
|
||||
}, this);
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.forEach(function(header) {
|
||||
if (header.length != 2) {
|
||||
throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
|
||||
}
|
||||
this.append(header[0], header[1]);
|
||||
}, this);
|
||||
} else if (headers) {
|
||||
@@ -163,6 +169,7 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
|
||||
function consumed(body) {
|
||||
if (body._noBody) return
|
||||
if (body.bodyUsed) {
|
||||
return Promise.reject(new TypeError('Already read'))
|
||||
}
|
||||
@@ -190,7 +197,9 @@ var irrelevant = (function (exports) {
|
||||
function readBlobAsText(blob) {
|
||||
var reader = new FileReader();
|
||||
var promise = fileReaderReady(reader);
|
||||
reader.readAsText(blob);
|
||||
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
|
||||
var encoding = match ? match[1] : 'utf-8';
|
||||
reader.readAsText(blob, encoding);
|
||||
return promise
|
||||
}
|
||||
|
||||
@@ -228,9 +237,11 @@ var irrelevant = (function (exports) {
|
||||
semantic of setting Request.bodyUsed in the constructor before
|
||||
_initBody is called.
|
||||
*/
|
||||
// eslint-disable-next-line no-self-assign
|
||||
this.bodyUsed = this.bodyUsed;
|
||||
this._bodyInit = body;
|
||||
if (!body) {
|
||||
this._noBody = true;
|
||||
this._bodyText = '';
|
||||
} else if (typeof body === 'string') {
|
||||
this._bodyText = body;
|
||||
@@ -278,29 +289,30 @@ var irrelevant = (function (exports) {
|
||||
return Promise.resolve(new Blob([this._bodyText]))
|
||||
}
|
||||
};
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
var isConsumed = consumed(this);
|
||||
if (isConsumed) {
|
||||
return isConsumed
|
||||
}
|
||||
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||
return Promise.resolve(
|
||||
this._bodyArrayBuffer.buffer.slice(
|
||||
this._bodyArrayBuffer.byteOffset,
|
||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(this._bodyArrayBuffer)
|
||||
}
|
||||
} else {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
var isConsumed = consumed(this);
|
||||
if (isConsumed) {
|
||||
return isConsumed
|
||||
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||
return Promise.resolve(
|
||||
this._bodyArrayBuffer.buffer.slice(
|
||||
this._bodyArrayBuffer.byteOffset,
|
||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(this._bodyArrayBuffer)
|
||||
}
|
||||
} else if (support.blob) {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
} else {
|
||||
throw new Error('could not read as ArrayBuffer')
|
||||
}
|
||||
};
|
||||
|
||||
this.text = function() {
|
||||
var rejected = consumed(this);
|
||||
if (rejected) {
|
||||
@@ -332,7 +344,7 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
|
||||
// HTTP methods whose capitalization should be normalized
|
||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
||||
var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];
|
||||
|
||||
function normalizeMethod(method) {
|
||||
var upcased = method.toUpperCase();
|
||||
@@ -373,7 +385,12 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
this.method = normalizeMethod(options.method || this.method || 'GET');
|
||||
this.mode = options.mode || this.mode || null;
|
||||
this.signal = options.signal || this.signal;
|
||||
this.signal = options.signal || this.signal || (function () {
|
||||
if ('AbortController' in g) {
|
||||
var ctrl = new AbortController();
|
||||
return ctrl.signal;
|
||||
}
|
||||
}());
|
||||
this.referrer = null;
|
||||
|
||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||
@@ -435,7 +452,11 @@ var irrelevant = (function (exports) {
|
||||
var key = parts.shift().trim();
|
||||
if (key) {
|
||||
var value = parts.join(':').trim();
|
||||
headers.append(key, value);
|
||||
try {
|
||||
headers.append(key, value);
|
||||
} catch (error) {
|
||||
console.warn('Response ' + error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
return headers
|
||||
@@ -453,6 +474,9 @@ var irrelevant = (function (exports) {
|
||||
|
||||
this.type = 'default';
|
||||
this.status = options.status === undefined ? 200 : options.status;
|
||||
if (this.status < 200 || this.status > 599) {
|
||||
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
|
||||
}
|
||||
this.ok = this.status >= 200 && this.status < 300;
|
||||
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
||||
this.headers = new Headers(options.headers);
|
||||
@@ -472,7 +496,9 @@ var irrelevant = (function (exports) {
|
||||
};
|
||||
|
||||
Response.error = function() {
|
||||
var response = new Response(null, {status: 0, statusText: ''});
|
||||
var response = new Response(null, {status: 200, statusText: ''});
|
||||
response.ok = false;
|
||||
response.status = 0;
|
||||
response.type = 'error';
|
||||
return response
|
||||
};
|
||||
@@ -487,7 +513,7 @@ var irrelevant = (function (exports) {
|
||||
return new Response(null, {status: status, headers: {location: url}})
|
||||
};
|
||||
|
||||
exports.DOMException = global.DOMException;
|
||||
exports.DOMException = g.DOMException;
|
||||
try {
|
||||
new exports.DOMException();
|
||||
} catch (err) {
|
||||
@@ -517,10 +543,16 @@ var irrelevant = (function (exports) {
|
||||
|
||||
xhr.onload = function() {
|
||||
var options = {
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
||||
};
|
||||
// This check if specifically for when a user fetches a file locally from the file system
|
||||
// Only if the status is out of a normal range
|
||||
if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {
|
||||
options.status = 200;
|
||||
} else {
|
||||
options.status = xhr.status;
|
||||
}
|
||||
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
||||
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
||||
setTimeout(function() {
|
||||
@@ -536,7 +568,7 @@ var irrelevant = (function (exports) {
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
setTimeout(function() {
|
||||
reject(new TypeError('Network request failed'));
|
||||
reject(new TypeError('Network request timed out'));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
@@ -548,7 +580,7 @@ var irrelevant = (function (exports) {
|
||||
|
||||
function fixUrl(url) {
|
||||
try {
|
||||
return url === '' && global.location.href ? global.location.href : url
|
||||
return url === '' && g.location.href ? g.location.href : url
|
||||
} catch (e) {
|
||||
return url
|
||||
}
|
||||
@@ -566,18 +598,23 @@ var irrelevant = (function (exports) {
|
||||
if (support.blob) {
|
||||
xhr.responseType = 'blob';
|
||||
} else if (
|
||||
support.arrayBuffer &&
|
||||
request.headers.get('Content-Type') &&
|
||||
request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
|
||||
support.arrayBuffer
|
||||
) {
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
}
|
||||
|
||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
|
||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
|
||||
var names = [];
|
||||
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
||||
names.push(normalizeName(name));
|
||||
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
||||
});
|
||||
request.headers.forEach(function(value, name) {
|
||||
if (names.indexOf(name) === -1) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
request.headers.forEach(function(value, name) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
@@ -601,11 +638,11 @@ var irrelevant = (function (exports) {
|
||||
|
||||
fetch.polyfill = true;
|
||||
|
||||
if (!global.fetch) {
|
||||
global.fetch = fetch;
|
||||
global.Headers = Headers;
|
||||
global.Request = Request;
|
||||
global.Response = Response;
|
||||
if (!g.fetch) {
|
||||
g.fetch = fetch;
|
||||
g.Headers = Headers;
|
||||
g.Request = Request;
|
||||
g.Response = Response;
|
||||
}
|
||||
|
||||
exports.Headers = Headers;
|
||||
@@ -613,6 +650,8 @@ var irrelevant = (function (exports) {
|
||||
exports.Response = Response;
|
||||
exports.fetch = fetch;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
return exports;
|
||||
|
||||
})({});
|
||||
|
133
node_modules/cross-fetch/dist/browser-ponyfill.js
generated
vendored
133
node_modules/cross-fetch/dist/browser-ponyfill.js
generated
vendored
@@ -18,17 +18,20 @@ return new F();
|
||||
|
||||
var irrelevant = (function (exports) {
|
||||
|
||||
var global =
|
||||
/* eslint-disable no-prototype-builtins */
|
||||
var g =
|
||||
(typeof globalThis !== 'undefined' && globalThis) ||
|
||||
(typeof self !== 'undefined' && self) ||
|
||||
(typeof global !== 'undefined' && global);
|
||||
// eslint-disable-next-line no-undef
|
||||
(typeof global !== 'undefined' && global) ||
|
||||
{};
|
||||
|
||||
var support = {
|
||||
searchParams: 'URLSearchParams' in global,
|
||||
iterable: 'Symbol' in global && 'iterator' in Symbol,
|
||||
searchParams: 'URLSearchParams' in g,
|
||||
iterable: 'Symbol' in g && 'iterator' in Symbol,
|
||||
blob:
|
||||
'FileReader' in global &&
|
||||
'Blob' in global &&
|
||||
'FileReader' in g &&
|
||||
'Blob' in g &&
|
||||
(function() {
|
||||
try {
|
||||
new Blob();
|
||||
@@ -37,8 +40,8 @@ var irrelevant = (function (exports) {
|
||||
return false
|
||||
}
|
||||
})(),
|
||||
formData: 'FormData' in global,
|
||||
arrayBuffer: 'ArrayBuffer' in global
|
||||
formData: 'FormData' in g,
|
||||
arrayBuffer: 'ArrayBuffer' in g
|
||||
};
|
||||
|
||||
function isDataView(obj) {
|
||||
@@ -109,6 +112,9 @@ var irrelevant = (function (exports) {
|
||||
}, this);
|
||||
} else if (Array.isArray(headers)) {
|
||||
headers.forEach(function(header) {
|
||||
if (header.length != 2) {
|
||||
throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length)
|
||||
}
|
||||
this.append(header[0], header[1]);
|
||||
}, this);
|
||||
} else if (headers) {
|
||||
@@ -179,6 +185,7 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
|
||||
function consumed(body) {
|
||||
if (body._noBody) return
|
||||
if (body.bodyUsed) {
|
||||
return Promise.reject(new TypeError('Already read'))
|
||||
}
|
||||
@@ -206,7 +213,9 @@ var irrelevant = (function (exports) {
|
||||
function readBlobAsText(blob) {
|
||||
var reader = new FileReader();
|
||||
var promise = fileReaderReady(reader);
|
||||
reader.readAsText(blob);
|
||||
var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type);
|
||||
var encoding = match ? match[1] : 'utf-8';
|
||||
reader.readAsText(blob, encoding);
|
||||
return promise
|
||||
}
|
||||
|
||||
@@ -244,9 +253,11 @@ var irrelevant = (function (exports) {
|
||||
semantic of setting Request.bodyUsed in the constructor before
|
||||
_initBody is called.
|
||||
*/
|
||||
// eslint-disable-next-line no-self-assign
|
||||
this.bodyUsed = this.bodyUsed;
|
||||
this._bodyInit = body;
|
||||
if (!body) {
|
||||
this._noBody = true;
|
||||
this._bodyText = '';
|
||||
} else if (typeof body === 'string') {
|
||||
this._bodyText = body;
|
||||
@@ -294,29 +305,30 @@ var irrelevant = (function (exports) {
|
||||
return Promise.resolve(new Blob([this._bodyText]))
|
||||
}
|
||||
};
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
var isConsumed = consumed(this);
|
||||
if (isConsumed) {
|
||||
return isConsumed
|
||||
}
|
||||
if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||
return Promise.resolve(
|
||||
this._bodyArrayBuffer.buffer.slice(
|
||||
this._bodyArrayBuffer.byteOffset,
|
||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(this._bodyArrayBuffer)
|
||||
}
|
||||
} else {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
this.arrayBuffer = function() {
|
||||
if (this._bodyArrayBuffer) {
|
||||
var isConsumed = consumed(this);
|
||||
if (isConsumed) {
|
||||
return isConsumed
|
||||
} else if (ArrayBuffer.isView(this._bodyArrayBuffer)) {
|
||||
return Promise.resolve(
|
||||
this._bodyArrayBuffer.buffer.slice(
|
||||
this._bodyArrayBuffer.byteOffset,
|
||||
this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength
|
||||
)
|
||||
)
|
||||
} else {
|
||||
return Promise.resolve(this._bodyArrayBuffer)
|
||||
}
|
||||
} else if (support.blob) {
|
||||
return this.blob().then(readBlobAsArrayBuffer)
|
||||
} else {
|
||||
throw new Error('could not read as ArrayBuffer')
|
||||
}
|
||||
};
|
||||
|
||||
this.text = function() {
|
||||
var rejected = consumed(this);
|
||||
if (rejected) {
|
||||
@@ -348,7 +360,7 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
|
||||
// HTTP methods whose capitalization should be normalized
|
||||
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
||||
var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'];
|
||||
|
||||
function normalizeMethod(method) {
|
||||
var upcased = method.toUpperCase();
|
||||
@@ -389,7 +401,12 @@ var irrelevant = (function (exports) {
|
||||
}
|
||||
this.method = normalizeMethod(options.method || this.method || 'GET');
|
||||
this.mode = options.mode || this.mode || null;
|
||||
this.signal = options.signal || this.signal;
|
||||
this.signal = options.signal || this.signal || (function () {
|
||||
if ('AbortController' in g) {
|
||||
var ctrl = new AbortController();
|
||||
return ctrl.signal;
|
||||
}
|
||||
}());
|
||||
this.referrer = null;
|
||||
|
||||
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
||||
@@ -451,7 +468,11 @@ var irrelevant = (function (exports) {
|
||||
var key = parts.shift().trim();
|
||||
if (key) {
|
||||
var value = parts.join(':').trim();
|
||||
headers.append(key, value);
|
||||
try {
|
||||
headers.append(key, value);
|
||||
} catch (error) {
|
||||
console.warn('Response ' + error.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
return headers
|
||||
@@ -469,6 +490,9 @@ var irrelevant = (function (exports) {
|
||||
|
||||
this.type = 'default';
|
||||
this.status = options.status === undefined ? 200 : options.status;
|
||||
if (this.status < 200 || this.status > 599) {
|
||||
throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].")
|
||||
}
|
||||
this.ok = this.status >= 200 && this.status < 300;
|
||||
this.statusText = options.statusText === undefined ? '' : '' + options.statusText;
|
||||
this.headers = new Headers(options.headers);
|
||||
@@ -488,7 +512,9 @@ var irrelevant = (function (exports) {
|
||||
};
|
||||
|
||||
Response.error = function() {
|
||||
var response = new Response(null, {status: 0, statusText: ''});
|
||||
var response = new Response(null, {status: 200, statusText: ''});
|
||||
response.ok = false;
|
||||
response.status = 0;
|
||||
response.type = 'error';
|
||||
return response
|
||||
};
|
||||
@@ -503,7 +529,7 @@ var irrelevant = (function (exports) {
|
||||
return new Response(null, {status: status, headers: {location: url}})
|
||||
};
|
||||
|
||||
exports.DOMException = global.DOMException;
|
||||
exports.DOMException = g.DOMException;
|
||||
try {
|
||||
new exports.DOMException();
|
||||
} catch (err) {
|
||||
@@ -533,10 +559,16 @@ var irrelevant = (function (exports) {
|
||||
|
||||
xhr.onload = function() {
|
||||
var options = {
|
||||
status: xhr.status,
|
||||
statusText: xhr.statusText,
|
||||
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
||||
};
|
||||
// This check if specifically for when a user fetches a file locally from the file system
|
||||
// Only if the status is out of a normal range
|
||||
if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) {
|
||||
options.status = 200;
|
||||
} else {
|
||||
options.status = xhr.status;
|
||||
}
|
||||
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
||||
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
||||
setTimeout(function() {
|
||||
@@ -552,7 +584,7 @@ var irrelevant = (function (exports) {
|
||||
|
||||
xhr.ontimeout = function() {
|
||||
setTimeout(function() {
|
||||
reject(new TypeError('Network request failed'));
|
||||
reject(new TypeError('Network request timed out'));
|
||||
}, 0);
|
||||
};
|
||||
|
||||
@@ -564,7 +596,7 @@ var irrelevant = (function (exports) {
|
||||
|
||||
function fixUrl(url) {
|
||||
try {
|
||||
return url === '' && global.location.href ? global.location.href : url
|
||||
return url === '' && g.location.href ? g.location.href : url
|
||||
} catch (e) {
|
||||
return url
|
||||
}
|
||||
@@ -582,18 +614,23 @@ var irrelevant = (function (exports) {
|
||||
if (support.blob) {
|
||||
xhr.responseType = 'blob';
|
||||
} else if (
|
||||
support.arrayBuffer &&
|
||||
request.headers.get('Content-Type') &&
|
||||
request.headers.get('Content-Type').indexOf('application/octet-stream') !== -1
|
||||
support.arrayBuffer
|
||||
) {
|
||||
xhr.responseType = 'arraybuffer';
|
||||
}
|
||||
}
|
||||
|
||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers)) {
|
||||
if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) {
|
||||
var names = [];
|
||||
Object.getOwnPropertyNames(init.headers).forEach(function(name) {
|
||||
names.push(normalizeName(name));
|
||||
xhr.setRequestHeader(name, normalizeValue(init.headers[name]));
|
||||
});
|
||||
request.headers.forEach(function(value, name) {
|
||||
if (names.indexOf(name) === -1) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
request.headers.forEach(function(value, name) {
|
||||
xhr.setRequestHeader(name, value);
|
||||
@@ -617,11 +654,11 @@ var irrelevant = (function (exports) {
|
||||
|
||||
fetch.polyfill = true;
|
||||
|
||||
if (!global.fetch) {
|
||||
global.fetch = fetch;
|
||||
global.Headers = Headers;
|
||||
global.Request = Request;
|
||||
global.Response = Response;
|
||||
if (!g.fetch) {
|
||||
g.fetch = fetch;
|
||||
g.Headers = Headers;
|
||||
g.Request = Request;
|
||||
g.Response = Response;
|
||||
}
|
||||
|
||||
exports.Headers = Headers;
|
||||
@@ -629,6 +666,8 @@ var irrelevant = (function (exports) {
|
||||
exports.Response = Response;
|
||||
exports.fetch = fetch;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
return exports;
|
||||
|
||||
})({});
|
||||
|
2
node_modules/cross-fetch/dist/cross-fetch.js
generated
vendored
2
node_modules/cross-fetch/dist/cross-fetch.js
generated
vendored
File diff suppressed because one or more lines are too long
2
node_modules/cross-fetch/dist/cross-fetch.js.map
generated
vendored
2
node_modules/cross-fetch/dist/cross-fetch.js.map
generated
vendored
File diff suppressed because one or more lines are too long
6
node_modules/cross-fetch/dist/node-polyfill.js
generated
vendored
6
node_modules/cross-fetch/dist/node-polyfill.js
generated
vendored
@@ -1,10 +1,10 @@
|
||||
const fetchNode = require('./node-ponyfill')
|
||||
const fetch = fetchNode.fetch.bind({})
|
||||
|
||||
fetch.polyfill = true
|
||||
|
||||
if (!global.fetch) {
|
||||
const fetch = fetchNode.fetch.bind({})
|
||||
|
||||
global.fetch = fetch
|
||||
global.fetch.polyfill = true
|
||||
global.Response = fetchNode.Response
|
||||
global.Headers = fetchNode.Headers
|
||||
global.Request = fetchNode.Request
|
||||
|
67
node_modules/cross-fetch/package.json
generated
vendored
67
node_modules/cross-fetch/package.json
generated
vendored
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cross-fetch",
|
||||
"version": "4.0.0",
|
||||
"version": "3.2.0",
|
||||
"description": "Universal WHATWG Fetch API for Node, Browsers and React Native",
|
||||
"homepage": "https://github.com/lquixada/cross-fetch",
|
||||
"main": "dist/node-ponyfill.js",
|
||||
@@ -24,29 +24,27 @@
|
||||
},
|
||||
"standard": {
|
||||
"env": [
|
||||
"browser",
|
||||
"mocha",
|
||||
"serviceworker"
|
||||
"browser"
|
||||
],
|
||||
"globals": [
|
||||
"expect",
|
||||
"assert",
|
||||
"chai",
|
||||
"Mocha"
|
||||
"chai"
|
||||
],
|
||||
"ignore": [
|
||||
"/dist/",
|
||||
"api.spec.js",
|
||||
"bundle.js",
|
||||
"test.js",
|
||||
"*.bundle.js",
|
||||
"test.*.js",
|
||||
"api.spec.js",
|
||||
"*.ts"
|
||||
]
|
||||
},
|
||||
"mocha": {
|
||||
"require": [
|
||||
"chai/register-expect.js",
|
||||
"chai/register-assert.js"
|
||||
"chai/register-expect",
|
||||
"chai/register-assert"
|
||||
],
|
||||
"check-leaks": true
|
||||
},
|
||||
@@ -68,39 +66,40 @@
|
||||
"url": "https://github.com/lquixada/cross-fetch/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.12"
|
||||
"node-fetch": "^2.7.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "17.6.6",
|
||||
"@commitlint/config-conventional": "17.6.6",
|
||||
"@rollup/plugin-terser": "0.4.3",
|
||||
"@types/chai": "4.3.5",
|
||||
"@types/mocha": "10.0.1",
|
||||
"@types/node": "18.15.13",
|
||||
"body-parser": "1.20.2",
|
||||
"chai": "4.3.7",
|
||||
"@commitlint/cli": "12.0.1",
|
||||
"@commitlint/config-conventional": "12.0.1",
|
||||
"@types/chai": "4.2.22",
|
||||
"@types/mocha": "8.2.2",
|
||||
"@types/node": "14.14.37",
|
||||
"body-parser": "1.19.0",
|
||||
"chai": "4.3.4",
|
||||
"codecov": "3.8.3",
|
||||
"commitizen": "4.3.0",
|
||||
"commitizen": "4.2.4",
|
||||
"cz-conventional-changelog": "3.3.0",
|
||||
"express": "4.18.2",
|
||||
"husky": "8.0.3",
|
||||
"lint-staged": "13.2.3",
|
||||
"mocha": "10.2.0",
|
||||
"express": "4.17.1",
|
||||
"husky": "6.0.0",
|
||||
"lint-staged": "10.5.4",
|
||||
"mocha": "8.3.2",
|
||||
"mocha-headless-chrome": "4.0.0",
|
||||
"nock": "13.3.1",
|
||||
"nock": "13.1.3",
|
||||
"nyc": "15.1.0",
|
||||
"rimraf": "5.0.1",
|
||||
"rollup": "3.26.0",
|
||||
"open-cli": "6.0.1",
|
||||
"rimraf": "3.0.2",
|
||||
"rollup": "2.58.0",
|
||||
"rollup-plugin-copy": "3.4.0",
|
||||
"semver": "7.5.3",
|
||||
"rollup-plugin-terser": "7.0.2",
|
||||
"semver": "7.3.5",
|
||||
"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.2",
|
||||
"yargs": "17.7.2"
|
||||
"standard": "16.0.4",
|
||||
"standard-version": "9.3.1",
|
||||
"typescript": "4.4.4",
|
||||
"webpack": "5.82.1",
|
||||
"webpack-cli": "4.9.0",
|
||||
"whatwg-fetch": "3.6.20",
|
||||
"yargs": "16.2.0"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
|
1
node_modules/cross-fetch/polyfill/package.json
generated
vendored
1
node_modules/cross-fetch/polyfill/package.json
generated
vendored
@@ -4,6 +4,5 @@
|
||||
"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