@qvac/tts-ggml 0.9.0 → 0.9.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/binding.js +37 -3
- package/package.json +10 -10
package/binding.js
CHANGED
|
@@ -1,18 +1,52 @@
|
|
|
1
1
|
module.exports = loadAddon()
|
|
2
2
|
|
|
3
|
+
// `require.addon()` reads the prebuild shipped inside this package. Since the
|
|
4
|
+
// per-platform split (0.9.0) there is none, so the real binding almost always
|
|
5
|
+
// comes from the `#host-addon` platform package. Runtimes have been seen to
|
|
6
|
+
// answer `require.addon()` with this package's own JavaScript entry instead of
|
|
7
|
+
// failing, which used to be returned verbatim: callers then got a module with
|
|
8
|
+
// no `createInstance`, and the first symptom was an unrelated TypeError deep in
|
|
9
|
+
// a model load. Anything that is not the native binding is treated as a miss.
|
|
3
10
|
function loadAddon() {
|
|
11
|
+
let cause = null
|
|
12
|
+
|
|
4
13
|
try {
|
|
5
|
-
|
|
14
|
+
const addon = require.addon()
|
|
15
|
+
if (isNativeBinding(addon)) return addon
|
|
16
|
+
cause = new Error(
|
|
17
|
+
'@qvac/tts-ggml: require.addon() answered with a module that is not the native binding ' +
|
|
18
|
+
'(no createInstance function), so the prebuild in this package was treated as absent.'
|
|
19
|
+
)
|
|
6
20
|
} catch (err) {
|
|
7
|
-
|
|
21
|
+
cause = err
|
|
8
22
|
}
|
|
23
|
+
|
|
24
|
+
return loadPlatformPackageAddon(cause)
|
|
9
25
|
}
|
|
10
26
|
|
|
11
27
|
function loadPlatformPackageAddon(cause) {
|
|
28
|
+
let addon
|
|
29
|
+
|
|
12
30
|
try {
|
|
13
|
-
|
|
31
|
+
addon = require('#host-addon')
|
|
14
32
|
} catch (err) {
|
|
15
33
|
if (err.cause === undefined) err.cause = cause
|
|
16
34
|
throw err
|
|
17
35
|
}
|
|
36
|
+
|
|
37
|
+
if (!isNativeBinding(addon)) {
|
|
38
|
+
const err = new Error(
|
|
39
|
+
'@qvac/tts-ggml resolved #host-addon to a module that is not the native binding: ' +
|
|
40
|
+
'it has no createInstance function. Check that the platform package for this host ' +
|
|
41
|
+
'is installed and is not shadowed by another module of the same name.'
|
|
42
|
+
)
|
|
43
|
+
err.cause = cause
|
|
44
|
+
throw err
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return addon
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isNativeBinding(addon) {
|
|
51
|
+
return addon !== null && typeof addon === 'object' && typeof addon.createInstance === 'function'
|
|
18
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/tts-ggml",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Text to Speech (TTS) addon for qvac (ggml backend, wrapping the chatterbox + supertonic + parler + cosyvoice3 + audio8 engines from tts-cpp)",
|
|
5
5
|
"addon": true,
|
|
6
6
|
"engines": {
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"example:parler-enhanced": "bare examples/parler-enhanced.js \"Hello from enhanced Parler.\"",
|
|
80
80
|
"example:audio8": "bare examples/audio8-tts.js \"Audio eight speaks on-device.\"",
|
|
81
81
|
"lint": "npm run lint:js && npm run lint:ts && npm run test:types",
|
|
82
|
-
"lint:js": "prettier --check \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"binding.js\" \"addon-unavailable.js\" && lunte \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"binding.js\" \"addon-unavailable.js\"",
|
|
82
|
+
"lint:js": "prettier --check \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"scripts/__tests__/binding-loader.test.js\" \"binding.js\" \"addon-unavailable.js\" && lunte \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"scripts/__tests__/binding-loader.test.js\" \"binding.js\" \"addon-unavailable.js\"",
|
|
83
83
|
"lint:ts": "eslint \"src/**/*.ts\" --max-warnings=0",
|
|
84
84
|
"lint:ts:fix": "eslint \"src/**/*.ts\" --fix",
|
|
85
|
-
"format": "prettier --write \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"binding.js\" \"addon-unavailable.js\"",
|
|
85
|
+
"format": "prettier --write \"test/**/*.js\" \"scripts/__tests__/package-contract.test.js\" \"scripts/__tests__/binding-loader.test.js\" \"binding.js\" \"addon-unavailable.js\"",
|
|
86
86
|
"test:unit": "npm run build:ts && brittle-bare test/unit/**/*.test.js && npm run test:node",
|
|
87
87
|
"test:node": "node --test scripts/__tests__/*.test.js",
|
|
88
88
|
"test": "npm run test:types && npm run test:unit && npm run test:integration",
|
|
@@ -209,12 +209,12 @@
|
|
|
209
209
|
},
|
|
210
210
|
"types": "index.d.ts",
|
|
211
211
|
"optionalDependencies": {
|
|
212
|
-
"@qvac/tts-ggml-linux-x64": "0.9.
|
|
213
|
-
"@qvac/tts-ggml-linux-arm64": "0.9.
|
|
214
|
-
"@qvac/tts-ggml-darwin-arm64": "0.9.
|
|
215
|
-
"@qvac/tts-ggml-darwin-x64": "0.9.
|
|
216
|
-
"@qvac/tts-ggml-win32-x64": "0.9.
|
|
217
|
-
"@qvac/tts-ggml-android-arm64": "0.9.
|
|
218
|
-
"@qvac/tts-ggml-ios": "0.9.
|
|
212
|
+
"@qvac/tts-ggml-linux-x64": "0.9.1",
|
|
213
|
+
"@qvac/tts-ggml-linux-arm64": "0.9.1",
|
|
214
|
+
"@qvac/tts-ggml-darwin-arm64": "0.9.1",
|
|
215
|
+
"@qvac/tts-ggml-darwin-x64": "0.9.1",
|
|
216
|
+
"@qvac/tts-ggml-win32-x64": "0.9.1",
|
|
217
|
+
"@qvac/tts-ggml-android-arm64": "0.9.1",
|
|
218
|
+
"@qvac/tts-ggml-ios": "0.9.1"
|
|
219
219
|
}
|
|
220
220
|
}
|