mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-17 14:39:41 +02:00
Remove unnecessary ctx.file APIs - plugins can use node:fs directly
This commit is contained in:
@@ -68,10 +68,6 @@ export interface Context {
|
||||
templates: {
|
||||
render<T extends JsonValue>(args: TemplateRenderRequest & { data: T }): Promise<T>;
|
||||
};
|
||||
file: {
|
||||
writeText(filePath: string, content: string): Promise<void>;
|
||||
readText(filePath: string): Promise<string>;
|
||||
};
|
||||
plugin: {
|
||||
reload(): void;
|
||||
};
|
||||
|
||||
@@ -689,24 +689,6 @@ export class PluginInstance {
|
||||
return result.data as any;
|
||||
},
|
||||
},
|
||||
file: {
|
||||
writeText: async (filePath: string, content: string) => {
|
||||
const payload: InternalEventPayload = {
|
||||
type: 'write_text_file_request',
|
||||
filePath,
|
||||
content,
|
||||
} as any;
|
||||
await this.#sendForReply(context, payload);
|
||||
},
|
||||
readText: async (filePath: string) => {
|
||||
const payload: InternalEventPayload = {
|
||||
type: 'read_text_file_request',
|
||||
filePath,
|
||||
} as any;
|
||||
const result = await this.#sendForReply<any>(context, payload);
|
||||
return result.content;
|
||||
},
|
||||
},
|
||||
store: {
|
||||
get: async <T>(key: string) => {
|
||||
const payload = { type: 'get_key_value_request', key } as const;
|
||||
|
||||
Reference in New Issue
Block a user