commit node_modules

This commit is contained in:
Bret Comnes
2020-02-10 12:50:13 -07:00
parent eb6412a365
commit 13eab06cd3
610 changed files with 203178 additions and 60 deletions

25
node_modules/fetch-errors/.github/workflows/tests.yml generated vendored Normal file
View File

@@ -0,0 +1,25 @@
name: tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm i
npm test
env:
CI: true

11
node_modules/fetch-errors/CHANGELOG.md generated vendored Normal file
View File

@@ -0,0 +1,11 @@
# fetch-errors Change Log
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## 1.0.1 - 2019-11-19
* Add missing devdep.
## 1.0.0 - 2019-11-19
* Initial commit

4
node_modules/fetch-errors/CODE_OF_CONDUCT.md generated vendored Normal file
View File

@@ -0,0 +1,4 @@
# Code of conduct
- This repo is governed as a dictatorship starting with the originator of the project.
- No malevolence tolerated whatsoever.

11
node_modules/fetch-errors/CONTRIBUTING.md generated vendored Normal file
View File

@@ -0,0 +1,11 @@
# Contributing
- Contributors reserve the right to walk away from this project at any moment with or without notice.
- Questions are welcome, however unless there is a official support contract established between the maintainers and the requester, support is not guaranteed.
- Patches, ideas and changes welcome.
- Fixes almost always welcome.
- Features sometimes welcome. Please open an issue to discuss the issue prior to spending lots of time on the problem. It may be rejected. If you don't want to wait around for the discussion to commence, and you really want to jump into the implementation work, be prepared for fork if the idea is respectfully declined.
- Try to stay within the style of the existing code.
- All tests must pass.
- Additional features or code paths must be tested.
- Aim for 100% coverage.

21
node_modules/fetch-errors/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2019 Bret Comnes
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.

101
node_modules/fetch-errors/README.md generated vendored Normal file
View File

