improve text to speech dependency (#1250)

* Generate .d.ts files from TypeScript for text-to-speech project

* Remove module export for htmlToSpeechFile

* Include test
This commit is contained in:
Hongbo Wu 2022-09-28 11:48:06 +08:00 committed by GitHub
parent a0d4e06d34
commit ee3fec9d96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 41 deletions

View file

@ -1,31 +0,0 @@
declare module '@omnivore/text-to-speech-handler' {
export function htmlToSpeechFile(htmlInput: HtmlInput): SpeechFile
export interface HtmlInput {
title?: string
content: string
options: SSMLOptions
}
export interface SSMLOptions {
primaryVoice?: string
secondaryVoice?: string
rate?: string
language?: string
}
interface Utterance {
idx: string
wordOffset: number
wordCount: number
voice?: string
text: string
}
export interface SpeechFile {
wordCount: number
language: string
defaultVoice: string
utterances: Utterance[]
}
}

View file

@ -3,7 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
"types": "build/src/htmlToSsml.d.ts",
"files": [
"build/src"
],

View file

@ -13,7 +13,7 @@ import {
TextToSpeechInput,
} from './textToSpeech'
import { File, Storage } from '@google-cloud/storage'
import { endSsml, htmlToSpeechFile, startSsml } from './htmlToSsml'
import { endSsml, startSsml } from './htmlToSsml'
import crypto from 'crypto'
import { createRedisClient } from './redis'
@ -236,9 +236,3 @@ export const textToSpeechStreamingHandler = Sentry.GCPFunction.wrapHttpFunction(
}
}
)
module.exports = {
htmlToSpeechFile,
textToSpeechStreamingHandler,
textToSpeechHandler,
}

View file

@ -3,7 +3,9 @@
"compilerOptions": {
"outDir": "build",
"rootDir": ".",
"lib": ["dom"]
"lib": ["dom"],
// Generate d.ts files
"declaration": true
},
"include": ["src", "test"]
"include": ["src", "test"],
}