Archived
feat: build bundled plugins from TypeScript
This commit is contained in:
@@ -150,12 +150,17 @@ export class PiWebPluginService {
|
||||
|
||||
function defaultPluginRoots(): LocalPluginRoot[] {
|
||||
const moduleDir = dirname(fileURLToPath(import.meta.url));
|
||||
const packageRoot = join(moduleDir, "..", "..");
|
||||
return [
|
||||
{ path: join(moduleDir, "..", "..", "pi-web-plugins"), source: "bundled", scope: "bundled" },
|
||||
{ path: bundledPluginRoot(packageRoot), source: "bundled", scope: "bundled" },
|
||||
{ path: join(piWebDataDir(), "plugins"), source: "local", scope: "local" },
|
||||
];
|
||||
}
|
||||
|
||||
function bundledPluginRoot(packageRoot: string): string {
|
||||
return join(packageRoot, "dist", "pi-web-plugins");
|
||||
}
|
||||
|
||||
async function discoverLocalRoot(root: LocalPluginRoot): Promise<PluginRecord[]> {
|
||||
if (!existsSync(root.path)) return [];
|
||||
const entries = await readdir(root.path, { withFileTypes: true }).catch(() => []);
|
||||
|
||||
Reference in New Issue
Block a user