From 726b81b19251674e149ccfbb1abacbd837fc6db0 Mon Sep 17 00:00:00 2001 From: LinuxWizard42 Date: Wed, 12 Oct 2022 23:08:57 +0300 Subject: Removed files that should not have been included in git --- node_modules/serialize-error/index.d.ts | 58 ----------------- node_modules/serialize-error/index.js | 101 ------------------------------ node_modules/serialize-error/license | 9 --- node_modules/serialize-error/package.json | 41 ------------ node_modules/serialize-error/readme.md | 55 ---------------- 5 files changed, 264 deletions(-) delete mode 100644 node_modules/serialize-error/index.d.ts delete mode 100644 node_modules/serialize-error/index.js delete mode 100644 node_modules/serialize-error/license delete mode 100644 node_modules/serialize-error/package.json delete mode 100644 node_modules/serialize-error/readme.md (limited to 'node_modules/serialize-error') diff --git a/node_modules/serialize-error/index.d.ts b/node_modules/serialize-error/index.d.ts deleted file mode 100644 index 714dc9f..0000000 --- a/node_modules/serialize-error/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -import {Primitive, JsonObject} from 'type-fest'; - -export type ErrorObject = { - name?: string; - stack?: string; - message?: string; - code?: string; -} & JsonObject; - -/** -Serialize an `Error` object into a plain object. - -Non-error values are passed through. -Custom properties are preserved. -Circular references are handled. - -@example -``` -import {serializeError} from 'serialize-error'; - -const error = new Error('🦄'); - -console.log(error); -//=> [Error: 🦄] - -console.log(serializeError(error)); -//=> {name: 'Error', message: '🦄', stack: 'Error: 🦄\n at Object. …'} -``` -*/ -export function serializeError(error: ErrorType): ErrorType extends Primitive - ? ErrorType - : ErrorObject; - -/** -Deserialize a plain object or any value into an `Error` object. - -`Error` objects are passed through. -Non-error values are wrapped in a `NonError` error. -Custom properties are preserved. -Non-enumerable properties are kept non-enumerable (name, message, stack). -Enumerable properties are kept enumerable (all properties besides the non-enumerable ones). -Circular references are handled. - -@example -``` -import {deserializeError} from 'serialize-error'; - -const error = deserializeError({ - message: 'aaa', - stack: 'at :1:13' -}); - -console.log(error); -// Error: aaa -// at :1:13 -``` -*/ -export function deserializeError(errorObject: ErrorObject | unknown): Error; diff --git a/node_modules/serialize-error/index.js b/node_modules/serialize-error/index.js deleted file mode 100644 index 508c6a2..0000000 --- a/node_modules/serialize-error/index.js +++ /dev/null @@ -1,101 +0,0 @@ -'use strict'; - -class NonError extends Error { - constructor(message) { - super(NonError._prepareSuperMessage(message)); - Object.defineProperty(this, 'name', { - value: 'NonError', - configurable: true, - writable: true - }); - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, NonError); - } - } - - static _prepareSuperMessage(message) { - try { - return JSON.stringify(message); - } catch (_) { - return String(message); - } - } -} - -const commonProperties = [ - {property: 'name', enumerable: false}, - {property: 'message', enumerable: false}, - {property: 'stack', enumerable: false}, - {property: 'code', enumerable: true} -]; - -const destroyCircular = ({from, seen, to_, forceEnumerable}) => { - const to = to_ || (Array.isArray(from) ? [] : {}); - - seen.push(from); - - for (const [key, value] of Object.entries(from)) { - if (typeof value === 'function') { - continue; - } - - if (!value || typeof value !== 'object') { - to[key] = value; - continue; - } - - if (!seen.includes(from[key])) { - to[key] = destroyCircular({from: from[key], seen: seen.slice(), forceEnumerable}); - continue; - } - - to[key] = '[Circular]'; - } - - for (const {property, enumerable} of commonProperties) { - if (typeof from[property] === 'string') { - Object.defineProperty(to, property, { - value: from[property], - enumerable: forceEnumerable ? true : enumerable, - configurable: true, - writable: true - }); - } - } - - return to; -}; - -const serializeError = value => { - if (typeof value === 'object' && value !== null) { - return destroyCircular({from: value, seen: [], forceEnumerable: true}); - } - - // People sometimes throw things besides Error objects… - if (typeof value === 'function') { - // `JSON.stringify()` discards functions. We do too, unless a function is thrown directly. - return `[Function: ${(value.name || 'anonymous')}]`; - } - - return value; -}; - -const deserializeError = value => { - if (value instanceof Error) { - return value; - } - - if (typeof value === 'object' && value !== null && !Array.isArray(value)) { - const newError = new Error(); - destroyCircular({from: value, seen: [], to_: newError}); - return newError; - } - - return new NonError(value); -}; - -module.exports = { - serializeError, - deserializeError -}; diff --git a/node_modules/serialize-error/license b/node_modules/serialize-error/license deleted file mode 100644 index fa7ceba..0000000 --- a/node_modules/serialize-error/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (https://sindresorhus.com) - -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. diff --git a/node_modules/serialize-error/package.json b/node_modules/serialize-error/package.json deleted file mode 100644 index 8caa8eb..0000000 --- a/node_modules/serialize-error/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "serialize-error", - "version": "7.0.1", - "description": "Serialize/deserialize an error into a plain object", - "license": "MIT", - "repository": "sindresorhus/serialize-error", - "funding": "https://github.com/sponsors/sindresorhus", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" - }, - "engines": { - "node": ">=10" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "error", - "serialize", - "stringify", - "object", - "convert", - "process", - "send", - "deserialize" - ], - "dependencies": { - "type-fest": "^0.13.1" - }, - "devDependencies": { - "ava": "^2.4.0", - "tsd": "^0.11.0", - "xo": "^0.30.0" - } -} diff --git a/node_modules/serialize-error/readme.md b/node_modules/serialize-error/readme.md deleted file mode 100644 index d27f004..0000000 --- a/node_modules/serialize-error/readme.md +++ /dev/null @@ -1,55 +0,0 @@ -# serialize-error [![Build Status](https://travis-ci.org/sindresorhus/serialize-error.svg?branch=master)](https://travis-ci.org/sindresorhus/serialize-error) - -> Serialize/deserialize an error into a plain object - -Useful if you for example need to `JSON.stringify()` or `process.send()` the error. - -## Install - -``` -$ npm install serialize-error -``` - -## Usage - -```js -const {serializeError, deserializeError} = require('serialize-error'); - -const error = new Error('🦄'); - -console.log(error); -//=> [Error: 🦄] - -const serialized = serializeError(error) - -console.log(serialized); -//=> {name: 'Error', message: '🦄', stack: 'Error: 🦄\n at Object. …'} - -const deserialized = deserializeError(serialized); -//=> [Error: 🦄] -``` - -## API - -### serializeError(value) - -Type: `Error | unknown` - -Serialize an `Error` object into a plain object. - -Non-error values are passed through. -Custom properties are preserved. -Non-enumerable properties are kept non-enumerable (name, message, stack). -Enumerable properties are kept enumerable (all properties besides the non-enumerable ones). -Circular references are handled. - -### deserializeError(value) - -Type: `{[key: string]: unknown} | unknown` - -Deserialize a plain object or any value into an `Error` object. - -`Error` objects are passed through. -Non-error values are wrapped in a `NonError` error. -Custom properties are preserved. -Circular references are handled. -- cgit v1.2.3-86-g962b