diff --git a/package.json b/package.json index 6b842a1c..9fa244e8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 304261da..c33fc17f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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'} diff --git a/src/Vencord.ts b/src/Vencord.ts index 5b3d6f26..d488b446 100644 --- a/src/Vencord.ts +++ b/src/Vencord.ts @@ -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"); diff --git a/src/ipcMain/index.ts b/src/ipcMain/index.ts index 92d25fef..167b7c77 100644 --- a/src/ipcMain/index.ts +++ b/src/ipcMain/index.ts @@ -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)); diff --git a/src/utils/IpcEvents.ts b/src/utils/IpcEvents.ts index 3ceaa9f1..29574a7e 100644 --- a/src/utils/IpcEvents.ts +++ b/src/utils/IpcEvents.ts @@ -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);