UNPKG

@jackdbd/eleventy-plugin-text-to-speech

Version:

Eleventy plugin that uses text-to-speech to generate audio assets for your website, then injects audio players in your HTML.

39 lines 1.01 kB
import { Readable } from 'node:stream'; import { z } from 'zod'; import { file_extension } from '../schemas/common.js'; /** * @internal */ export const synthesize_result_success = z.object({ error: z.undefined().optional(), value: z.instanceof(Readable) }); /** * @internal */ export const synthesize_result_failure = z.object({ error: z.instanceof(Error), value: z.undefined().optional() }); /** * @internal */ export const synthesize_result = z.union([ synthesize_result_failure, synthesize_result_success ]); export const text_to_synthesize = z .string() .min(1) .describe('Text to synthesize'); export const synthesize_func = z .function() .args(text_to_synthesize) .returns(z.promise(synthesize_result)); export const synthesis = z.object({ config: z.object({}).passthrough(), extension: file_extension, synthesize: synthesize_func }); export const synthesis_client = z.function().returns(synthesis); //# sourceMappingURL=schemas.js.map