File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change 1
1
process . env . GGML_METAL_PATH_RESOURCES =
2
- process . env . GGML_METAL_PATH_RESOURCES || path . join ( __dirname , "../whisper.cpp" ) ;
2
+ process . env . GGML_METAL_PATH_RESOURCES || path . join ( __dirname , "../whisper.cpp/ggml/src " ) ;
3
3
4
4
import path from "node:path" ;
5
5
import { TranscribeFormat , TranscribeParams , TranscribeResult } from "./types" ;
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from "tsup" ;
2
+ import { readFileSync , writeFileSync } from "node:fs" ;
2
3
3
4
export default defineConfig ( {
4
5
entry : [ "src/index.ts" , "src/build.ts" ] ,
5
6
outDir : "dist" ,
6
7
dts : true ,
8
+ async onSuccess ( ) {
9
+ // replace `#include "ggml-common.h" in whisper.cpp/ggml/src/ggml-metal.metal with full content
10
+ const metal = readFileSync ( "whisper.cpp/ggml/src/ggml-metal.metal" , "utf-8" ) ;
11
+ const common = readFileSync ( "whisper.cpp/ggml/src/ggml-common.h" , "utf-8" ) ;
12
+ const replaced = metal . replace ( / # i n c l u d e " g g m l - c o m m o n .h " / , common ) ;
13
+ writeFileSync ( "whisper.cpp/ggml/src/ggml-metal.metal" , replaced ) ;
14
+ } ,
7
15
} ) ;
You can’t perform that action at this time.
0 commit comments