Add Vencord.Swc

This commit is contained in:
Vendicated 2022-10-02 18:57:13 +02:00
parent 46585efc02
commit 0bfe6f069e
No known key found for this signature in database
GPG Key ID: EC781ADFB93EFFA3
5 changed files with 15 additions and 3 deletions

View File

@ -7,6 +7,7 @@
"esbuild": "^0.15.5"
},
"dependencies": {
"@swc/wasm-web": "^1.3.4",
"discord-types": "^1.3.26",
"electron-devtools-installer": "^3.2.0",
"jsposed": "^1.0.2",

8
pnpm-lock.yaml generated
View File

@ -1,6 +1,7 @@
lockfileVersion: 5.3
lockfileVersion: 5.4
specifiers:
'@swc/wasm-web': ^1.3.4
'@types/flux': ^3.1.11
'@types/node': ^18.7.13
'@types/react': ^18.0.17
@ -12,6 +13,7 @@ specifiers:
prettier: ^2.7.1
dependencies:
'@swc/wasm-web': 1.3.4
discord-types: 1.3.26
electron-devtools-installer: 3.2.0
jsposed: 1.0.2
@ -58,6 +60,10 @@ packages:
engines: {node: '>=6'}
dev: true
/@swc/wasm-web/1.3.4:
resolution: {integrity: sha512-iFmDvsZTJg+IwAZm2DvUg3aHWVsM+9rDZhhpa9wRrwE8VRehAy8utW9Fa8qITqYH/NcqXkCeaXAeERBQjnHDuw==}
dev: false
/@szmarczak/http-timer/1.1.2:
resolution: {integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==}
engines: {node: '>=6'}

View File

@ -3,6 +3,8 @@ export * as Webpack from "./webpack";
export * as Api from "./api";
export * as Updater from "./utils/updater";
export * as QuickCss from "./utils/quickCss";
export * as Swc from "@swc/wasm-web";
import initSwc from "@swc/wasm-web";
import { popNotice, showNotice } from "./api/Notices";
import { Settings } from "./api/settings";
@ -15,10 +17,12 @@ import "./utils/quickCss";
import { checkForUpdates, UpdateLogger } from './utils/updater';
import { onceReady } from "./webpack";
import { Router } from "./webpack/common";
import IpcEvents from "./utils/IpcEvents";
export let Components;
async function init() {
await initSwc(await VencordNative.ipc.invoke(IpcEvents.GET_SWC_WASM));
await onceReady;
startAllPlugins();
Components = await import("./components");

View File

@ -32,12 +32,12 @@ ipcMain.handle(IpcEvents.GET_DESKTOP_CAPTURE_SOURCES, (_, opts) => desktopCaptur
ipcMain.handle(IpcEvents.OPEN_PATH, (_, ...pathElements) => shell.openPath(join(...pathElements)));
ipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => shell.openExternal(url));
ipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss());
ipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR);
ipcMain.on(IpcEvents.GET_SETTINGS, (e) => e.returnValue = readSettings());
ipcMain.handle(IpcEvents.GET_SWC_WASM, () => readFile(join(__dirname, "swc.wasm")));
let settingsWriteQueue = Promise.resolve();
ipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => {
settingsWriteQueue = settingsWriteQueue.then(() => writeFile(SETTINGS_FILE, s));

View File

@ -24,5 +24,6 @@ export default strEnum({
GET_HASHES: "VencordGetHashes",
UPDATE: "VencordUpdate",
BUILD: "VencordBuild",
GET_DESKTOP_CAPTURE_SOURCES: "VencordGetDesktopCaptureSources"
GET_DESKTOP_CAPTURE_SOURCES: "VencordGetDesktopCaptureSources",
GET_SWC_WASM: "VencordGetSwcWasm"
} as const);