From 6d2d7a3db07730b706ed39b7b61e732b3f8d698b Mon Sep 17 00:00:00 2001 From: Alexander T Date: Tue, 29 Oct 2019 17:00:26 +0200 Subject: [PATCH] stacktrace-js: Provides its own types (#39547) --- notNeededPackages.json | 6 ++ types/stacktrace-js/index.d.ts | 107 --------------------- types/stacktrace-js/stacktrace-js-tests.ts | 37 ------- types/stacktrace-js/tsconfig.json | 24 ----- types/stacktrace-js/tslint.json | 80 --------------- 5 files changed, 6 insertions(+), 248 deletions(-) delete mode 100644 types/stacktrace-js/index.d.ts delete mode 100644 types/stacktrace-js/stacktrace-js-tests.ts delete mode 100644 types/stacktrace-js/tsconfig.json delete mode 100644 types/stacktrace-js/tslint.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 6237f2d4a1..85a387b016 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -3876,6 +3876,12 @@ "sourceRepoURL": "https://servicestack.net/", "asOfVersion": "0.1.5" }, + { + "libraryName": "stacktrace-js", + "typingsPackageName": "stacktrace-js", + "sourceRepoURL": "https://github.com/stacktracejs/stacktrace.js", + "asOfVersion": "2.0.1" + }, { "libraryName": "stellar-sdk", "typingsPackageName": "stellar-sdk", diff --git a/types/stacktrace-js/index.d.ts b/types/stacktrace-js/index.d.ts deleted file mode 100644 index 30baf18045..0000000000 --- a/types/stacktrace-js/index.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -// Type definitions for stacktrace.js -// Project: https://github.com/stacktracejs/stacktrace.js -// Definitions by: Exceptionless -// Chun-Yan Ho -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace StackTrace { - - export interface SourceCache { - [key: string]: string | Promise; - } - - /** - * Options for StackTrace - * @param filter Function(StackFrame => Boolean) - Only include stack entries matching for which filter returns true - * @param sourceCache Object (String URL => String Source) - Pre-populate source cache to avoid network requests - * @param offline Boolean (default: false) - Set to true to prevent all network requests - */ - export interface StackTraceOptions { - filter?: (stackFrame: StackFrame) => boolean; - sourceCache?: SourceCache; - offline?: boolean; - } - - export class StackFrame { - constructor(functionName: string, args: any, fileName: string, lineNumber: number, columnNumber: number); - - functionName: string; - args: any; - fileName: string; - lineNumber: number; - columnNumber: number; - source: string; - isEval: boolean; - isNative: boolean; - toString(): string; - } - - export interface RequestOptions { - headers: { [id: string]: string }; - } - - /** - * Get a backtrace from invocation point. - * @param options Options Object - * @return Array[StackFrame] - */ - export function get(options?: StackTraceOptions): Promise; - - /** - * Get a backtrace from invocation point synchronously. - * @param options Options Object - * @return Array[StackFrame] - */ - export function getSync(options?: StackTraceOptions): StackFrame[]; - - /** - * Given an error object, parse it. - * @param error Error object - * @param options Object for options - * @return Array[StackFrame] - */ - export function fromError(error: Error, options?: StackTraceOptions): Promise; - - /** - * Use StackGenerator to generate a backtrace. - * @param options Object options - * @returns Array[StackFrame] - */ - export function generateArtificially(options?: StackTraceOptions): Promise; - - /** - * Given a function, wrap it such that invocations trigger a callback that - * is called with a stack trace. - * - * @param {Function} fn to be instrumented - * @param {Function} callback function to call with a stack trace on invocation - * @param {Function} errback optional function to call with error if unable to get stack trace. - * @param {Object} thisArg optional context object (e.g. window) - * @return {Function} instrumented function - */ - export function instrument(fn: TFunc, callback: (stackFrames: StackFrame[]) => void, errback?: (error: Error) => void, thisArg?: any): TFunc; - - /** - * Given a function that has been instrumented, - * revert the function to it's original (non-instrumented) state. - * - * @param fn {Function} - * @return {Function} original function - */ - export function deinstrument(fn: TFunc): TFunc; - - /** - * Given an Array of StackFrames, serialize and POST to given URL. - * - * @param {Array} stackframes - Previously wrapped Function - * @param {string} url - URL to POST stack JSON to - * @param {string} message - Optional Error message - * @param {Object} requestOptions - Request Headers {headers: {key: "value"}} - * @return {Promise} - Promise is resolved with response text from POST request. - */ - export function report(stackframes: StackFrame[], url: string, message?: string, requestOptions?: RequestOptions): Promise; -} - -declare module "stacktrace-js" { - export = StackTrace; -} diff --git a/types/stacktrace-js/stacktrace-js-tests.ts b/types/stacktrace-js/stacktrace-js-tests.ts deleted file mode 100644 index 6fac703c7f..0000000000 --- a/types/stacktrace-js/stacktrace-js-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ - - -function interestingFn(): string { - return 'https://github.com/exceptionless/Exceptionless'; -} - -const callback = (stackframes: StackTrace.StackFrame[]) => { - const stringifiedStack = stackframes.map((sf: StackTrace.StackFrame): string => { - console.log(sf.functionName); - console.log(sf.args); - console.log(sf.fileName); - console.log(sf.lineNumber); - console.log(sf.columnNumber); - console.log(sf.source); - console.log(sf.isEval); - console.log(sf.isNative); - return sf.toString(); - }).join('\n'); - console.log(stringifiedStack); -}; - -const errorCallback = (err: Error) => console.log(err.message); -const logger = (stackframes: StackTrace.StackFrame[]) => console.log(stackframes); -const options: StackTrace.StackTraceOptions = { - filter: (stackframe: StackTrace.StackFrame) => true, - sourceCache: {}, - offline: false -}; -const error = new Error('BOOM!'); - -StackTrace.get(options).then(logger); -logger(StackTrace.getSync(options)) -StackTrace.fromError(error, options).then(logger); -StackTrace.generateArtificially(options).then(logger); - -const instrumented: () => string = StackTrace.instrument(interestingFn, callback, errorCallback); -const original: () => string = StackTrace.deinstrument(interestingFn); diff --git a/types/stacktrace-js/tsconfig.json b/types/stacktrace-js/tsconfig.json deleted file mode 100644 index bbc97ddb49..0000000000 --- a/types/stacktrace-js/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "stacktrace-js-tests.ts" - ] -} \ No newline at end of file diff --git a/types/stacktrace-js/tslint.json b/types/stacktrace-js/tslint.json deleted file mode 100644 index 3d59f55fda..0000000000 --- a/types/stacktrace-js/tslint.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "npm-naming": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -}