@sefinek/google-tts-api 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.eslintrc.js CHANGED
@@ -9,7 +9,6 @@ module.exports = {
9
9
  'parserOptions': {
10
10
  'ecmaVersion': 2023,
11
11
  },
12
- 'ignorePatterns': ['public/js/stella/slider.js', 'public/js/lazyload.js', 'public/js/bootstrap.bundle.min.js', 'public/js/jquery-3.7.0.min.js'],
13
12
  'rules': {
14
13
  'arrow-spacing': ['warn', { before: true, after: true }],
15
14
  // 'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
package/.idea/discord.xml CHANGED
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="DiscordProjectSettings">
4
- <option name="show" value="ASK" />
4
+ <option name="show" value="PROJECT" />
5
5
  <option name="description" value="" />
6
6
  </component>
7
7
  </project>
package/CHANGELOG.md CHANGED
@@ -1,22 +1,19 @@
1
1
  ## 2.0.2 (Mar 20, 2021)
2
-
3
2
  - Change default language to `en` ([#45](https://github.com/sefinek24/google-tts-api/issues/45))
4
3
  - Typescript: Remove type `Language` since API doesn't fully support language codes listed in the document
5
4
 
6
5
  ## 2.0.1 (Jan 6, 2021)
7
-
8
6
  - Fix the vulnerabilities by upgrading the dependencies (#42, #44)
9
7
 
10
8
  ## 2.0.0 (Dec 8, 2020)
11
-
12
9
  - Add new APIs (Please see the **Break Change** below)
13
10
 
14
- | Method | Options (optional) | Return Type | Handle Long Text |
15
- |---------------------|-------------------------------------------------|-----------------------------------------------------|:----------------:|
16
- | `getAudioUrl` | `lang`, `slow`, `host` | `string` | |
17
- | `getAudioBase64` | `lang`, `slow`, `host`, `timeout` | `Promise<string>` | |
18
- | `getAllAudioUrls` | `lang`, `slow`, `host`, `splitPunct` | `{ shortText: string; url: string; }[]` | ✅ |
19
- | `getAllAudioBase64` | `lang`, `slow`, `host`, `timeout`, `splitPunct` | `Promise<{ shortText: string; base64: string; }[]>` | ✅ |
11
+ | Method | Options (optional) | Return Type | Handle Long Text |
12
+ |---------------------|-------------------------------------------------|-----------------------------------------------------|:----------------:|
13
+ | `getAudioUrl` | `lang`, `slow`, `host` | `string` | |
14
+ | `getAudioBase64` | `lang`, `slow`, `host`, `timeout` | `Promise<string>` | |
15
+ | `getAllAudioUrls` | `lang`, `slow`, `host`, `splitPunct` | `{ shortText: string; url: string; }[]` | ✅ |
16
+ | `getAllAudioBase64` | `lang`, `slow`, `host`, `timeout`, `splitPunct` | `Promise<{ shortText: string; base64: string; }[]>` | ✅ |
20
17
 
21
18
  - Support new Google TTS API to get audio Base64 text ([#35](https://github.com/sefinek24/google-tts-api/issues/35))
22
19
  - Support long text input: `getAllAudioUrls` and `getAllAudioBase64` ([#30](https://github.com/sefinek24/google-tts-api/issues/30))
@@ -25,11 +22,10 @@
25
22
  - Add dependency [axios](https://github.com/axios/axios)
26
23
 
27
24
  ### **Break Change from 0.x.x to 2.x.x**
28
-
29
25
  `googleTTS()` is changed to `googleTTS.getAudioUrl()`.
30
26
 
31
27
  ```js
32
- const googleTTS = require('google-tts-api');
28
+ const googleTTS = require('@sefinek/google-tts-api');
33
29
 
34
30
  // Before version 0.0.6
35
31
  // Original googleTTS is a promise function
@@ -46,26 +42,21 @@ const url = googleTTS.getAudioUrl('Hello World', {
46
42
  ```
47
43
 
48
44
  ## 0.0.6 (Dec 5, 2020)
49
-
50
45
  - `timeout` parameter is deprecated.
51
46
  - Remove dependency `isomorphic-fetch`.
52
47
  - Fix the change of Google Translate API ([@freddiefujiwara](https://github.com/freddiefujiwara) in [#37](https://github.com/sefinek24/google-tts-api/pull/37)). Read more in [#35](https://github.com/sefinek24/google-tts-api/issues/35)
53
48
 
54
49
  ## 0.0.5 (Nov 8, 2020)
55
-
56
50
  - Upgrade the dependencies and fix the vulnerability. ([#32](https://github.com/sefinek24/google-tts-api/issues/32))
57
51
  - Add retry mechanism to prevent fetching token key failed too frequently. ([#33](https://github.com/sefinek24/google-tts-api/issues/33))
58
52
 
59
53
  ## 0.0.4 (Nov 29, 2018)
60
-
61
54
  - Fix the change of Google Translate API ([@ncpierson](https://github.com/ncpierson) in [#19](https://github.com/sefinek24/google-tts-api/pull/19))
62
55
 
63
56
  ## 0.0.3 (Sep 21, 2018)
64
-
65
57
  - Add package-lock.lock file
66
58
  - Fix the change of Google Translate API ([@ncpierson](https://github.com/ncpierson) in [#14](https://github.com/sefinek24/google-tts-api/pull/14))
67
59
 
68
60
  ## 0.0.2 (Aug 25, 2017)
69
-
70
61
  - Add yarn.lock file
71
62
  - If length of input text is over than 200 characters, throw a `RangeError` with error message. ([#5](https://github.com/sefinek24/google-tts-api/issues/5))
package/README.md CHANGED
@@ -36,8 +36,8 @@ $ npm install -D typescript @types/node # Only for TypeScript
36
36
  ## Examples
37
37
  ### 1. `getAudioUrl(text, [option])`
38
38
  ```js
39
- import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
40
- const googleTTS = require('google-tts-api'); // CommonJS
39
+ import * as googleTTS from '@sefinek/google-tts-api'; // ES6 or TypeScript
40
+ const googleTTS = require('@sefinek/google-tts-api'); // CommonJS
41
41
 
42
42
  // get audio URL
43
43
  const url = googleTTS.getAudioUrl('Hello World', {
@@ -50,8 +50,8 @@ console.log(url); // https://translate.google.com/translate_tts?...
50
50
 
51
51
  ### 2. `getAudioBase64(text, [option])`
52
52
  ```js
53
- import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
54
- const googleTTS = require('google-tts-api'); // CommonJS
53
+ import * as googleTTS from '@sefinek/google-tts-api'; // ES6 or TypeScript
54
+ const googleTTS = require('@sefinek/google-tts-api'); // CommonJS
55
55
 
56
56
  // get base64 text
57
57
  googleTTS
@@ -67,8 +67,8 @@ googleTTS
67
67
 
68
68
  ### 3. `getAllAudioUrls(text, [option])` (For text longer than 200 characters)
69
69
  ```js
70
- import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
71
- const googleTTS = require('google-tts-api'); // CommonJS
70
+ import * as googleTTS from '@sefinek/google-tts-api'; // ES6 or TypeScript
71
+ const googleTTS = require('@sefinek/google-tts-api'); // CommonJS
72
72
 
73
73
  const results = googleTTS.getAllAudioUrls('LONG_TEXT_...', {
74
74
  lang: 'en',
@@ -86,8 +86,8 @@ console.log(results);
86
86
 
87
87
  ### 4. `getAllAudioBase64(text, [option])` (For text longer than 200 characters)
88
88
  ```js
89
- import * as googleTTS from 'google-tts-api'; // ES6 or TypeScript
90
- const googleTTS = require('google-tts-api'); // CommonJS
89
+ import * as googleTTS from '@sefinek/google-tts-api'; // ES6 or TypeScript
90
+ const googleTTS = require('@sefinek/google-tts-api'); // CommonJS
91
91
 
92
92
  googleTTS
93
93
  .getAllAudioBase64('LONG_TEXT_...', {
@@ -111,12 +111,12 @@ googleTTS
111
111
  ## License
112
112
  MIT
113
113
 
114
- [npm-url]: https://nodei.co/npm/google-tts-api
115
- [npm-img]: https://nodei.co/npm/google-tts-api.png
116
- [install-size-img]: https://packagephobia.com/badge?p=google-tts-api
117
- [install-size-result]: https://packagephobia.com/result?p=google-tts-api
118
- [dependency-url]: https://david-dm.org/sefinek24/google-tts-api
119
- [dependency-img]: https://img.shields.io/david/sefinek24/google-tts-api.svg
114
+ [npm-url]: https://nodei.co/npm/@sefinek/google-tts-api
115
+ [npm-img]: https://nodei.co/npm/@sefinek/google-tts-api.png
116
+ [install-size-img]: https://packagephobia.com/badge?p=@sefinek/google-tts-api
117
+ [install-size-result]: https://packagephobia.com/result?p=@sefinek/google-tts-api
118
+ [dependency-url]: https://david-dm.org/sefinek24/@sefinek/google-tts-api
119
+ [dependency-img]: https://img.shields.io/david/sefinek24/@sefinek/google-tts-api.svg
120
120
  [dependency-dev-url]: https://david-dm.org/sefinek24/google-tts-api#info=devDependencies
121
121
  [dependency-dev-img]: https://img.shields.io/david/dev/sefinek24/google-tts-api.svg
122
122
  [gh-action-url]: https://github.com/sefinek24/google-tts-api/actions
@@ -1 +1 @@
1
- {"version":3,"file":"getAudioUrl.d.ts","sourceRoot":"","sources":["../src/getAudioUrl.ts"],"names":[],"mappings":";AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,UAAU,MAAM;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,SACd,MAAM,yBAC0D,MAAM,KAC7E,MA0BF,CAAC;AAEF,UAAU,cAAe,SAAQ,MAAM;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,SAClB,MAAM,sCAMT,cAAc,KAClB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,MAAM,CAAA;CAAE,EAWpC,CAAC"}
1
+ {"version":3,"file":"getAudioUrl.d.ts","sourceRoot":"","sources":["../src/getAudioUrl.ts"],"names":[],"mappings":";AAEA,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,UAAU,MAAM;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,SACd,MAAM,yBAC0D,MAAM,KAC7E,MA0BF,CAAC;AAEF,UAAU,cAAe,SAAQ,MAAM;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,SAClB,MAAM,sCAMT,cAAc,KAClB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,MAAM,CAAA;CAAE,EAWpC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getAudioUrl.js","sourceRoot":"","sources":["../src/getAudioUrl.ts"],"names":[],"mappings":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
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Google TTS (Text-To-Speech) for node.js",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "tsc -p .",
8
- "test": "npm run build && jest",
9
- "cover": "npm run build && jest --coverage",
10
- "up": "ncu -u && npm install && npm update && npm audit fix"
11
- },
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/sefinek24/google-tts-api.git"
15
- },
16
5
  "keywords": [
17
6
  "tts",
18
7
  "google",
@@ -20,26 +9,37 @@
20
9
  "text-to-speech",
21
10
  "google-text-to-speech"
22
11
  ],
23
- "author": "zlargon",
24
- "license": "MIT",
12
+ "homepage": "https://github.com/sefinek24/google-tts-api#readme",
25
13
  "bugs": {
26
14
  "url": "https://github.com/sefinek24/google-tts-api/issues"
27
15
  },
28
- "homepage": "https://github.com/sefinek24/google-tts-api#readme",
29
- "dependencies": {
30
- "axios": "^1.6.2"
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/sefinek24/google-tts-api.git"
31
19
  },
32
- "devDependencies": {
33
- "is-base64": "^1.1.0",
34
- "jest": "^29.7.0",
35
- "typescript": "^5.3.2"
20
+ "license": "MIT",
21
+ "author": "zlargon",
22
+ "main": "dist/index.js",
23
+ "scripts": {
24
+ "build": "tsc -p .",
25
+ "cover": "npm run build && jest --coverage",
26
+ "test": "npm run build && jest",
27
+ "up": "ncu -u && npm install && npm update && npm audit fix"
36
28
  },
37
29
  "jest": {
38
- "testEnvironment": "node",
39
30
  "coverageReporters": [
40
31
  "lcov",
41
32
  "text",
42
33
  "html"
43
- ]
34
+ ],
35
+ "testEnvironment": "node"
36
+ },
37
+ "dependencies": {
38
+ "axios": "^1.6.2"
39
+ },
40
+ "devDependencies": {
41
+ "is-base64": "^1.1.0",
42
+ "jest": "^29.7.0",
43
+ "typescript": "^5.3.3"
44
44
  }
45
45
  }