feat(plugins): split plugin code by runtime
Keep the entry point focused on contribution wiring so client UI and daemon handlers can use their own runtime APIs safely. Surface compilation failures and lifecycle transitions in the retained plugin log tail.
This commit is contained in:
@@ -206,16 +206,11 @@ const TSCONFIG = {
|
||||
esModuleInterop: true,
|
||||
allowSyntheticDefaultImports: true,
|
||||
},
|
||||
include: ["index.tsx", "paseo-plugin.d.ts"],
|
||||
include: ["**/*.ts", "**/*.tsx"],
|
||||
};
|
||||
|
||||
const ENTRY = `import type { PluginContext } from "@paseo/plugin";
|
||||
import React from "react";
|
||||
import { Text } from "react-native";
|
||||
|
||||
function MainSurface() {
|
||||
return <Text>Hello from my plugin</Text>;
|
||||
}
|
||||
import { MainSurface } from "./main.client";
|
||||
|
||||
export default function contribute(plugin: PluginContext) {
|
||||
plugin.addSurface("main", MainSurface);
|
||||
@@ -223,6 +218,14 @@ export default function contribute(plugin: PluginContext) {
|
||||
}
|
||||
`;
|
||||
|
||||
const CLIENT_SURFACE = `import React from "react";
|
||||
import { Text } from "react-native";
|
||||
|
||||
export function MainSurface() {
|
||||
return <Text>Hello from my plugin</Text>;
|
||||
}
|
||||
`;
|
||||
|
||||
export interface PluginScaffold {
|
||||
id: string;
|
||||
directory: string;
|
||||
@@ -260,7 +263,8 @@ export async function scaffoldPluginDirectory(
|
||||
["package.json", `${JSON.stringify(packageJson, null, 2)}\n`],
|
||||
["tsconfig.json", `${JSON.stringify(TSCONFIG, null, 2)}\n`],
|
||||
["paseo-plugin.d.ts", SDK_DECLARATIONS],
|
||||
["index.tsx", ENTRY],
|
||||
["index.ts", ENTRY],
|
||||
["main.client.tsx", CLIENT_SURFACE],
|
||||
]);
|
||||
await Promise.all(
|
||||
[...files].map(([filename, contents]) =>
|
||||
|
||||
Reference in New Issue
Block a user