@remotion/whisper-web 4.0.306 → 4.0.308
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/.turbo/turbo-make.log +2 -2
- package/.turbo/turbo-test.log +13 -0
- package/build-wasm.ts +13 -40
- package/dist/esm/index.mjs +10 -9
- package/dist/load-mod/load-mod.d.ts +4 -2
- package/dist/load-mod/load-mod.js +9 -5
- package/dist/transcribe.js +1 -9
- package/main.d.ts +7 -16
- package/main.js +4767 -2
- package/package.json +3 -8
- package/src/load-mod/load-mod.ts +14 -6
- package/src/transcribe.ts +1 -12
- package/tsconfig.tsbuildinfo +1 -1
- package/worker.js +0 -3
package/.turbo/turbo-make.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @remotion/whisper-web@4.0.
|
|
3
|
+
> @remotion/whisper-web@4.0.308 make /Users/jonathanburger/remotion/packages/whisper-web
|
|
4
4
|
> tsc -d && bun --env-file=../.env.bundle bundle.ts
|
|
5
5
|
|
|
6
|
-
[0m[2m[[
|
|
6
|
+
[0m[2m[[1m8.44ms[0m[2m][0m Generated.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @remotion/whisper-web@4.0.306 test /Users/jonathanburger/remotion/packages/whisper-web
|
|
4
|
+
> bun test src
|
|
5
|
+
|
|
6
|
+
[0m[1mbun test [0m[2mv1.2.5 (013fdddc)[0m
|
|
7
|
+
[33mThe following filters did not match any test files:[0m
|
|
8
|
+
src
|
|
9
|
+
86 files were searched [0m[2m[[1m4.00ms[0m[2m][0m
|
|
10
|
+
|
|
11
|
+
[34mnote[0m[2m:[0m Tests need ".test", "_test_", ".spec" or "_spec_" in the filename [2m(ex: "MyApp.test.ts")[0m
|
|
12
|
+
|
|
13
|
+
Learn more about the test runner: [35mhttps://bun.sh/docs/cli/test[0m
|
package/build-wasm.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// TODO: there's no indication of error in case worker.js is fails to dynamically import
|
|
2
|
+
|
|
1
3
|
import {$} from 'bun';
|
|
2
4
|
import fs from 'fs';
|
|
3
5
|
import os from 'os';
|
|
@@ -16,7 +18,7 @@ fs.mkdirSync(wasmDir, {recursive: true});
|
|
|
16
18
|
const cwd = path.join(wasmDir, 'build-em');
|
|
17
19
|
|
|
18
20
|
await $`git clone https://github.com/ggerganov/whisper.cpp ${wasmDir}`;
|
|
19
|
-
await $`git checkout v1.7.
|
|
21
|
+
await $`git checkout v1.7.5`.cwd(wasmDir);
|
|
20
22
|
|
|
21
23
|
fs.mkdirSync(cwd);
|
|
22
24
|
|
|
@@ -32,7 +34,12 @@ const file = fs.readFileSync(cmakeListsFile, 'utf8');
|
|
|
32
34
|
// Disable Node.JS target, compile with assertions to get stack trace
|
|
33
35
|
const lines = file.split('\n').map((line) => {
|
|
34
36
|
if (line.includes('-s FORCE_FILESYSTEM=1 \\')) {
|
|
35
|
-
|
|
37
|
+
// output ES6 module so we can import it dynamically without injeting the script tag
|
|
38
|
+
return `-s FORCE_FILESYSTEM=1 -s ENVIRONMENT='web,worker' -s EXPORT_ES6=1 -s MODULARIZE=1 -s EXPORT_NAME=\\"createModule\\" \\`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (line.includes('-s EXPORTED_RUNTIME_METHODS')) {
|
|
42
|
+
return `-s EXPORTED_RUNTIME_METHODS=\\"['print', 'printErr', 'ccall', 'cwrap', 'HEAPU8']\\" \\`;
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
return line;
|
|
@@ -63,46 +70,12 @@ await $`make -j`.cwd(cwd);
|
|
|
63
70
|
|
|
64
71
|
const mainJsFile = path.join(cwd, 'bin', 'whisper.wasm', 'main.js');
|
|
65
72
|
|
|
66
|
-
let content = fs
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
content = content.replace(
|
|
70
|
-
'var moduleOverrides=Object.assign({},Module);',
|
|
71
|
-
'var moduleOverrides=Object.assign({},Module);if (typeof window !== "undefined") {Object.assign(Module, window.remotion_wasm_moduleOverrides);};',
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
// assert changes have been made
|
|
75
|
-
if (!content.includes('window.remotion_wasm_moduleOverrides')) {
|
|
76
|
-
throw new Error('Changes have not been made');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Modify the Worker path
|
|
80
|
-
const mainContent =
|
|
81
|
-
content.replace(
|
|
82
|
-
'new Worker(pthreadMainJs',
|
|
83
|
-
`new Worker(new URL('./worker.js', import.meta.url)`,
|
|
84
|
-
) +
|
|
85
|
-
'\n' +
|
|
86
|
-
'export default Module;' +
|
|
87
|
-
'\n';
|
|
88
|
-
|
|
89
|
-
// assert changes have been made
|
|
90
|
-
if (!mainContent.includes('new Worker(new URL(')) {
|
|
91
|
-
throw new Error('Changes have not been made');
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const workerContent =
|
|
95
|
-
content.replace(
|
|
96
|
-
'worker=new Worker(pthreadMainJs)',
|
|
97
|
-
`throw new Error('Already is in worker')`,
|
|
98
|
-
) +
|
|
99
|
-
'\n' +
|
|
100
|
-
'export default Module;' +
|
|
101
|
-
'\n';
|
|
73
|
+
let content = fs
|
|
74
|
+
.readFileSync(mainJsFile, 'utf8')
|
|
75
|
+
.replace('libmain.js', './main.js');
|
|
102
76
|
|
|
103
77
|
// Write the modified content directly to the destination
|
|
104
|
-
fs.writeFileSync(path.join(__dirname, 'main.js'),
|
|
105
|
-
fs.writeFileSync(path.join(__dirname, 'worker.js'), workerContent, 'utf8');
|
|
78
|
+
fs.writeFileSync(path.join(__dirname, 'main.js'), content, 'utf8');
|
|
106
79
|
|
|
107
80
|
const dTsFile = path.join(
|
|
108
81
|
wasmDir,
|
package/dist/esm/index.mjs
CHANGED
|
@@ -455,9 +455,15 @@ var toCaptions = (input) => {
|
|
|
455
455
|
return { captions };
|
|
456
456
|
};
|
|
457
457
|
// src/load-mod/load-mod.ts
|
|
458
|
-
var loadMod = async (
|
|
459
|
-
|
|
460
|
-
|
|
458
|
+
var loadMod = async ({
|
|
459
|
+
handler
|
|
460
|
+
}) => {
|
|
461
|
+
const createModule = await import("../../main.js").then((mod) => mod.default);
|
|
462
|
+
const Module = await createModule({
|
|
463
|
+
print: handler,
|
|
464
|
+
printErr: handler
|
|
465
|
+
});
|
|
466
|
+
return Module;
|
|
461
467
|
};
|
|
462
468
|
|
|
463
469
|
// src/print-handler.ts
|
|
@@ -642,12 +648,7 @@ var transcribe = async ({
|
|
|
642
648
|
onTranscriptionChunk?.(json.transcription);
|
|
643
649
|
}
|
|
644
650
|
});
|
|
645
|
-
|
|
646
|
-
print: handler,
|
|
647
|
-
printErr: handler
|
|
648
|
-
};
|
|
649
|
-
const Mod = await loadMod();
|
|
650
|
-
delete window.remotion_wasm_moduleOverrides;
|
|
651
|
+
const Mod = await loadMod({ handler });
|
|
651
652
|
const url = getModelUrl(model);
|
|
652
653
|
const result = await getObject({ key: url });
|
|
653
654
|
if (!result) {
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const loadMod: (
|
|
1
|
+
import type { printHandler } from '../print-handler.js';
|
|
2
|
+
export declare const loadMod: ({ handler, }: {
|
|
3
|
+
handler: ReturnType<typeof printHandler>;
|
|
4
|
+
}) => Promise<import("../../main.js").MainModule>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// ⚠️⚠️⚠️⚠️⚠️!! Intentionally putting this in a subdirectory, so it is 2 directories deep
|
|
3
|
+
// That way it can be imported when the output is dist/esm/index.js
|
|
2
4
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
5
|
if (k2 === undefined) k2 = k;
|
|
4
6
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -34,10 +36,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
36
|
})();
|
|
35
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
38
|
exports.loadMod = void 0;
|
|
37
|
-
const loadMod = async () => {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const loadMod = async ({ handler, }) => {
|
|
40
|
+
const createModule = await Promise.resolve().then(() => __importStar(require('../../main.js'))).then((mod) => mod.default);
|
|
41
|
+
const Module = await createModule({
|
|
42
|
+
print: handler,
|
|
43
|
+
printErr: handler,
|
|
44
|
+
});
|
|
45
|
+
return Module;
|
|
42
46
|
};
|
|
43
47
|
exports.loadMod = loadMod;
|
package/dist/transcribe.js
CHANGED
|
@@ -77,15 +77,7 @@ const transcribe = async ({ channelWaveform, model, language = 'auto', onProgres
|
|
|
77
77
|
onTranscriptionChunk === null || onTranscriptionChunk === void 0 ? void 0 : onTranscriptionChunk(json.transcription);
|
|
78
78
|
},
|
|
79
79
|
});
|
|
80
|
-
|
|
81
|
-
// var Module = typeof Module != 'undefined' ? Module : {};
|
|
82
|
-
// var moduleOverrides = Object.assign({}, Module);
|
|
83
|
-
window.remotion_wasm_moduleOverrides = {
|
|
84
|
-
print: handler,
|
|
85
|
-
printErr: handler,
|
|
86
|
-
};
|
|
87
|
-
const Mod = await (0, load_mod_1.loadMod)();
|
|
88
|
-
delete window.remotion_wasm_moduleOverrides;
|
|
80
|
+
const Mod = await (0, load_mod_1.loadMod)({ handler });
|
|
89
81
|
const url = (0, get_model_url_1.getModelUrl)(model);
|
|
90
82
|
const result = await (0, get_object_from_db_1.getObject)({ key: url });
|
|
91
83
|
if (!result) {
|
package/main.d.ts
CHANGED
|
@@ -14,24 +14,14 @@ declare namespace RuntimeExports {
|
|
|
14
14
|
* @param {Array=} argTypes
|
|
15
15
|
* @param {Object=} opts
|
|
16
16
|
*/
|
|
17
|
-
function cwrap(ident: any, returnType?: string | undefined, argTypes?: any[] | undefined, opts?: any | undefined):
|
|
18
|
-
let HEAPF32: any;
|
|
19
|
-
let HEAPF64: any;
|
|
20
|
-
let HEAP_DATA_VIEW: any;
|
|
21
|
-
let HEAP8: any;
|
|
17
|
+
function cwrap(ident: any, returnType?: string | undefined, argTypes?: any[] | undefined, opts?: any | undefined): any;
|
|
22
18
|
let HEAPU8: any;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
let HEAP32: any;
|
|
26
|
-
let HEAPU32: any;
|
|
27
|
-
let HEAP64: any;
|
|
28
|
-
let HEAPU64: any;
|
|
29
|
-
let FS_createPath: any;
|
|
30
|
-
function FS_createDataFile(parent: any, name: any, fileData: any, canRead: any, canWrite: any, canOwn: any): void;
|
|
19
|
+
function FS_createPath(...args: any[]): any;
|
|
20
|
+
function FS_createDataFile(...args: any[]): any;
|
|
31
21
|
function FS_createPreloadedFile(parent: any, name: any, url: any, canRead: any, canWrite: any, onload: any, onerror: any, dontCreateFile: any, canOwn: any, preFinish: any): void;
|
|
32
|
-
function FS_unlink(
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
function FS_unlink(...args: any[]): any;
|
|
23
|
+
function FS_createLazyFile(...args: any[]): any;
|
|
24
|
+
function FS_createDevice(...args: any[]): any;
|
|
35
25
|
let addRunDependency: any;
|
|
36
26
|
let removeRunDependency: any;
|
|
37
27
|
}
|
|
@@ -44,3 +34,4 @@ interface EmbindModule {
|
|
|
44
34
|
}
|
|
45
35
|
|
|
46
36
|
export type MainModule = WasmModule & typeof RuntimeExports & EmbindModule;
|
|
37
|
+
export default function MainModuleFactory (options?: unknown): Promise<MainModule>;
|