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

@ -32,6 +32,11 @@ export class Logger {
constructor(public name: string, public color: string = "white") { }
private _log(level: "log" | "error" | "warn" | "info" | "debug", levelColor: string, args: any[], customFmt = "") {
if (IS_REPORTER && (level === "warn" || level === "error")) {
console[level]("[Vencord]", this.name + ":", ...args);
return;
}
console[level](
`%c Vencord %c %c ${this.name} ${customFmt}`,
`background: ${levelColor}; color: black; font-weight: bold; border-radius: 5px;`,

View file

@ -17,7 +17,6 @@
*/
import { makeLazy } from "./lazy";
import { EXTENSION_BASE_URL } from "./web-metadata";
/*
Add dynamically loaded dependencies for plugins here.
@ -67,15 +66,6 @@ export interface ApngFrameData {
playTime: number;
}
// On web (extensions), use extension uri as basepath (load files from extension)
// On desktop (electron), load from cdn
export const rnnoiseDist = IS_EXTENSION
? new URL("/third-party/rnnoise", EXTENSION_BASE_URL).toString()
: "https://unpkg.com/@sapphi-red/web-noise-suppressor@0.3.3/dist";
export const rnnoiseWasmSrc = (simd = false) => `${rnnoiseDist}/rnnoise${simd ? "_simd" : ""}.wasm`;
export const rnnoiseWorkletSrc = `${rnnoiseDist}/rnnoise/workletProcessor.js`;
// The below code is only used on the Desktop (electron) build of Vencord.
// Browser (extension) builds do not contain these remote imports.

View file

@ -94,6 +94,10 @@ export interface PluginDef {
* @default StartAt.WebpackReady
*/
startAt?: StartAt,
/**
* Which parts of the plugin can be tested by the reporter. Defaults to all parts
*/
reporterTestable?: number;
/**
* Optionally provide settings that the user can configure in the Plugins tab of settings.
* @deprecated Use `settings` instead
@ -144,6 +148,13 @@ export const enum StartAt {
WebpackReady = "WebpackReady"
}
export const enum ReporterTestable {
None = 1 << 1,
Start = 1 << 2,
Patches = 1 << 3,
FluxEvents = 1 << 4
}
export const enum OptionType {
STRING,
NUMBER,