From 720ecbfa14132928df467d11ef9b5d9029cc54fa Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Mon, 10 Feb 2020 13:21:06 -0700 Subject: [PATCH] bump --- node_modules/async-neocities-tmp/package.json | 24 ++++----- .../fetch-errors/.github/workflows/tests.yml | 2 +- node_modules/fetch-errors/CHANGELOG.md | 4 ++ node_modules/fetch-errors/README.md | 5 +- node_modules/fetch-errors/index.js | 49 +++++++++++++++++-- node_modules/fetch-errors/main.js | 38 -------------- node_modules/fetch-errors/package.json | 24 +++++---- node_modules/fetch-errors/test.js | 8 +-- package.json | 2 +- 9 files changed, 80 insertions(+), 76 deletions(-) delete mode 100644 node_modules/fetch-errors/main.js diff --git a/node_modules/async-neocities-tmp/package.json b/node_modules/async-neocities-tmp/package.json index deb636a..eef9ef5 100644 --- a/node_modules/async-neocities-tmp/package.json +++ b/node_modules/async-neocities-tmp/package.json @@ -1,26 +1,26 @@ { - "_from": "async-neocities-tmp@0.0.2", - "_id": "async-neocities-tmp@0.0.2", + "_from": "async-neocities-tmp@^0.0.4", + "_id": "async-neocities-tmp@0.0.4", "_inBundle": false, - "_integrity": "sha512-MP8zp6gdM92e9cODhDtBHu9n6XwiwlIG1/rgqalTu3wYdfTNwJtzXKNUWvdy934R+oeLk6mfGywQGM4YdnHHnw==", + "_integrity": "sha512-sJMy3T04IDDxAVBZkqGcGy9NjFMW/rdCA8LC7tCgWYQA6/cGhjrnB85EVcjNWqjekEuogSTwrurblp7ZQxU5ww==", "_location": "/async-neocities-tmp", "_phantomChildren": {}, "_requested": { - "type": "version", + "type": "range", "registry": true, - "raw": "async-neocities-tmp@0.0.2", + "raw": "async-neocities-tmp@^0.0.4", "name": "async-neocities-tmp", "escapedName": "async-neocities-tmp", - "rawSpec": "0.0.2", + "rawSpec": "^0.0.4", "saveSpec": null, - "fetchSpec": "0.0.2" + "fetchSpec": "^0.0.4" }, "_requiredBy": [ "/" ], - "_resolved": "https://registry.npmjs.org/async-neocities-tmp/-/async-neocities-tmp-0.0.2.tgz", - "_shasum": "b7cf75f9c61700e512d670143f4ab9c1b0b34f0d", - "_spec": "async-neocities-tmp@0.0.2", + "_resolved": "https://registry.npmjs.org/async-neocities-tmp/-/async-neocities-tmp-0.0.4.tgz", + "_shasum": "f0a2075db8899d149ccf3b8c2fc1893505e7ef3f", + "_spec": "async-neocities-tmp@^0.0.4", "_where": "/Users/bret/repos/deploy-to-neocities", "author": { "name": "Bret Comnes", @@ -33,7 +33,7 @@ "bundleDependencies": false, "dependencies": { "async-folder-walker": "^2.0.1", - "fetch-errors": "^1.0.1", + "fetch-errors": "^2.0.1", "form-data": "^3.0.0", "nanoassert": "^2.0.0", "node-fetch": "^2.6.0", @@ -68,5 +68,5 @@ "dist" ] }, - "version": "0.0.2" + "version": "0.0.4" } diff --git a/node_modules/fetch-errors/.github/workflows/tests.yml b/node_modules/fetch-errors/.github/workflows/tests.yml index 983ff04..0dd1b93 100644 --- a/node_modules/fetch-errors/.github/workflows/tests.yml +++ b/node_modules/fetch-errors/.github/workflows/tests.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [12.x] steps: - uses: actions/checkout@v1 diff --git a/node_modules/fetch-errors/CHANGELOG.md b/node_modules/fetch-errors/CHANGELOG.md index 49d2dd9..ebd1941 100644 --- a/node_modules/fetch-errors/CHANGELOG.md +++ b/node_modules/fetch-errors/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 2.0.0 - 2020-02-10 + +* Remove esm, export CJS. ESM doesn't provide any advantage in Node.js modueles. + ## 1.0.1 - 2019-11-19 * Add missing devdep. diff --git a/node_modules/fetch-errors/README.md b/node_modules/fetch-errors/README.md index a3a1974..506a823 100644 --- a/node_modules/fetch-errors/README.md +++ b/node_modules/fetch-errors/README.md @@ -1,6 +1,5 @@ # 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. @@ -11,12 +10,12 @@ npm install fetch-errors ## Usage ``` js -import { +const { HTTPError, TextHTTPError, JSONHTTPError, handleResponse -} from 'fetch-errors'; +} = require('fetch-errors'); window.fetch('https://api.github.com/users/bcomnes/repos') .then(handleResponse) diff --git a/node_modules/fetch-errors/index.js b/node_modules/fetch-errors/index.js index 1cb0d29..883f14c 100644 --- a/node_modules/fetch-errors/index.js +++ b/node_modules/fetch-errors/index.js @@ -1,4 +1,45 @@ -// 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'); +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)); + } +} + +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; + } +} + +class TextHTTPError extends HTTPError { + constructor (response, data) { + super(response); + this.data = data; + } +} + +class JSONHTTPError extends HTTPError { + constructor (response, json) { + super(response); + this.json = json; + } +} + +module.exports = { + handleResponse, + HTTPError, + TextHTTPError, + JSONHTTPError +}; diff --git a/node_modules/fetch-errors/main.js b/node_modules/fetch-errors/main.js deleted file mode 100644 index ff61cc1..0000000 --- a/node_modules/fetch-errors/main.js +++ /dev/null @@ -1,38 +0,0 @@ -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; - } -} diff --git a/node_modules/fetch-errors/package.json b/node_modules/fetch-errors/package.json index 7941f84..6f58bec 100644 --- a/node_modules/fetch-errors/package.json +++ b/node_modules/fetch-errors/package.json @@ -1,26 +1,26 @@ { - "_from": "fetch-errors@^1.0.1", - "_id": "fetch-errors@1.0.1", + "_from": "fetch-errors@^2.0.1", + "_id": "fetch-errors@2.0.1", "_inBundle": false, - "_integrity": "sha512-3fCUICFQ4elSGcFYzzeip4fnio3RwixgfRJ9YUSOczax9PU/6TzdntlVZZE/q12k718OHlfRpCkWb1HHk7zf5Q==", + "_integrity": "sha512-U+pPCefRg8OwN0VARqAOCEyJs+kbSusskhW3XQPYCQMBUUNy3VtK9OYyySlybDQmMkZzqxWlGY9SjKCve1saJw==", "_location": "/fetch-errors", "_phantomChildren": {}, "_requested": { "type": "range", "registry": true, - "raw": "fetch-errors@^1.0.1", + "raw": "fetch-errors@^2.0.1", "name": "fetch-errors", "escapedName": "fetch-errors", - "rawSpec": "^1.0.1", + "rawSpec": "^2.0.1", "saveSpec": null, - "fetchSpec": "^1.0.1" + "fetchSpec": "^2.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", + "_resolved": "https://registry.npmjs.org/fetch-errors/-/fetch-errors-2.0.1.tgz", + "_shasum": "26616c7c22a0a386155ba8e53af27f98960e47dc", + "_spec": "fetch-errors@^2.0.1", "_where": "/Users/bret/repos/deploy-to-neocities/node_modules/async-neocities-tmp", "author": { "name": "Bret Comnes", @@ -36,7 +36,6 @@ "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", @@ -47,7 +46,6 @@ "keywords": [], "license": "MIT", "main": "index.js", - "module": "main.js", "name": "fetch-errors", "repository": { "type": "git", @@ -57,12 +55,12 @@ "test": "run-s test:*", "test:deps": "dependency-check . --no-dev --no-peer", "test:semistandard": "semistandard", - "test:tape": "tape -r esm test.js" + "test:tape": "tape test.js" }, "semistandard": { "ignore": [ "dist" ] }, - "version": "1.0.1" + "version": "2.0.1" } diff --git a/node_modules/fetch-errors/test.js b/node_modules/fetch-errors/test.js index eb1d6a2..de00964 100644 --- a/node_modules/fetch-errors/test.js +++ b/node_modules/fetch-errors/test.js @@ -1,7 +1,7 @@ -import tape from 'tape'; -import ptape from 'tape-promise'; -import { handleResponse } from './main'; -import fetch from 'node-fetch'; +const tape = require('tape'); +const ptape = require('tape-promise').default; +const { handleResponse } = require('.'); +const fetch = require('node-fetch'); const test = ptape(tape); test('handleResponse', async t => { diff --git a/package.json b/package.json index 04e6285..aa8df87 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "dependencies": { "@actions/core": "^1.2.2", "@actions/github": "^2.1.0", - "async-neocities-tmp": "0.0.2" + "async-neocities-tmp": "^0.0.4" }, "standard": { "ignore": [