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" "esbuild": "^0.15.5"
}, },
"dependencies": { "dependencies": {
"@swc/wasm-web": "^1.3.4",
"discord-types": "^1.3.26", "discord-types": "^1.3.26",
"electron-devtools-installer": "^3.2.0", "electron-devtools-installer": "^3.2.0",
"jsposed": "^1.0.2", "jsposed": "^1.0.2",

View file

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

View file

@ -3,6 +3,8 @@ export * as Webpack from "./webpack";
export * as Api from "./api"; export * as Api from "./api";
export * as Updater from "./utils/updater"; export * as Updater from "./utils/updater";
export * as QuickCss from "./utils/quickCss"; 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 { popNotice, showNotice } from "./api/Notices";
import { Settings } from "./api/settings"; import { Settings } from "./api/settings";
@ -15,10 +17,12 @@ import "./utils/quickCss";
import { checkForUpdates, UpdateLogger } from './utils/updater'; import { checkForUpdates, UpdateLogger } from './utils/updater';
import { onceReady } from "./webpack"; import { onceReady } from "./webpack";
import { Router } from "./webpack/common"; import { Router } from "./webpack/common";
import IpcEvents from "./utils/IpcEvents";
export let Components; export let Components;
async function init() { async function init() {
await initSwc(await VencordNative.ipc.invoke(IpcEvents.GET_SWC_WASM));
await onceReady; await onceReady;
startAllPlugins(); startAllPlugins();
Components = await import("./components"); 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_PATH, (_, ...pathElements) => shell.openPath(join(...pathElements)));
ipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => shell.openExternal(url)); ipcMain.handle(IpcEvents.OPEN_EXTERNAL, (_, url) => shell.openExternal(url));
ipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss()); ipcMain.handle(IpcEvents.GET_QUICK_CSS, () => readCss());
ipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR); ipcMain.handle(IpcEvents.GET_SETTINGS_DIR, () => SETTINGS_DIR);
ipcMain.on(IpcEvents.GET_SETTINGS, (e) => e.returnValue = readSettings()); ipcMain.on(IpcEvents.GET_SETTINGS, (e) => e.returnValue = readSettings());
ipcMain.handle(IpcEvents.GET_SWC_WASM, () => readFile(join(__dirname, "swc.wasm")));
let settingsWriteQueue = Promise.resolve(); let settingsWriteQueue = Promise.resolve();
ipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => { ipcMain.handle(IpcEvents.SET_SETTINGS, (_, s) => {
settingsWriteQueue = settingsWriteQueue.then(() => writeFile(SETTINGS_FILE, s)); settingsWriteQueue = settingsWriteQueue.then(() => writeFile(SETTINGS_FILE, s));

View file

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