@@ -0,0 +1,101 @@
# fetch-errors
[![Actions Status](https://github.com/bcomnes/fetch-errors/workflows/tests/badge.svg)](https://github.com/bcomnes/fetch-errors/actions)
[![Exports](https://img.shields.io/badge/exports-esm-blue)](https://github.com/standard-things/esm)
Error subclasses for Text and JSON `fetch` response bodies, and a `handleResponse` fuction to handle fetch responses cleanly.
```
npm install fetch-errors
```
## Usage
``` js
import {
HTTPError,
TextHTTPError,
JSONHTTPError,
handleResponse
} from 'fetch-errors';
window.fetch('https://api.github.com/users/bcomnes/repos')
.then(handleResponse)
.then(json => { console.log(json); })
.catch(err => {
switch (err.constructor) {
case JSONHTTPError: {
console.error(err.message);
console.error(err.status);
console.error(err.json);
console.error(err.stack);
break;
}
case TextHTTPError: {
console.error(err.message);
console.error(err.status);
console.error(err.data);
console.error(err.stack);
break;
}
case HTTPError: {
console.error(err.message);
console.error(err.status);
console.error(err.stack);
break;
}
default: {
console.error(err);
break;
}
}
});
```
## API
### `async handleResponse(response)`
Parse JSON or text bodies of [`fetch`][fetch] [`Response`][response] objects. Intended for APIs that return JSON, but falls back to `response.text()` body reading when the `json` `Content-type` is missing. If `response.ok`, returns a JS object (if JSON), or the text content of the response body. Otherwise, returns a `JSONHTTPError` or `TextHTTPError`. If if `response.json()` or `resonse.text()` will throw their [native error]() objects.
### `class HTTPError extends Error`
Additional error properties from Error
```js
{
stack, // stack trace of error
status // status code of response
}
```
### `class TextHTTPError extends HTTPError`
Additional error properties from HTTPError
```js
{
data // data of text response
}
```
### `class JSONHTTPError extends HTTPError`
Additional error properties from HTTPError
```js
{
json // json of a JSON response
}
```
### See also
- [netlify/micro-api-client](https://github.com/netlify/micro-api-client): These errors were extracted from netlify/micro-api-client for individual use.
## License
MIT
[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
[fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API

4
node_modules/fetch-errors/index.js generated vendored Normal file
View File

@@ -0,0 +1,4 @@
// Set options as a parameter, environment variable, or rc file.
// eslint-disable-next-line no-global-assign
require = require('esm')(module/* , options */);
module.exports = require('./main.js');

38
node_modules/fetch-errors/main.js generated vendored Normal file
View File

@@ -0,0 +1,38 @@
export async function handleResponse (response) {
const contentType = response.headers.get('Content-Type');
const isJSON = contentType && contentType.match(/json/);
const data = isJSON ? await response.json() : await response.text();
if (response.ok) return data;
else {
return isJSON
? Promise.reject(new JSONHTTPError(response, data))
: Promise.reject(new TextHTTPError(response, data));
}
}
export class HTTPError extends Error {
constructor (response) {
super(response.statusText);
this.name = this.constructor.name;
if (typeof Error.captureStackTrace === 'function') {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error(response.statusText).stack;
}
this.status = response.status;
}
}
export class TextHTTPError extends HTTPError {
constructor (response, data) {
super(response);
this.data = data;
}
}
export class JSONHTTPError extends HTTPError {
constructor (response, json) {
super(response);
this.json = json;
}
}

68
node_modules/fetch-errors/package.json generated vendored Normal file
View File

@@ -0,0 +1,68 @@
{
"_from": "fetch-errors@^1.0.1",
"_id": "fetch-errors@1.0.1",
"_inBundle": false,
"_integrity": "sha512-3fCUICFQ4elSGcFYzzeip4fnio3RwixgfRJ9YUSOczax9PU/6TzdntlVZZE/q12k718OHlfRpCkWb1HHk7zf5Q==",
"_location": "/fetch-errors",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "fetch-errors@^1.0.1",
"name": "fetch-errors",
"escapedName": "fetch-errors",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/async-neocities-tmp"
],
"_resolved": "https://registry.npmjs.org/fetch-errors/-/fetch-errors-1.0.1.tgz",
"_shasum": "a9ab245b6960b2e4a3fe8e95c1013e49dc77cb7c",
"_spec": "fetch-errors@^1.0.1",
"_where": "/Users/bret/repos/deploy-to-neocities/node_modules/async-neocities-tmp",
"author": {
"name": "Bret Comnes",
"email": "bcomnes@gmail.com",
"url": "https://bret.io"
},
"bugs": {
"url": "https://github.com/bcomnes/fetch-errors/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "WIP - nothing to see here",
"devDependencies": {
"dependency-check": "^4.1.0",
"esm": "^3.2.25",
"node-fetch": "^2.6.0",
"npm-run-all": "^4.1.5",
"semistandard": "^14.2.0",
"tape": "^4.11.0",
"tape-promise": "^4.0.0"
},
"homepage": "https://github.com/bcomnes/fetch-errors",
"keywords": [],
"license": "MIT",
"main": "index.js",
"module": "main.js",
"name": "fetch-errors",
"repository": {
"type": "git",
"url": "git+https://github.com/bcomnes/fetch-errors.git"
},
"scripts": {
"test": "run-s test:*",
"test:deps": "dependency-check . --no-dev --no-peer",
"test:semistandard": "semistandard",
"test:tape": "tape -r esm test.js"
},
"semistandard": {
"ignore": [
"dist"
]
},
"version": "1.0.1"
}

18
node_modules/fetch-errors/test.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
import tape from 'tape';
import ptape from 'tape-promise';
import { handleResponse } from './main';
import fetch from 'node-fetch';
const test = ptape(tape);
test('handleResponse', async t => {
return fetch('https://api.github.com/users/bcomnes/repos')
.then(response => {
t.ok(response.ok);
return response;
})
.then(handleResponse)
.then(json => {
t.ok(json);
})
.catch(t.error);
});