@vltpkg/error-cause
Advanced tools
@@ -66,3 +66,3 @@ import type { IncomingHttpHeaders, IncomingMessage } from 'http'; | ||
| */ | ||
| validOptions?: unknown[]; | ||
| validOptions?: unknown[] | readonly unknown[]; | ||
| /** | ||
@@ -69,0 +69,0 @@ * message indicating what bit of work this might be a part of, what feature |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAEhE;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IAEf,4BAA4B;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf;;;;OAIG;IACH,IAAI,CAAC,EAAE,KAAK,CAAA;IAEZ,wCAAwC;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAA;IAEf,8DAA8D;IAC9D,IAAI,CAAC,EACD,MAAM,GACN;QACE,IAAI,EACA,MAAM,GACN,KAAK,GACL,UAAU,GACV,QAAQ,GACR,WAAW,GACX,SAAS,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,GAAG,CAAA;KACnC,CAAA;IAEL,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAEtB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;IAE9B,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,iDAAiD;IACjD,GAAG,C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IAE5B,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1D,iBAAiB,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAC7B,OAAO,EAAE,CAAA;AACX,CAAC;AAiBD,MAAM,UAAU,KAAK,CACnB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACnD,CAAC;AAiBD,MAAM,UAAU,SAAS,CACvB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CAAY,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACtE,CAAC;AAiBD,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CACX,WAAW,EACX,WAAW,EACX,OAAO,EACP,KAAK,EACL,IAAI,CACL,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-function-type */\n\nimport type { IncomingHttpHeaders, IncomingMessage } from 'http'\n\n/**\n * Codification of vlt's Error.cause conventions\n *\n * Add new properties to this list as needed.\n *\n * Several of these types are just very basic duck-typing, because referencing\n * internal types directly would create a workspace dependency cycle.\n */\nexport type ErrorCauseOptions = {\n /**\n * The `cause` field within a `cause` object should\n * always be an `Error` object that was previously thrown. Note\n * that the `cause` on an Error itself might _also_ be a\n * previously thrown error, if no additional information could be\n * usefully added beyond improving the message. It is typed as `unknown`\n * because we use `useUnknownInCatchVariables` so this makes it easier\n * to rethrow a caught error without recasting it.\n */\n cause?: unknown\n\n /** the name of something */\n name?: string\n\n /** byte offset in a Buffer or file */\n offset?: number\n\n /**\n * This should only be a string code that we set. See {@link Codes} for\n * the supported options. Lower-level system codes like `ENOENT` should\n * remain on the errors that generated them.\n */\n code?: Codes\n\n /** target of a file system operation */\n path?: string\n\n /**\n * file path origin of a resolution that failed, for example in the case\n * of `file://` specifiers.\n */\n from?: string\n\n /** path on disk that is being written, linked, or extracted to */\n target?: string\n\n /** Spec object/string relevant to an operation that failed */\n spec?:\n | string\n | {\n type:\n | 'file'\n | 'git'\n | 'registry'\n | 'remote'\n | 'workspace'\n | 'catalog'\n spec: string\n [k: number | string | symbol]: any\n }\n\n /** exit code of a process, or HTTP response status code */\n status?: number | null\n\n /** null or a signal that a process received */\n signal?: NodeJS.Signals | null\n\n /** the root of a project */\n projectRoot?: string\n\n /** the current working directory of a process */\n cwd?: string\n\n /** a command being run in a child process */\n command?: string\n\n /** the arguments passed to a process */\n args?: string[]\n\n /** standard output from a process */\n stdout?: Buffer | string | null\n\n /** standard error from a process */\n stderr?: Buffer | string | null\n\n /**\n * Array of valid options when something is not a valid option.\n * (For use in `did you mean X?` output.)\n */\n validOptions?: unknown[]\n\n /**\n * message indicating what bit of work this might be a part of, what feature\n * needs to be implemented, etc. Eg, `{ todo: 'nested workspace support' }`.\n */\n todo?: string\n\n /**\n * A desired value that was not found, or a regular expression or other\n * pattern describing it.\n */\n wanted?: unknown\n\n /** actual value, which was not wanted */\n found?: unknown\n\n /** HTTP message, fetch.Response, or `@vltpkg/registry-client.CacheEntry` */\n response?:\n | IncomingMessage\n | Response\n | {\n statusCode: number\n headers?:\n | Buffer[]\n | Record<string, string[] | string>\n | IncomingHttpHeaders\n text?: () => string\n [k: number | string | symbol]: any\n }\n\n /** string or URL object */\n url?: URL | string\n\n /** HTTP method */\n method?: string\n\n /** git repository remote or path */\n repository?: string\n\n /** string or `@vltpkg/semver.Version` object */\n version?:\n | string\n | {\n raw: string\n major: number\n minor: number\n patch: number\n [k: number | string | symbol]: any\n }\n\n /** string or `@vltpkg/semver.Range` object */\n range?:\n | string\n | {\n raw: string\n isAny: boolean\n includePrerelease: boolean\n [k: number | string | symbol]: any\n }\n\n /** a package manifest, either from `package.json` or a registry */\n manifest?: DuckTypeManifest\n\n /** registry top-level package document */\n packument?: {\n name: string\n 'dist-tags': Record<string, string>\n versions: Record<string, DuckTypeManifest>\n time?: Record<string, string>\n }\n\n /** maximum value, which was exceeded */\n max?: unknown\n\n /** minimum value, which was not met */\n min?: unknown\n}\n\nexport type DuckTypeManifest = Record<string, any> & {\n name?: string\n version?: string\n deprecated?: string\n engines?: Record<string, string>\n os?: string[] | string\n arch?: string[] | string\n dist?: {\n integrity?: string\n shasum?: string\n tarball?: string\n fileCount?: number\n unpackedSize?: number\n signatures?: {\n keyid: string\n sig: string\n }[]\n }\n}\n\n/**\n * Valid properties for the 'code' field in an Error cause.\n * Add new options to this list as needed.\n */\nexport type Codes =\n | 'EEXIST'\n | 'EINTEGRITY'\n | 'EINVAL'\n | 'ELIFECYCLE'\n | 'EMAXREDIRECT'\n | 'ENEEDAUTH'\n | 'ENOENT'\n | 'ENOGIT'\n | 'ERESOLVE'\n | 'EUNKNOWN'\n | 'EUSAGE'\n | 'EREQUEST'\n | 'ECONFIG'\n\n// `captureStackTrace` is non-standard so explicitly type it as possibly\n// undefined since it might be in browsers.\nconst { captureStackTrace } = Error as {\n captureStackTrace?: ErrorConstructor['captureStackTrace']\n}\n\nexport type ErrorCtor<T extends Error> = new (\n message: string,\n options?: { cause: Error | ErrorCauseOptions },\n) => T\n\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: undefined,\n from?: Function,\n): T\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: Error,\n from?: Function,\n): T & { cause: Error }\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: ErrorCauseOptions,\n from?: Function,\n): T & { cause: ErrorCauseOptions }\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: Error | ErrorCauseOptions,\n from: Function = defaultFrom,\n) {\n const er = new cls(message, cause ? { cause } : undefined)\n captureStackTrace?.(er, from)\n return er\n}\n\nexport function error(\n message: string,\n cause?: undefined,\n from?: Function,\n): Error\nexport function error(\n message: string,\n cause: Error,\n from?: Function,\n): Error & { cause: Error }\nexport function error(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): Error & { cause: ErrorCauseOptions }\nexport function error(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create(Error, error, message, cause, from)\n}\n\nexport function typeError(\n message: string,\n cause?: undefined,\n from?: Function,\n): TypeError\nexport function typeError(\n message: string,\n cause: Error,\n from?: Function,\n): TypeError & { cause: Error }\nexport function typeError(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): TypeError & { cause: ErrorCauseOptions }\nexport function typeError(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create<TypeError>(TypeError, typeError, message, cause, from)\n}\n\nexport function syntaxError(\n message: string,\n cause?: undefined,\n from?: Function,\n): SyntaxError\nexport function syntaxError(\n message: string,\n cause: Error,\n from?: Function,\n): SyntaxError & { cause: Error }\nexport function syntaxError(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): SyntaxError & { cause: ErrorCauseOptions }\nexport function syntaxError(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create<SyntaxError>(\n SyntaxError,\n syntaxError,\n message,\n cause,\n from,\n )\n}\n"]} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAkN/D,wEAAwE;AACxE,2CAA2C;AAC3C,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAE7B,CAAA;AA4BD,SAAS,MAAM,CACb,GAAiB,EACjB,WAAqB,EACrB,OAAe,EACf,KAAiC,EACjC,OAAiB,WAAW;IAE5B,MAAM,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;IAC1D,iBAAiB,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAC7B,OAAO,EAAE,CAAA;AACX,CAAC;AAiBD,MAAM,UAAU,KAAK,CACnB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACnD,CAAC;AAiBD,MAAM,UAAU,SAAS,CACvB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CAAY,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AACtE,CAAC;AAiBD,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,KAAiC,EACjC,IAAe;IAEf,OAAO,MAAM,CACX,WAAW,EACX,WAAW,EACX,OAAO,EACP,KAAK,EACL,IAAI,CACL,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-function-type */\n\nimport type { IncomingHttpHeaders, IncomingMessage } from 'http'\n\n/**\n * Codification of vlt's Error.cause conventions\n *\n * Add new properties to this list as needed.\n *\n * Several of these types are just very basic duck-typing, because referencing\n * internal types directly would create a workspace dependency cycle.\n */\nexport type ErrorCauseOptions = {\n /**\n * The `cause` field within a `cause` object should\n * always be an `Error` object that was previously thrown. Note\n * that the `cause` on an Error itself might _also_ be a\n * previously thrown error, if no additional information could be\n * usefully added beyond improving the message. It is typed as `unknown`\n * because we use `useUnknownInCatchVariables` so this makes it easier\n * to rethrow a caught error without recasting it.\n */\n cause?: unknown\n\n /** the name of something */\n name?: string\n\n /** byte offset in a Buffer or file */\n offset?: number\n\n /**\n * This should only be a string code that we set. See {@link Codes} for\n * the supported options. Lower-level system codes like `ENOENT` should\n * remain on the errors that generated them.\n */\n code?: Codes\n\n /** target of a file system operation */\n path?: string\n\n /**\n * file path origin of a resolution that failed, for example in the case\n * of `file://` specifiers.\n */\n from?: string\n\n /** path on disk that is being written, linked, or extracted to */\n target?: string\n\n /** Spec object/string relevant to an operation that failed */\n spec?:\n | string\n | {\n type:\n | 'file'\n | 'git'\n | 'registry'\n | 'remote'\n | 'workspace'\n | 'catalog'\n spec: string\n [k: number | string | symbol]: any\n }\n\n /** exit code of a process, or HTTP response status code */\n status?: number | null\n\n /** null or a signal that a process received */\n signal?: NodeJS.Signals | null\n\n /** the root of a project */\n projectRoot?: string\n\n /** the current working directory of a process */\n cwd?: string\n\n /** a command being run in a child process */\n command?: string\n\n /** the arguments passed to a process */\n args?: string[]\n\n /** standard output from a process */\n stdout?: Buffer | string | null\n\n /** standard error from a process */\n stderr?: Buffer | string | null\n\n /**\n * Array of valid options when something is not a valid option.\n * (For use in `did you mean X?` output.)\n */\n validOptions?: unknown[] | readonly unknown[]\n\n /**\n * message indicating what bit of work this might be a part of, what feature\n * needs to be implemented, etc. Eg, `{ todo: 'nested workspace support' }`.\n */\n todo?: string\n\n /**\n * A desired value that was not found, or a regular expression or other\n * pattern describing it.\n */\n wanted?: unknown\n\n /** actual value, which was not wanted */\n found?: unknown\n\n /** HTTP message, fetch.Response, or `@vltpkg/registry-client.CacheEntry` */\n response?:\n | IncomingMessage\n | Response\n | {\n statusCode: number\n headers?:\n | Buffer[]\n | Record<string, string[] | string>\n | IncomingHttpHeaders\n text?: () => string\n [k: number | string | symbol]: any\n }\n\n /** string or URL object */\n url?: URL | string\n\n /** HTTP method */\n method?: string\n\n /** git repository remote or path */\n repository?: string\n\n /** string or `@vltpkg/semver.Version` object */\n version?:\n | string\n | {\n raw: string\n major: number\n minor: number\n patch: number\n [k: number | string | symbol]: any\n }\n\n /** string or `@vltpkg/semver.Range` object */\n range?:\n | string\n | {\n raw: string\n isAny: boolean\n includePrerelease: boolean\n [k: number | string | symbol]: any\n }\n\n /** a package manifest, either from `package.json` or a registry */\n manifest?: DuckTypeManifest\n\n /** registry top-level package document */\n packument?: {\n name: string\n 'dist-tags': Record<string, string>\n versions: Record<string, DuckTypeManifest>\n time?: Record<string, string>\n }\n\n /** maximum value, which was exceeded */\n max?: unknown\n\n /** minimum value, which was not met */\n min?: unknown\n}\n\nexport type DuckTypeManifest = Record<string, any> & {\n name?: string\n version?: string\n deprecated?: string\n engines?: Record<string, string>\n os?: string[] | string\n arch?: string[] | string\n dist?: {\n integrity?: string\n shasum?: string\n tarball?: string\n fileCount?: number\n unpackedSize?: number\n signatures?: {\n keyid: string\n sig: string\n }[]\n }\n}\n\n/**\n * Valid properties for the 'code' field in an Error cause.\n * Add new options to this list as needed.\n */\nexport type Codes =\n | 'EEXIST'\n | 'EINTEGRITY'\n | 'EINVAL'\n | 'ELIFECYCLE'\n | 'EMAXREDIRECT'\n | 'ENEEDAUTH'\n | 'ENOENT'\n | 'ENOGIT'\n | 'ERESOLVE'\n | 'EUNKNOWN'\n | 'EUSAGE'\n | 'EREQUEST'\n | 'ECONFIG'\n\n// `captureStackTrace` is non-standard so explicitly type it as possibly\n// undefined since it might be in browsers.\nconst { captureStackTrace } = Error as {\n captureStackTrace?: ErrorConstructor['captureStackTrace']\n}\n\nexport type ErrorCtor<T extends Error> = new (\n message: string,\n options?: { cause: Error | ErrorCauseOptions },\n) => T\n\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: undefined,\n from?: Function,\n): T\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: Error,\n from?: Function,\n): T & { cause: Error }\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: ErrorCauseOptions,\n from?: Function,\n): T & { cause: ErrorCauseOptions }\nfunction create<T extends Error>(\n cls: ErrorCtor<T>,\n defaultFrom: Function,\n message: string,\n cause?: Error | ErrorCauseOptions,\n from: Function = defaultFrom,\n) {\n const er = new cls(message, cause ? { cause } : undefined)\n captureStackTrace?.(er, from)\n return er\n}\n\nexport function error(\n message: string,\n cause?: undefined,\n from?: Function,\n): Error\nexport function error(\n message: string,\n cause: Error,\n from?: Function,\n): Error & { cause: Error }\nexport function error(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): Error & { cause: ErrorCauseOptions }\nexport function error(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create(Error, error, message, cause, from)\n}\n\nexport function typeError(\n message: string,\n cause?: undefined,\n from?: Function,\n): TypeError\nexport function typeError(\n message: string,\n cause: Error,\n from?: Function,\n): TypeError & { cause: Error }\nexport function typeError(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): TypeError & { cause: ErrorCauseOptions }\nexport function typeError(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create<TypeError>(TypeError, typeError, message, cause, from)\n}\n\nexport function syntaxError(\n message: string,\n cause?: undefined,\n from?: Function,\n): SyntaxError\nexport function syntaxError(\n message: string,\n cause: Error,\n from?: Function,\n): SyntaxError & { cause: Error }\nexport function syntaxError(\n message: string,\n cause: ErrorCauseOptions,\n from?: Function,\n): SyntaxError & { cause: ErrorCauseOptions }\nexport function syntaxError(\n message: string,\n cause?: Error | ErrorCauseOptions,\n from?: Function,\n) {\n return create<SyntaxError>(\n SyntaxError,\n syntaxError,\n message,\n cause,\n from,\n )\n}\n"]} |
+1
-1
| { | ||
| "name": "@vltpkg/error-cause", | ||
| "description": "vlts Error.cause convention", | ||
| "version": "0.0.0-16", | ||
| "version": "0.0.0-17", | ||
| "repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
35632
0.17%