(opts: {
readonly pluginKey: string;
readonly settings: ProjectSettings;
readonly plugins: readonly InlangPlugin[];
readonly db: Kysely<InlangDatabaseSchema>;
})
| 8 | import type { InlangPlugin } from "../plugin/schema.js"; |
| 9 | |
| 10 | export async function exportFiles(opts: { |
| 11 | readonly pluginKey: string; |
| 12 | readonly settings: ProjectSettings; |
| 13 | readonly plugins: readonly InlangPlugin[]; |
| 14 | readonly db: Kysely<InlangDatabaseSchema>; |
| 15 | }) { |
| 16 | const plugin = opts.plugins.find((p) => p.key === opts.pluginKey); |
| 17 | if (!plugin) throw new PluginMissingError({ plugin: opts.pluginKey }); |
| 18 | if (!plugin.exportFiles) { |
| 19 | throw new PluginDoesNotImplementFunctionError({ |
| 20 | plugin: opts.pluginKey, |
| 21 | function: "exportFiles", |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | const bundles = await opts.db.selectFrom("bundle").selectAll().execute(); |
| 26 | const messages = await opts.db.selectFrom("message").selectAll().execute(); |
| 27 | const variants = await opts.db.selectFrom("variant").selectAll().execute(); |
| 28 | |
| 29 | const files = await plugin.exportFiles({ |
| 30 | settings: structuredClone(opts.settings), |
| 31 | bundles, |
| 32 | messages, |
| 33 | variants, |
| 34 | }); |
| 35 | return files; |
| 36 | } |
no outgoing calls
no test coverage detected