VencordDesktop: Include web plugins & use proper showItemInFolder
This commit is contained in:
parent
d8a5e43034
commit
676bc612d9
@ -80,7 +80,7 @@ await Promise.all([
|
|||||||
globalName: "Vencord",
|
globalName: "Vencord",
|
||||||
sourcemap,
|
sourcemap,
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins,
|
globPlugins("discordDesktop"),
|
||||||
...commonOpts.plugins
|
...commonOpts.plugins
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
@ -114,7 +114,7 @@ await Promise.all([
|
|||||||
globalName: "Vencord",
|
globalName: "Vencord",
|
||||||
sourcemap,
|
sourcemap,
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins,
|
globPlugins("vencordDesktop"),
|
||||||
...commonOpts.plugins
|
...commonOpts.plugins
|
||||||
],
|
],
|
||||||
define: {
|
define: {
|
||||||
|
@ -38,7 +38,7 @@ const commonOptions = {
|
|||||||
format: "iife",
|
format: "iife",
|
||||||
external: ["plugins", "git-hash", "/assets/*"],
|
external: ["plugins", "git-hash", "/assets/*"],
|
||||||
plugins: [
|
plugins: [
|
||||||
globPlugins,
|
globPlugins("web"),
|
||||||
...commonOpts.plugins,
|
...commonOpts.plugins,
|
||||||
],
|
],
|
||||||
target: ["esnext"],
|
target: ["esnext"],
|
||||||
|
@ -48,9 +48,9 @@ export const makeAllPackagesExternalPlugin = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("esbuild").Plugin}
|
* @type {(kind: "web" | "discordDesktop" | "vencordDesktop") => import("esbuild").Plugin}
|
||||||
*/
|
*/
|
||||||
export const globPlugins = {
|
export const globPlugins = kind => ({
|
||||||
name: "glob-plugins",
|
name: "glob-plugins",
|
||||||
setup: build => {
|
setup: build => {
|
||||||
const filter = /^~plugins$/;
|
const filter = /^~plugins$/;
|
||||||
@ -76,8 +76,10 @@ export const globPlugins = {
|
|||||||
if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) {
|
if (fileBits.length > 2 && ["ts", "tsx"].includes(fileBits.at(-1))) {
|
||||||
const mod = fileBits.at(-2);
|
const mod = fileBits.at(-2);
|
||||||
if (mod === "dev" && !watch) continue;
|
if (mod === "dev" && !watch) continue;
|
||||||
if (mod === "web" && !isWeb) continue;
|
if (mod === "web" && kind === "discordDesktop") continue;
|
||||||
if (mod === "desktop" && isWeb) continue;
|
if (mod === "desktop" && kind === "web") continue;
|
||||||
|
if (mod === "discordDesktop" && kind !== "discordDesktop") continue;
|
||||||
|
if (mod === "vencordDesktop" && kind !== "vencordDesktop") continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mod = `p${i}`;
|
const mod = `p${i}`;
|
||||||
@ -93,7 +95,7 @@ export const globPlugins = {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("esbuild").Plugin}
|
* @type {import("esbuild").Plugin}
|
||||||
|
@ -26,7 +26,7 @@ import { ErrorCard } from "@components/ErrorCard";
|
|||||||
import IpcEvents from "@utils/IpcEvents";
|
import IpcEvents from "@utils/IpcEvents";
|
||||||
import { Margins } from "@utils/margins";
|
import { Margins } from "@utils/margins";
|
||||||
import { identity, useAwaiter } from "@utils/misc";
|
import { identity, useAwaiter } from "@utils/misc";
|
||||||
import { relaunch } from "@utils/native";
|
import { relaunch, showItemInFolder } from "@utils/native";
|
||||||
import { Button, Card, Forms, React, Select, Slider, Switch } from "@webpack/common";
|
import { Button, Card, Forms, React, Select, Slider, Switch } from "@webpack/common";
|
||||||
|
|
||||||
const cl = classNameFactory("vc-settings-");
|
const cl = classNameFactory("vc-settings-");
|
||||||
@ -65,7 +65,7 @@ function VencordSettings() {
|
|||||||
title: "Enable React Developer Tools",
|
title: "Enable React Developer Tools",
|
||||||
note: "Requires a full restart"
|
note: "Requires a full restart"
|
||||||
},
|
},
|
||||||
!IS_WEB && (!isWindows ? {
|
!IS_WEB && (!IS_DISCORD_DESKTOP || !isWindows ? {
|
||||||
key: "frameless",
|
key: "frameless",
|
||||||
title: "Disable the window frame",
|
title: "Disable the window frame",
|
||||||
note: "Requires a full restart"
|
note: "Requires a full restart"
|
||||||
@ -112,8 +112,7 @@ function VencordSettings() {
|
|||||||
Open QuickCSS File
|
Open QuickCSS File
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
// FIXME: Vencord Desktop support
|
onClick={() => showItemInFolder(settingsDir)}
|
||||||
onClick={() => window.DiscordNative.fileManager.showItemInFolder(settingsDir)}
|
|
||||||
size={Button.Sizes.SMALL}
|
size={Button.Sizes.SMALL}
|
||||||
disabled={settingsDirPending}>
|
disabled={settingsDirPending}>
|
||||||
Open Settings Folder
|
Open Settings Folder
|
||||||
|
@ -35,7 +35,7 @@ export default definePlugin({
|
|||||||
find: ".Menu,{",
|
find: ".Menu,{",
|
||||||
all: true,
|
all: true,
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?<=\.jsxs?\)\(\i\.Menu,)\{/,
|
match: /(?<=\.jsxs?\)\(\i\.Menu,)\{/g,
|
||||||
replace: "{contextMenuApiArguments:typeof arguments!=='undefined'?arguments:[],"
|
replace: "{contextMenuApiArguments:typeof arguments!=='undefined'?arguments:[],"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,3 +22,10 @@ export function relaunch() {
|
|||||||
else
|
else
|
||||||
window.VencordDesktop.app.relaunch();
|
window.VencordDesktop.app.relaunch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function showItemInFolder(path: string) {
|
||||||
|
if (IS_DISCORD_DESKTOP)
|
||||||
|
window.DiscordNative.fileManager.showItemInFolder(path);
|
||||||
|
else
|
||||||
|
window.VencordDesktop.fileManager.showItemInFolder(path);
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user