feat(voice): on-device voice tier — Gemma 4, Moonshine and Kokoro in the browser

This commit is contained in:
Bilawal Sidhu committed 2026-09-28 23:00:00 -05:00
1 parent a19897ad15
commit b55663e3ce
65 files changed
+9257 -58

No files matched your search

+9 -4
View File
@@ -15,8 +15,13 @@ const browserGlobals = new Set([
'getComputedStyle',
]);
/** Inspect literal module dependencies and browser-platform references without executing code. */
export function analyzeModule(source) {
/**
* Inspect literal module dependencies and browser-platform references without
* executing code. `allowComputedImport` admits dynamic imports of computed
* specifiers (left out of the graph) for the one loader that imports bytes it
* has already verified.
*/
export function analyzeModule(source, { allowComputedImport = false } = {}) {
const imports = [];
const browser = new Set();
function walk(node, parent, field) {
@@ -30,11 +35,11 @@ export function analyzeModule(source) {
].includes(node.type) &&
node.source
) {
if (node.source.type !== 'StringLiteral')
if (node.source.type === 'StringLiteral') imports.push(node.source.value);
else if (!(allowComputedImport && node.type === 'ImportExpression'))
throw new Error(
'Computed module imports are not allowed in runtime code',
);
imports.push(node.source.value);
}
if (node.type === 'CallExpression' && node.callee?.name === 'require')
throw new Error('Runtime modules must use ES imports');