mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
chore: move plugins to their own repos and drop the plugins folder
This commit is contained in:
1 parent
29a946d02e
commit
e02b5fe6e4
3167 files changed
+286
-440749
No files matched your search
@@ -15,7 +15,6 @@ import {
|
||||
setFrontendState,
|
||||
setPluginSummaries,
|
||||
} from "./plugin-store";
|
||||
import { workspaceFrontends, workspaceLocales } from "./workspace-plugins";
|
||||
import { syncHostFeatureTabs } from "@/settings/host-feature-tabs";
|
||||
|
||||
/**
|
||||
@@ -75,16 +74,12 @@ const defaultDeps: PluginLoaderDeps = {
|
||||
fetchPlugins: getPlugins,
|
||||
|
||||
async importFrontend(summary) {
|
||||
const workspace = workspaceFrontends[summary.id];
|
||||
if (workspace) return (await workspace()) as FrontendModule;
|
||||
return (await import(
|
||||
/* @vite-ignore */ absolute(assetUrl(summary, "frontend.js"))
|
||||
)) as FrontendModule;
|
||||
},
|
||||
|
||||
async loadLocale(summary, file) {
|
||||
const workspace = workspaceLocales[summary.id]?.[file];
|
||||
if (workspace) return (await workspace()) as ResourceKey;
|
||||
const hasFile = summary.locales?.includes(file);
|
||||
if (!hasFile) return null;
|
||||
const path = file === "en" ? "en.json" : `translated/${file}.json`;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Plugin sources in this monorepo, for the Vite dev server.
|
||||
*
|
||||
* Empty everywhere except `vite dev`, where the termix-plugin-host Vite plugin
|
||||
* replaces this module with import.meta.glob calls over plugins/<id>/, so
|
||||
* plugin frontends load through Vite with HMR instead of from their built
|
||||
* bundles. A production build keeps it empty: plugins are separate bundles
|
||||
* served from /plugin-assets, never part of the shell's own build.
|
||||
*/
|
||||
|
||||
type Loader = () => Promise<unknown>;
|
||||
|
||||
/** plugin id -> its src/frontend/index.tsx */
|
||||
export const workspaceFrontends: Record<string, Loader> = {};
|
||||
|
||||
/** plugin id -> locale file ("en", "de_DE") -> JSON */
|
||||
export const workspaceLocales: Record<string, Record<string, Loader>> = {};
|
||||
Reference in new issue
Block a user