fix(plugins): install local plugins on packaged desktop
The plugin compiler spawned esbuild through app.asar, and the subprocess imported the React client barrel. Point esbuild at the unpacked binary, add a react-free @paseo/plugin/server entry, and pass a typed PluginTheme so plugin UI follows the active theme on desktop and mobile.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { PluginAttachmentSearchPayload } from "@paseo/plugin";
|
||||
import type { PluginAttachmentSearchPayload } from "@paseo/plugin/server";
|
||||
import type { output as ZodOutput } from "zod";
|
||||
import { searchIssuesRpc } from "./issues.shared";
|
||||
import { createLinearIssueSearch } from "./linear";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineAttachmentSource, defineRpc } from "@paseo/plugin";
|
||||
import { defineAttachmentSource, defineRpc } from "@paseo/plugin/server";
|
||||
import { z } from "zod";
|
||||
|
||||
const SearchPayloadSchema = z.object({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { defineRpc } from "@paseo/plugin";
|
||||
import { defineRpc } from "@paseo/plugin/server";
|
||||
import { z } from "zod";
|
||||
|
||||
export const incrementRpc = defineRpc({
|
||||
|
||||
@@ -2,36 +2,28 @@ import { useMutation } from "@tanstack/react-query";
|
||||
import { type PluginWorkspacePanelProps, useRpc, useWorkspace } from "@paseo/plugin";
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
import { Pressable, Text, View } from "react-native";
|
||||
import { z } from "zod";
|
||||
import { incrementRpc } from "./increment.shared";
|
||||
|
||||
const ExampleThemeSchema = z.object({
|
||||
colors: z.object({
|
||||
surface0: z.string(),
|
||||
foreground: z.string(),
|
||||
foregroundMuted: z.string(),
|
||||
accent: z.string(),
|
||||
accentForeground: z.string(),
|
||||
statusDanger: z.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
export function ExamplePanel({ theme, workspaceId }: PluginWorkspacePanelProps) {
|
||||
const { colors } = ExampleThemeSchema.parse(theme);
|
||||
export function ExamplePanel({ theme, layout, workspaceId }: PluginWorkspacePanelProps) {
|
||||
const workspace = useWorkspace(workspaceId, ({ name }) => ({ name }));
|
||||
const callIncrement = useRpc(incrementRpc);
|
||||
const { data, error, isPending, mutate } = useMutation({ mutationFn: callIncrement });
|
||||
const value = data?.value ?? 0;
|
||||
const styles = useMemo(
|
||||
() => ({
|
||||
screen: { flex: 1, padding: 24, gap: 16, backgroundColor: colors.surface0 },
|
||||
title: { color: colors.foreground, fontSize: 24 },
|
||||
detail: { color: colors.foregroundMuted },
|
||||
button: { padding: 14, borderRadius: 10, backgroundColor: colors.accent },
|
||||
buttonText: { color: colors.accentForeground, textAlign: "center" as const },
|
||||
error: { color: colors.statusDanger },
|
||||
screen: {
|
||||
flex: 1,
|
||||
padding: layout.compact ? 16 : 24,
|
||||
gap: 16,
|
||||
backgroundColor: theme.colors.surface0,
|
||||
},
|
||||
title: { color: theme.colors.foreground, fontSize: layout.compact ? 20 : 24 },
|
||||
detail: { color: theme.colors.foregroundMuted },
|
||||
button: { padding: 14, borderRadius: 10, backgroundColor: theme.colors.accent },
|
||||
buttonText: { color: theme.colors.accentForeground, textAlign: "center" as const },
|
||||
error: { color: theme.colors.statusDanger },
|
||||
}),
|
||||
[colors],
|
||||
[theme, layout.compact],
|
||||
);
|
||||
const handleIncrement = useCallback(() => {
|
||||
mutate({ value });
|
||||
|
||||
Reference in New Issue
Block a user