@jackdbd/eleventy-plugin-text-to-speech
Version:
Eleventy plugin for the Google Cloud Text-to-Speech API
69 lines • 2.66 kB
TypeScript
import type { EleventyConfig } from '@panoply/11ty';
import type { AudioEncoding, AudioInnerHTML, CloudStorageHost, Rule } from './types.js';
export { audioExtension, mediaType } from './utils.js';
export interface Options {
/**
* List of encodings to use when generating audio assets from text matches.
*
* See here for the audio encodings supported by the Speech-to-Text API:
* https://cloud.google.com/speech-to-text/docs/encoding#audio-encodings
*/
audioEncodings?: AudioEncoding[];
/**
* Where to host the audio assets. Each audio host should have a matching
* writer responsible for writing/uploading the assets to the host.
*/
audioHost: URL | CloudStorageHost;
/**
* Function to use to generate the innerHTML of the `<audio>` tag to inject in
* the page for each text match.
*/
audioInnerHTML?: AudioInnerHTML;
/**
* Expiration for the 11ty AssetCache.
* https://www.11ty.dev/docs/plugins/fetch/#options
*/
cacheExpiration?: string;
/**
* Name of the 11ty collection created by this plugin.
*
* Note: if you register this plugin more than once, you will need to use a
* different name every time (otherwise 11ty would throw an Error).
*/
collectionName?: string;
/**
* Absolute filepath to the service account JSON key used to authenticate the
* Text-to-Speech client library. These credentials might be different from
* the ones used to authenticate the Cloud Storage client library. If not
* provided, this plugin will try initializing client libraries using the
* GOOGLE_APPLICATION_CREDENTIALS environment variable.
*/
keyFilename?: string;
/**
* Rules that determine which texts to convert into speech.
*/
rules: Rule[];
/**
* Name of the 11ty transform created by this plugin.
*
* Note: if you register this plugin more than once, you will need to use a
* different name every time (11ty would NOT throw an Error, but this plugin
* will not work as expected).
*/
transformName?: string;
/**
* Voice to use when generating audio assets from text matches.
*
* See here for the voices supported by the Speech-to-Text API:
* https://cloud.google.com/text-to-speech/docs/voices
*
* Note: different voices might have different prices:
* https://cloud.google.com/text-to-speech/pricing
*/
voice?: string;
}
export declare const plugin: {
initArguments: {};
configFunction: (eleventyConfig: EleventyConfig, options: Options) => void;
};
//# sourceMappingURL=index.d.ts.map