refactor: improve build scripts & automatic testing

- Fix reporter breaking because of ConsoleShortcuts
- Fix extractAndLoadChunks issue with 2 match groups; Improve testing of lazy extractAndLoadChunks
- Reporter: Properly implement reporter build of Vencord; Test more plugins; Fix running in wrong pages
- Fix wrong external files and clean up build script; Remove non used stuff
This commit is contained in:
Nuckyz 2024-05-29 06:45:44 -03:00 committed by Vendicated
parent 537fc5e33d
commit 05a40445c8
No known key found for this signature in database
GPG key ID: D66986BAF75ECF18
22 changed files with 225 additions and 176 deletions

View file

@ -18,14 +18,14 @@
import { Logger } from "@utils/Logger";
if (IS_DEV) {
if (IS_DEV || IS_REPORTER) {
var traces = {} as Record<string, [number, any[]]>;
var logger = new Logger("Tracer", "#FFD166");
}
const noop = function () { };
export const beginTrace = !IS_DEV ? noop :
export const beginTrace = !(IS_DEV || IS_REPORTER) ? noop :
function beginTrace(name: string, ...args: any[]) {
if (name in traces)
throw new Error(`Trace ${name} already exists!`);
@ -33,7 +33,7 @@ export const beginTrace = !IS_DEV ? noop :
traces[name] = [performance.now(), args];
};
export const finishTrace = !IS_DEV ? noop : function finishTrace(name: string) {
export const finishTrace = !(IS_DEV || IS_REPORTER) ? noop : function finishTrace(name: string) {
const end = performance.now();
const [start, args] = traces[name];
@ -48,7 +48,7 @@ type TraceNameMapper<F extends Func> = (...args: Parameters<F>) => string;
const noopTracer =
<F extends Func>(name: string, f: F, mapper?: TraceNameMapper<F>) => f;
export const traceFunction = !IS_DEV
export const traceFunction = !(IS_DEV || IS_REPORTER)
? noopTracer
: function traceFunction<F extends Func>(name: string, f: F, mapper?: TraceNameMapper<F>): F {
return function (this: any, ...args: Parameters<F>) {