@todoforai/voiceloop 0.1.17 → 0.1.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoforai/voiceloop",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "description": "Fast, interruptible browser voice agent: VAD → STT → LLM → TTS with real barge-in, echo filtering, streaming first-sentence TTS and tap-to-seek. Zero runtime dependencies.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -1961,6 +1961,11 @@ const CDN_PIPER_WASM = `${CDN}@diffusionstudio/piper-wasm@1.0.0/build/piper_phon
1961
1961
  // literal specifier is resolved by Vite's import analysis BEFORE it checks /* @vite-ignore */ —
1962
1962
  // which fails since onnxruntime-web isn't installed as a dependency.
1963
1963
  const ORT_SPECIFIER = 'onnxruntime-web';
1964
+ // Dynamic import by URL, hidden from bundlers: Hermes (React Native) rejects `import(expr)` at
1965
+ // bytecode compile time, so the syntax can't appear in this file even on paths RN never takes.
1966
+ // Hermes's runtime parser rejects it too, so the Function is built LAZILY — a top-level
1967
+ // `new Function(...)` would throw at module load and take the whole import down with it.
1968
+ const importUrl = (u) => new Function('u', 'return import(u)')(u);
1964
1969
 
1965
1970
  // OPFS blob cache — same 'piper' directory and url-basename filenames as the lib's own cache, so
1966
1971
  // models already downloaded through the lib are reused (and vice versa).
@@ -2013,7 +2018,7 @@ export class PiperTTS extends StreamingTTS {
2013
2018
  if (typeof document !== 'undefined' && !document.getElementById('vl-importmap')) {
2014
2019
  const { loadVoiceDeps } = await import('./deps.js'); await loadVoiceDeps();
2015
2020
  }
2016
- return import(/* webpackIgnore: true */ /* @vite-ignore */ CDN_PIPER);
2021
+ return importUrl(CDN_PIPER);
2017
2022
  })();
2018
2023
  }
2019
2024
 
@@ -2043,8 +2048,8 @@ export class PiperTTS extends StreamingTTS {
2043
2048
  const path = lib.PATH_MAP[voiceId];
2044
2049
  if (!path) throw new Error(`unknown Piper voice: ${voiceId}`);
2045
2050
  const [ort, phonMod, cfgBlob, modelBlob] = await Promise.all([
2046
- import(/* webpackIgnore: true */ /* @vite-ignore */ ORT_SPECIFIER),
2047
- import(/* webpackIgnore: true */ /* @vite-ignore */ CDN_PIPER_PHONEMIZE),
2051
+ importUrl(ORT_SPECIFIER),
2052
+ importUrl(CDN_PIPER_PHONEMIZE),
2048
2053
  opfsCachedFetch(`${lib.HF_BASE}/${path}.json`),
2049
2054
  opfsCachedFetch(`${lib.HF_BASE}/${path}`, this._onModelProgress),
2050
2055
  ]);