Skip to content

Commit bbe13cc

Browse files
committed
chore: update @hawk.so/types to version 0.1.36 and use constant for console methods
1 parent 303502b commit bbe13cc

3 files changed

Lines changed: 20 additions & 10 deletions

File tree

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747
"vue": "^2"
4848
},
4949
"dependencies": {
50-
"@hawk.so/types": "^0.1.35",
50+
"@hawk.so/types": "^0.1.36",
5151
"error-stack-parser": "^2.1.4",
5252
"vite-plugin-dts": "^4.2.4"
53-
}
53+
},
54+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
5455
}

src/addons/consoleCatcher.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,24 @@
44
import type { ConsoleLogEvent } from '@hawk.so/types';
55
import Sanitizer from '../modules/sanitizer';
66

7+
/**
8+
* Maximum number of console logs to store
9+
*/
10+
const MAX_LOGS = 20;
11+
12+
/**
13+
* Console methods to intercept
14+
*/
15+
const CONSOLE_METHODS: string[] = ['log', 'warn', 'error', 'info', 'debug'];
16+
717
/**
818
* Creates a console interceptor that captures and formats console output
919
*/
1020
function createConsoleCatcher(): {
1121
initConsoleCatcher: () => void;
1222
addErrorEvent: (event: ErrorEvent | PromiseRejectionEvent) => void;
1323
getConsoleLogStack: () => ConsoleLogEvent[];
14-
} {
15-
const MAX_LOGS = 20;
24+
} {
1625
const consoleOutput: ConsoleLogEvent[] = [];
1726
let isInitialized = false;
1827

@@ -157,9 +166,8 @@ function createConsoleCatcher(): {
157166
}
158167

159168
isInitialized = true;
160-
const consoleMethods: string[] = ['log', 'warn', 'error', 'info', 'debug'];
161169

162-
consoleMethods.forEach(function overrideConsoleMethod(method) {
170+
CONSOLE_METHODS.forEach(function overrideConsoleMethod(method) {
163171
if (typeof window.console[method] !== 'function') {
164172
return;
165173
}
@@ -216,3 +224,4 @@ const consoleCatcher = createConsoleCatcher();
216224

217225
export const { initConsoleCatcher, getConsoleLogStack, addErrorEvent } =
218226
consoleCatcher;
227+

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,10 +316,10 @@
316316
minimatch "^3.0.4"
317317
strip-json-comments "^3.1.1"
318318

319-
"@hawk.so/types@^0.1.35":
320-
version "0.1.35"
321-
resolved "https://registry.yarnpkg.com/@hawk.so/types/-/types-0.1.35.tgz#6afd416dced1cc3282d721ca5621bf452b27aea1"
322-
integrity sha512-uMTAeu6DlRlk+oputJBjTlrm1GzOkIwlMfGhpdOp3sRWe/YPGD6nMYlb9MZoVN6Yee7RIpYD7It+DPeUPAyIFw==
319+
"@hawk.so/types@^0.1.36":
320+
version "0.1.36"
321+
resolved "https://registry.yarnpkg.com/@hawk.so/types/-/types-0.1.36.tgz#234b0e4c81bf5f50b1208910d45fc4ffb62e8ae1"
322+
integrity sha512-AjW4FZPMqlDoXk63ntkTGOC1tdbHuGXIhEbVtBvz8YC9A7qcuxenzfGtjwuW6B9tqyADMGehh+/d+uQbAX7w0Q==
323323
dependencies:
324324
"@types/mongodb" "^3.5.34"
325325

0 commit comments

Comments
 (0)