hyperframes 0.8.148 → 0.8.150
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/dist/{add-JAHZJYB7.js → add-3ZIFEN2U.js} +19 -19
- package/dist/{animatedGifPrep-HV4ZFVPV.js → animatedGifPrep-77LPFLKJ.js} +6 -6
- package/dist/api.d.ts +209 -0
- package/dist/api.js +75 -0
- package/dist/{asset-SJA7DT6Q.js → asset-EYSZEHM6.js} +3 -3
- package/dist/{assetCataloger-JJQ4JW2P.js → assetCataloger-KX3HD7ZI.js} +3 -3
- package/dist/{auth-RR3OIXLH.js → auth-L6IWNRXY.js} +4 -4
- package/dist/{autoUpdate-KLDV2XWV.js → autoUpdate-2O3HZB65.js} +2 -2
- package/dist/{backgroundChecks-OVL3E2RK.js → backgroundChecks-BH2LMJYE.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-2SAJGOHU.js → batchRender-ZBKAYLWU.js} +7 -7
- package/dist/{beats-HTYS42CC.js → beats-IVLF2566.js} +22 -22
- package/dist/{benchmark-CAHP4GLB.js → benchmark-SYZFW2G7.js} +19 -19
- package/dist/{browser-M7I67IGX.js → browser-OSW3L25S.js} +14 -13
- package/dist/{bundleWithLocalizedFonts-EKRXJBXU.js → bundleWithLocalizedFonts-I4CWOXLK.js} +5 -5
- package/dist/{capture-P5SNZ6HL.js → capture-AZOQ57TM.js} +2 -2
- package/dist/{capture-YZQZ5LKM.js → capture-V5ICGSVJ.js} +20 -20
- package/dist/{catalog-LREZPRJS.js → catalog-VBJOA2Y5.js} +35 -35
- package/dist/{catch-up-2MLRYAYP.js → catch-up-TKSEDNJK.js} +13 -13
- package/dist/{check-BH6NUR22.js → check-3HFISKDB.js} +50 -50
- package/dist/{checkBrowser-BM6JBFST.js → checkBrowser-MXBDNZJB.js} +38 -38
- package/dist/chunk-2KAL22B5.js +26 -0
- package/dist/{chunk-X2G54Y2V.js → chunk-3UAIVF4L.js} +4 -4
- package/dist/{chunk-KQHJKJ3V.js → chunk-423DJVX2.js} +1 -1
- package/dist/{chunk-UTBQSOEC.js → chunk-4WFNTWKZ.js} +3 -3
- package/dist/{chunk-VC7JBNPS.js → chunk-5NAYNDBT.js} +477 -68
- package/dist/{chunk-QX26JK43.js → chunk-6KWA3XPS.js} +10 -10
- package/dist/{chunk-AY2BONTF.js → chunk-6NPFJ255.js} +1 -1
- package/dist/{chunk-ZK3BQXHC.js → chunk-6QB7F2II.js} +1 -1
- package/dist/{chunk-54TV77W5.js → chunk-6SFPQ2RZ.js} +6 -8
- package/dist/{chunk-YQK445YQ.js → chunk-73RBX2E7.js} +2 -2
- package/dist/chunk-7E4VHPKJ.js +329 -0
- package/dist/{chunk-A6S35NYA.js → chunk-7IEGPJ4P.js} +1 -1
- package/dist/{chunk-NT7EK6ET.js → chunk-7JTFPUMA.js} +1 -1
- package/dist/{chunk-VHJPGKUW.js → chunk-A6ZO4BX7.js} +2 -2
- package/dist/{chunk-ASEJ2FBO.js → chunk-AFRXL75S.js} +1 -1
- package/dist/{chunk-QIJLIULK.js → chunk-AKYQGZLU.js} +2 -2
- package/dist/{chunk-4S4VUXW3.js → chunk-AXPNVC3N.js} +1 -1
- package/dist/{chunk-A4Q7W4LV.js → chunk-B3XLIBFL.js} +4 -2
- package/dist/{chunk-PR7QQBSC.js → chunk-BLRJKBKP.js} +1 -1
- package/dist/chunk-CEND6BLF.js +3795 -0
- package/dist/{chunk-KVGDFUVO.js → chunk-CZQLCBWY.js} +26 -13
- package/dist/{chunk-6IIGT7BX.js → chunk-DNZMBQTH.js} +1 -1
- package/dist/{chunk-ELACLQPC.js → chunk-DOVJRUFM.js} +1 -1
- package/dist/{chunk-SYUGVPYH.js → chunk-DUUFDLC4.js} +1 -1
- package/dist/{chunk-KMJLHHBF.js → chunk-EL5QVJEG.js} +1 -1
- package/dist/{chunk-JN4EK6MC.js → chunk-F2RLIE7P.js} +17 -17
- package/dist/{chunk-TLGJRK6Q.js → chunk-FN6KAS7A.js} +10 -10
- package/dist/{chunk-24GKVAEE.js → chunk-FPAT5HTI.js} +15 -15
- package/dist/chunk-HU2SPFNG.js +103 -0
- package/dist/{chunk-KQESKXAC.js → chunk-I6DATIHC.js} +2 -2
- package/dist/{chunk-4OA4LDTU.js → chunk-IYLHJV34.js} +1 -1
- package/dist/{chunk-KBB4RG6F.js → chunk-JZIEZCQM.js} +9 -2
- package/dist/chunk-KGPLIH7B.js +127 -0
- package/dist/{chunk-B4P5VDFQ.js → chunk-KMAAOHLO.js} +1 -1
- package/dist/chunk-LW5VFBSY.js +56 -0
- package/dist/{chunk-66SAATRI.js → chunk-M5B42RL5.js} +9 -9
- package/dist/{chunk-Q2Y5OZCY.js → chunk-M6UDJ2E7.js} +2 -2
- package/dist/{chunk-URYAKNQ2.js → chunk-NFQY7EIC.js} +1 -1
- package/dist/{chunk-S7E2I3HT.js → chunk-O4DC5CHF.js} +1 -1
- package/dist/{chunk-K35E45SI.js → chunk-OQ7XMM3S.js} +1 -1
- package/dist/{chunk-AHBYQRGI.js → chunk-PCWOSS7G.js} +1 -1
- package/dist/{chunk-BHVFTYSI.js → chunk-PO2SDVQA.js} +4 -1
- package/dist/{chunk-K4RIT6PX.js → chunk-R5A7454P.js} +2 -2
- package/dist/{chunk-VXM4BH23.js → chunk-RW7NLGPD.js} +121 -47
- package/dist/{chunk-BB3HJLHD.js → chunk-S5F26DUL.js} +3 -3
- package/dist/{chunk-OLENCLFE.js → chunk-TZPZE5PS.js} +81 -8
- package/dist/{chunk-74JDPWQ3.js → chunk-UAIUVPZE.js} +9 -9
- package/dist/{chunk-XIL7KT5Q.js → chunk-UJB7356Y.js} +6 -6
- package/dist/{chunk-YA62XGXS.js → chunk-UJKQWGFF.js} +1 -1
- package/dist/{chunk-O3EALI4M.js → chunk-UQYQ7TBA.js} +4 -4
- package/dist/{chunk-C24LU5XD.js → chunk-UVVI2NJQ.js} +12 -12
- package/dist/{normalize-U3SL5VG3.js → chunk-VHZ6DL3M.js} +3 -3
- package/dist/{chunk-CNEYCO24.js → chunk-VQ7YIURZ.js} +13 -13
- package/dist/{chunk-62RUQJ5J.js → chunk-WLIUULZQ.js} +20 -8
- package/dist/{chunk-RKBES4XP.js → chunk-XANZ4R4P.js} +88 -28
- package/dist/{chunk-BYSBRF24.js → chunk-XPQSL5VS.js} +5 -120
- package/dist/{chunk-SP6XL3NP.js → chunk-XQMEGSHG.js} +1 -1
- package/dist/{chunk-ZFN6GQU4.js → chunk-XXPYZBZ3.js} +1 -1
- package/dist/{chunk-4SFGME7K.js → chunk-YJDB4FLT.js} +1 -1
- package/dist/{chunk-QATWIE4K.js → chunk-YU2QRNWN.js} +2 -2
- package/dist/{chunk-6VKQ5JT3.js → chunk-Z6WZDGCS.js} +2 -2
- package/dist/{chunk-2HWB4TCI.js → chunk-ZNHAJCEA.js} +1 -1
- package/dist/{clean-K7GYTLQE.js → clean-7HU7S7DT.js} +34 -33
- package/dist/cli.js +55 -55
- package/dist/{cloud-I3J5HTN7.js → cloud-HAXHBO25.js} +4 -4
- package/dist/{cloudrun-MJQ363PB.js → cloudrun-A3PIJ6DX.js} +7 -7
- package/dist/{compare-LHW6NEFR.js → compare-6IPSQMSM.js} +37 -37
- package/dist/{compiler-NPD3MYMO.js → compiler-UQP2VXN6.js} +3 -3
- package/dist/{component-LTPK2D3K.js → component-FF3AU24M.js} +4 -4
- package/dist/{compositions-QGEHXGIL.js → compositions-JSH4MZXB.js} +20 -20
- package/dist/{delete-ATNRBUDJ.js → delete-G763SW64.js} +11 -11
- package/dist/{dist-CUIR3GFX.js → dist-Z7Q3JS7K.js} +3 -3
- package/dist/{doctor-6B76R5BJ.js → doctor-WZB6WMBY.js} +21 -20
- package/dist/{events-BLABPRD5.js → events-MUWJJCC7.js} +6 -6
- package/dist/{events-33GOPHSS.js → events-T4YFQC5G.js} +8 -8
- package/dist/{feedback-HLXEG7RT.js → feedback-AUTHQNN2.js} +25 -25
- package/dist/{ffmpeg-5V4FP3R6.js → ffmpeg-TZB5WAYE.js} +3 -2
- package/dist/{figma-T6W7H23L.js → figma-NBG6WBI7.js} +3 -3
- package/dist/fontLocalizeCli.js +11 -11
- package/dist/{get-UDMLOTKJ.js → get-OXBJLKLV.js} +11 -11
- package/dist/{gpuPolicy-M2JZGGVW.js → gpuPolicy-HBCCEQUS.js} +6 -6
- package/dist/{grade-compare-P4CHFVBR.js → grade-compare-2LX4FDH7.js} +42 -41
- package/dist/{help-4MW6L6YB.js → help-LJI46EDO.js} +3 -3
- package/dist/{history-336VM6SH.js → history-MFKAQEHU.js} +15 -15
- package/dist/hyperframe-runtime.js +65 -58
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +65 -58
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-FPMIDMD5.js → info-D6Y5O2QE.js} +18 -18
- package/dist/{init-IWM4PWLO.js → init-47NZPEBI.js} +53 -52
- package/dist/{inspect-IIG7756C.js → inspect-U5UXJK5D.js} +34 -34
- package/dist/{installer-Q4MMZKLA.js → installer-AW7VFVTQ.js} +5 -5
- package/dist/{keyframes-TWO4BXBA.js → keyframes-5G334NWB.js} +16 -16
- package/dist/{lambda-2JB2QUK2.js → lambda-GASGXN3A.js} +9 -9
- package/dist/{layout-TPKEKFQQ.js → layout-OXAQFLJS.js} +34 -34
- package/dist/{lint-H3KL7KSX.js → lint-F36QFSNF.js} +19 -19
- package/dist/{list-LYPO4KRE.js → list-TR6QCI53.js} +11 -11
- package/dist/{login-SQQWKWTD.js → login-6LA2RWTC.js} +9 -9
- package/dist/{logout-B4KS4A7S.js → logout-DKJANASY.js} +3 -3
- package/dist/{manager-5ORDVWJB.js → manager-ES2UFT4X.js} +6 -4
- package/dist/{manager-BPSR6D3V.js → manager-GWU5J6RJ.js} +3 -2
- package/dist/{media-treatment-KSRINVUA.js → media-treatment-BOHYDWVY.js} +28 -27
- package/dist/{models-WUBF6GDB.js → models-6GW5Q3IW.js} +20 -18
- package/dist/{motionShot-STKG4KYQ.js → motionShot-O7AOMPUN.js} +14 -14
- package/dist/normalize-4UDISLPL.js +24 -0
- package/dist/{normalize-audio-CA47XZ4I.js → normalize-audio-UO5B4O76.js} +17 -17
- package/dist/{open-B5WYEM3Z.js → open-JV2EHVKM.js} +13 -13
- package/dist/{parakeetRunner-JBK2JPEH.js → parakeetRunner-23DZUF6G.js} +18 -28
- package/dist/{pipeline-FEAAD2RJ.js → pipeline-KTICSIK7.js} +10 -10
- package/dist/{play-2LC5XRM6.js → play-CMUYPXBC.js} +37 -37
- package/dist/{preflight-ONF5AJNO.js → preflight-JOD4OXGC.js} +5 -4
- package/dist/{present-XKYF3VGC.js → present-ZDT5FM2H.js} +27 -27
- package/dist/{preview-WDPZRHE5.js → preview-ASHLGKDD.js} +40 -38
- package/dist/{producer-343ENLAM.js → producer-FFH2KUAZ.js} +1 -1
- package/dist/{projectConfig-YXKU3CTB.js → projectConfig-FHIAOPKW.js} +7 -7
- package/dist/{publication-ODXP3JI7.js → publication-WO5ZXURT.js} +3 -3
- package/dist/{publish-3OYXNY44.js → publish-QWO2W7FB.js} +23 -23
- package/dist/{refresh-PVHBEABE.js → refresh-MGCVWX56.js} +3 -3
- package/dist/{remove-background-F6QTJIPZ.js → remove-background-BO5MQR25.js} +39 -35
- package/dist/{render-SC77I7FT.js → render-HS3YOLSD.js} +7 -7
- package/dist/{render-QQ7NUREG.js → render-SDHFXL3Y.js} +62 -61
- package/dist/{render-JKB6GZDB.js → render-XTJKGT3G.js} +31 -31
- package/dist/{render-batch-4F44JFAB.js → render-batch-J64AJHQY.js} +7 -7
- package/dist/renderSetupWorker.js +4 -3
- package/dist/{resolver-7MYXNEAX.js → resolver-IHNWMDJA.js} +5 -5
- package/dist/{sherpa-FOXB4XBN.js → sherpa-FXBBYMDR.js} +16 -15
- package/dist/sherpaWorker.js +3 -1
- package/dist/{skills-GG756RCG.js → skills-ALLSN7TB.js} +15 -15
- package/dist/{skillsUpdateCheck-N2LDCNAS.js → skillsUpdateCheck-EIT5NWM6.js} +3 -3
- package/dist/{snapshot-2LDOY65W.js → snapshot-Y3I76OIZ.js} +56 -55
- package/dist/{src-VMTHSARJ.js → src-7V6LBC56.js} +7 -5
- package/dist/{src-PTIV7IVV.js → src-S5IZVJUX.js} +7 -7
- package/dist/{staticProjectServer-QBB6WUAY.js → staticProjectServer-QLWWGHZE.js} +16 -16
- package/dist/{status-PTKNQD2E.js → status-NBRMGL7D.js} +5 -5
- package/dist/studio/assets/{hyperframes-player-BBBg-uvu.js → hyperframes-player-kup62bDR.js} +1 -1
- package/dist/studio/assets/{index-BXJLeCqB.js → index-B8BBYY8L.js} +1 -1
- package/dist/studio/assets/{index-BJIpZeuk.js → index-CS_m0TkX.js} +131 -131
- package/dist/studio/assets/{index-DARhiE_i.js → index-DQ5jGodF.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-VPTZF2AW.js → studio-api-UBFLZ3DA.js} +9 -9
- package/dist/{studioServer-VZKX2MG7.js → studioServer-REOVCIFP.js} +72 -71
- package/dist/{synthesize-UCI4X5O7.js → synthesize-22B7L5GX.js} +6 -6
- package/dist/{telemetry-76XND6XK.js → telemetry-C3GDIXHO.js} +8 -8
- package/dist/{timeline-UJLTA4AX.js → timeline-H42EGLMT.js} +26 -26
- package/dist/{tokens-VMWANYJY.js → tokens-2K7ISTKV.js} +3 -3
- package/dist/transcribe-DVM7UFZZ.js +332 -0
- package/dist/{transcribe-JNOG667L.js → transcribe-NUPASAUP.js} +14 -13
- package/dist/{tts-B6AHFQEO.js → tts-QSAQZVEZ.js} +3 -3
- package/dist/{updateCheck-WI3HYM72.js → updateCheck-3RWFSEZD.js} +2 -2
- package/dist/{upgrade-52RIOKFX.js → upgrade-YKKL36N7.js} +5 -5
- package/dist/{urlDownloader-352AY25I.js → urlDownloader-6JNJYLPN.js} +5 -5
- package/dist/{validate-MJVNR7YY.js → validate-Z7KQT7GO.js} +27 -27
- package/dist/{video-72VNEQEI.js → video-EXL2JDSL.js} +9 -9
- package/package.json +8 -1
- package/dist/chunk-3WD4JNMU.js +0 -3795
- package/dist/chunk-6IHWCZ3W.js +0 -54
- package/dist/chunk-SQLK7SJL.js +0 -88
- package/dist/manager-RFZNG5YT.js +0 -30
- package/dist/renderCancellation-7OEBNE2L.js +0 -43
- package/dist/transcribe-FD7A2SH3.js +0 -466
- package/dist/{chunk-DKSDVDXG.js → chunk-NAMGMP3R.js} +3 -3
- package/dist/{policies-4FEXMXPK.js → policies-DCSIM4AB.js} +3 -3
- package/dist/{screenshotCapture-3JXXUZND.js → screenshotCapture-TEUIWXWN.js} +3 -3
- package/dist/{telemetry-W5AKPI4R.js → telemetry-CQYHCCPL.js} +3 -3
|
@@ -6,10 +6,13 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
downloadFile
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-PO2SDVQA.js";
|
|
10
10
|
import {
|
|
11
11
|
findFFmpeg
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DUUFDLC4.js";
|
|
13
|
+
import {
|
|
14
|
+
stoppableExecFile
|
|
15
|
+
} from "./chunk-HU2SPFNG.js";
|
|
13
16
|
|
|
14
17
|
// src/whisper/manager.ts
|
|
15
18
|
import { execFileSync } from "child_process";
|
|
@@ -74,7 +77,7 @@ function findBuiltBinary() {
|
|
|
74
77
|
}
|
|
75
78
|
return void 0;
|
|
76
79
|
}
|
|
77
|
-
function buildFromSource(onProgress) {
|
|
80
|
+
async function buildFromSource(onProgress, signal) {
|
|
78
81
|
if (existsSync(BUILD_DIR) && !findBuiltBinary()) {
|
|
79
82
|
rmSync(BUILD_DIR, { recursive: true, force: true });
|
|
80
83
|
}
|
|
@@ -83,23 +86,26 @@ function buildFromSource(onProgress) {
|
|
|
83
86
|
mkdirSync(join(homedir(), ".cache", "hyperframes", "whisper"), {
|
|
84
87
|
recursive: true
|
|
85
88
|
});
|
|
86
|
-
|
|
89
|
+
await stoppableExecFile("git", ["clone", "--depth", "1", WHISPER_REPO, BUILD_DIR], {
|
|
87
90
|
stdio: "ignore",
|
|
88
91
|
timeout: 6e4,
|
|
89
|
-
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" }
|
|
92
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0" },
|
|
93
|
+
signal
|
|
90
94
|
});
|
|
91
95
|
}
|
|
92
96
|
onProgress?.("Building whisper.cpp (this may take a minute)...");
|
|
93
97
|
try {
|
|
94
|
-
|
|
98
|
+
await stoppableExecFile("cmake", ["-B", "build"], {
|
|
95
99
|
cwd: BUILD_DIR,
|
|
96
100
|
stdio: ["pipe", "pipe", "pipe"],
|
|
97
|
-
timeout: 12e4
|
|
101
|
+
timeout: 12e4,
|
|
102
|
+
signal
|
|
98
103
|
});
|
|
99
|
-
|
|
104
|
+
await stoppableExecFile("cmake", ["--build", "build", "--config", "Release", "-j"], {
|
|
100
105
|
cwd: BUILD_DIR,
|
|
101
106
|
stdio: ["pipe", "pipe", "pipe"],
|
|
102
|
-
timeout: 3e5
|
|
107
|
+
timeout: 3e5,
|
|
108
|
+
signal
|
|
103
109
|
});
|
|
104
110
|
} catch (err) {
|
|
105
111
|
let detail = "";
|
|
@@ -150,6 +156,7 @@ function hasCmake() {
|
|
|
150
156
|
return whichBinary("cmake") !== void 0;
|
|
151
157
|
}
|
|
152
158
|
async function ensureWhisper(options) {
|
|
159
|
+
const signal = options?.signal;
|
|
153
160
|
const existing = findWhisper();
|
|
154
161
|
if (existing) return existing;
|
|
155
162
|
if (options?.installRuntime === false) {
|
|
@@ -160,20 +167,23 @@ async function ensureWhisper(options) {
|
|
|
160
167
|
if (platform() === "darwin" && hasBrew()) {
|
|
161
168
|
options?.onProgress?.("Installing whisper-cpp via Homebrew...");
|
|
162
169
|
try {
|
|
163
|
-
|
|
170
|
+
await stoppableExecFile("brew", ["install", "whisper-cpp"], {
|
|
164
171
|
stdio: "ignore",
|
|
165
|
-
timeout: 3e5
|
|
172
|
+
timeout: 3e5,
|
|
173
|
+
signal
|
|
166
174
|
});
|
|
167
175
|
const installed = findFromSystem();
|
|
168
176
|
if (installed) return { ...installed, source: "brew" };
|
|
169
177
|
} catch {
|
|
170
178
|
}
|
|
179
|
+
signal?.throwIfAborted();
|
|
171
180
|
}
|
|
172
181
|
if (hasGit() && hasCmake()) {
|
|
173
182
|
try {
|
|
174
|
-
return buildFromSource(options?.onProgress);
|
|
183
|
+
return await buildFromSource(options?.onProgress, signal);
|
|
175
184
|
} catch {
|
|
176
185
|
}
|
|
186
|
+
signal?.throwIfAborted();
|
|
177
187
|
}
|
|
178
188
|
throw new WhisperUnavailableError(`whisper-cpp not found. Install: ${getInstallInstructions()}`);
|
|
179
189
|
}
|
|
@@ -182,7 +192,10 @@ async function ensureModel(model = DEFAULT_MODEL, options) {
|
|
|
182
192
|
if (existsSync(modelPath)) return modelPath;
|
|
183
193
|
mkdirSync(MODELS_DIR, { recursive: true });
|
|
184
194
|
options?.onProgress?.(`Downloading model ${model}...`);
|
|
185
|
-
await downloadFile(getModelUrl(model), modelPath, {
|
|
195
|
+
await downloadFile(getModelUrl(model), modelPath, {
|
|
196
|
+
signal: options?.signal,
|
|
197
|
+
onProgress: options?.onDownloadProgress
|
|
198
|
+
});
|
|
186
199
|
if (!existsSync(modelPath)) {
|
|
187
200
|
throw new Error(`Model download failed: ${model}`);
|
|
188
201
|
}
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
VERSION
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-I6DATIHC.js";
|
|
10
10
|
|
|
11
11
|
// src/registry/compatibility.ts
|
|
12
12
|
import { compareVersions } from "compare-versions";
|
|
@@ -4,22 +4,22 @@ import { dirname as __hf_dirname } from "node:path";
|
|
|
4
4
|
var require = __hf_createRequire(import.meta.url);
|
|
5
5
|
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
resolveProject
|
|
9
|
-
} from "./chunk-URYAKNQ2.js";
|
|
10
7
|
import {
|
|
11
8
|
installPageFunctionGuard,
|
|
12
9
|
resolveCliChromeGpuMode,
|
|
13
10
|
seekCompositionTimeline,
|
|
14
11
|
waitForRuntimeReady
|
|
15
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-UAIUVPZE.js";
|
|
16
13
|
import {
|
|
17
14
|
resolveCompositionViewportFromHtml
|
|
18
15
|
} from "./chunk-FH7WODJH.js";
|
|
19
16
|
import {
|
|
20
17
|
launchManagedBrowser,
|
|
21
18
|
resolveManagedGpuMode
|
|
22
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-AXPNVC3N.js";
|
|
20
|
+
import {
|
|
21
|
+
resolveProject
|
|
22
|
+
} from "./chunk-NFQY7EIC.js";
|
|
23
23
|
import {
|
|
24
24
|
defineCommand
|
|
25
25
|
} from "./chunk-S3S4TGEH.js";
|
|
@@ -28,18 +28,18 @@ import {
|
|
|
28
28
|
setCommandExitCode
|
|
29
29
|
} from "./chunk-PBN6GBJE.js";
|
|
30
30
|
import {
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
c
|
|
32
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
33
33
|
import {
|
|
34
34
|
printDeprecationNotice,
|
|
35
35
|
withMeta
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AFRXL75S.js";
|
|
37
|
+
import {
|
|
38
|
+
decodeWellFormedEscapes
|
|
39
|
+
} from "./chunk-BSQ7XANM.js";
|
|
37
40
|
import {
|
|
38
41
|
normalizeErrorMessage
|
|
39
42
|
} from "./chunk-KNU5COPB.js";
|
|
40
|
-
import {
|
|
41
|
-
c
|
|
42
|
-
} from "./chunk-ZTZA4UWZ.js";
|
|
43
43
|
|
|
44
44
|
// src/commands/validate.ts
|
|
45
45
|
import { existsSync, mkdtempSync, readFileSync, rmSync } from "fs";
|
|
@@ -228,7 +228,7 @@ function extractCompositionErrorsFromLint(lintResult) {
|
|
|
228
228
|
async function localizeRemoteAssets(html) {
|
|
229
229
|
let dir;
|
|
230
230
|
try {
|
|
231
|
-
const { loadProducer } = await import("./producer-
|
|
231
|
+
const { loadProducer } = await import("./producer-FFH2KUAZ.js");
|
|
232
232
|
const { localizeRemoteMediaSources, localizeRemoteImageSources, localizeRemoteFontFaces } = await loadProducer();
|
|
233
233
|
dir = mkdtempSync(join(tmpdir(), "hf-validate-assets-"));
|
|
234
234
|
const assetDir = dir;
|
|
@@ -249,9 +249,9 @@ async function localizeRemoteAssets(html) {
|
|
|
249
249
|
}
|
|
250
250
|
async function validateInBrowser(project, opts) {
|
|
251
251
|
const projectDir = project.dir;
|
|
252
|
-
const { bundleToSingleHtml } = await import("./compiler-
|
|
253
|
-
const { ensureBrowser } = await import("./manager-
|
|
254
|
-
const { serveStaticProjectHtml } = await import("./staticProjectServer-
|
|
252
|
+
const { bundleToSingleHtml } = await import("./compiler-UQP2VXN6.js");
|
|
253
|
+
const { ensureBrowser } = await import("./manager-GWU5J6RJ.js");
|
|
254
|
+
const { serveStaticProjectHtml } = await import("./staticProjectServer-QLWWGHZE.js");
|
|
255
255
|
const { lintProject } = await import("./lintProject-SSEXWCH6.js");
|
|
256
256
|
const lintResult = await lintProject(projectDir);
|
|
257
257
|
const compositionErrors = extractCompositionErrorsFromLint(lintResult);
|
|
@@ -273,9 +273,9 @@ async function validateInBrowser(project, opts) {
|
|
|
273
273
|
try {
|
|
274
274
|
const browser = await ensureBrowser();
|
|
275
275
|
const puppeteer = await import("puppeteer-core");
|
|
276
|
-
const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-
|
|
276
|
+
const { buildChromeArgs, analyzeClipMediaFit } = await import("./src-7V6LBC56.js");
|
|
277
277
|
const requestedGpuMode = resolveCliChromeGpuMode();
|
|
278
|
-
const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu, resolveLocalWebGpu } = await import("./gpuPolicy-
|
|
278
|
+
const { assertWebGpuAdapterAvailable, compositionRequiresWebGpu, resolveLocalWebGpu } = await import("./gpuPolicy-HBCCEQUS.js");
|
|
279
279
|
const resolvedGpuMode = await resolveManagedGpuMode(requestedGpuMode, browser.executablePath);
|
|
280
280
|
const requiresWebGpu = compositionRequiresWebGpu(html);
|
|
281
281
|
const { gpuConfig, softwareWebGpu } = resolveLocalWebGpu(resolvedGpuMode, requiresWebGpu);
|
|
@@ -7,38 +7,41 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
RegistryCompatibilityError,
|
|
9
9
|
gateRegistryItemsCompatibility
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DOVJRUFM.js";
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_PROJECT_CONFIG,
|
|
13
13
|
createProjectConfig,
|
|
14
14
|
loadProjectConfig,
|
|
15
15
|
projectConfigPath,
|
|
16
16
|
recordProjectRegistryItems
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XQMEGSHG.js";
|
|
18
18
|
import {
|
|
19
19
|
resolveItemWithDependencies,
|
|
20
20
|
resolveItemsByTag
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BLRJKBKP.js";
|
|
22
22
|
import {
|
|
23
23
|
InvalidVariableValuesError,
|
|
24
24
|
prepareItem,
|
|
25
25
|
publishItem
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-M6UDJ2E7.js";
|
|
27
27
|
import {
|
|
28
28
|
DEFAULT_REGISTRY_URL
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OQ7XMM3S.js";
|
|
30
30
|
import {
|
|
31
31
|
trackRegistryItemAdded
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-3UAIVF4L.js";
|
|
33
33
|
import {
|
|
34
34
|
defineCommand
|
|
35
35
|
} from "./chunk-S3S4TGEH.js";
|
|
36
36
|
import {
|
|
37
37
|
failCommand
|
|
38
38
|
} from "./chunk-PBN6GBJE.js";
|
|
39
|
+
import {
|
|
40
|
+
c
|
|
41
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
39
42
|
import {
|
|
40
43
|
ITEM_TYPE_DIRS
|
|
41
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-PCWOSS7G.js";
|
|
42
45
|
import {
|
|
43
46
|
isProjectRootMissing,
|
|
44
47
|
realpath
|
|
@@ -46,9 +49,6 @@ import {
|
|
|
46
49
|
import {
|
|
47
50
|
parseHTML
|
|
48
51
|
} from "./chunk-SDYDNHEE.js";
|
|
49
|
-
import {
|
|
50
|
-
c
|
|
51
|
-
} from "./chunk-ZTZA4UWZ.js";
|
|
52
52
|
|
|
53
53
|
// src/commands/add.ts
|
|
54
54
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -6,24 +6,24 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
serveStaticProjectHtml
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
resolveProject
|
|
12
|
-
} from "./chunk-URYAKNQ2.js";
|
|
9
|
+
} from "./chunk-S5F26DUL.js";
|
|
13
10
|
import {
|
|
14
11
|
AUDIT_SEEK_OPTIONS,
|
|
15
12
|
installPageFunctionGuard,
|
|
16
13
|
seekCompositionTimeline,
|
|
17
14
|
waitForCompositionFonts,
|
|
18
15
|
waitForRuntimeReady
|
|
19
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-UAIUVPZE.js";
|
|
20
17
|
import {
|
|
21
18
|
launchManagedBrowser,
|
|
22
19
|
resolveManagedGpuMode
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-AXPNVC3N.js";
|
|
24
21
|
import {
|
|
25
22
|
resolveDiagnosticNavigationTimeoutMs
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-423DJVX2.js";
|
|
24
|
+
import {
|
|
25
|
+
resolveProject
|
|
26
|
+
} from "./chunk-NFQY7EIC.js";
|
|
27
27
|
import {
|
|
28
28
|
defineCommand
|
|
29
29
|
} from "./chunk-S3S4TGEH.js";
|
|
@@ -31,16 +31,16 @@ import {
|
|
|
31
31
|
failCommand,
|
|
32
32
|
setCommandExitCode
|
|
33
33
|
} from "./chunk-PBN6GBJE.js";
|
|
34
|
+
import {
|
|
35
|
+
c
|
|
36
|
+
} from "./chunk-ZTZA4UWZ.js";
|
|
34
37
|
import {
|
|
35
38
|
printDeprecationNotice,
|
|
36
39
|
withMeta
|
|
37
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-AFRXL75S.js";
|
|
38
41
|
import {
|
|
39
42
|
normalizeErrorMessage
|
|
40
43
|
} from "./chunk-KNU5COPB.js";
|
|
41
|
-
import {
|
|
42
|
-
c
|
|
43
|
-
} from "./chunk-ZTZA4UWZ.js";
|
|
44
44
|
|
|
45
45
|
// src/commands/layout.ts
|
|
46
46
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
@@ -707,7 +707,7 @@ async function collectTweenBoundaries(page) {
|
|
|
707
707
|
});
|
|
708
708
|
}
|
|
709
709
|
async function bundleProjectHtml(projectDir) {
|
|
710
|
-
const { bundleToSingleHtml } = await import("./compiler-
|
|
710
|
+
const { bundleToSingleHtml } = await import("./compiler-UQP2VXN6.js");
|
|
711
711
|
return bundleToSingleHtml(projectDir);
|
|
712
712
|
}
|
|
713
713
|
async function alignViewportToComposition(page, url) {
|
|
@@ -727,15 +727,15 @@ async function alignViewportToComposition(page, url) {
|
|
|
727
727
|
});
|
|
728
728
|
}
|
|
729
729
|
async function runLayoutAudit(projectDir, opts) {
|
|
730
|
-
const { ensureBrowser } = await import("./manager-
|
|
730
|
+
const { ensureBrowser } = await import("./manager-GWU5J6RJ.js");
|
|
731
731
|
const puppeteer = await import("puppeteer-core");
|
|
732
|
-
const { buildChromeArgs } = await import("./src-
|
|
732
|
+
const { buildChromeArgs } = await import("./src-7V6LBC56.js");
|
|
733
733
|
const {
|
|
734
734
|
assertWebGpuAdapterAvailable,
|
|
735
735
|
compositionRequiresWebGpu,
|
|
736
736
|
resolveLocalBrowserGpuMode,
|
|
737
737
|
resolveLocalWebGpu
|
|
738
|
-
} = await import("./gpuPolicy-
|
|
738
|
+
} = await import("./gpuPolicy-HBCCEQUS.js");
|
|
739
739
|
const html = await bundleProjectHtml(projectDir);
|
|
740
740
|
const server = await serveStaticProjectHtml(
|
|
741
741
|
projectDir,
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
terminateProcessTree
|
|
9
|
+
} from "./chunk-KGPLIH7B.js";
|
|
10
|
+
|
|
11
|
+
// src/utils/stoppableExecFile.ts
|
|
12
|
+
import { execFileSync, spawn } from "child_process";
|
|
13
|
+
import * as util from "util";
|
|
14
|
+
function syscallError(code, file, args) {
|
|
15
|
+
const known = util.getSystemErrorMap?.() ?? /* @__PURE__ */ new Map();
|
|
16
|
+
const errno = [...known].find(([, [name]]) => name === code)?.[0];
|
|
17
|
+
return Object.assign(new Error(`spawnSync ${file} ${code}`), {
|
|
18
|
+
errno,
|
|
19
|
+
code,
|
|
20
|
+
syscall: `spawnSync ${file}`,
|
|
21
|
+
path: file,
|
|
22
|
+
spawnargs: args
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async function stoppableExecFile(file, args, options) {
|
|
26
|
+
const { signal, ...syncOptions } = options;
|
|
27
|
+
if (!signal) {
|
|
28
|
+
execFileSync(file, args, syncOptions);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
signal.throwIfAborted();
|
|
32
|
+
const maxBuffer = options.maxBuffer ?? 1024 * 1024;
|
|
33
|
+
await new Promise((resolve, reject) => {
|
|
34
|
+
const child = spawn(file, args, { cwd: options.cwd, env: options.env, stdio: options.stdio });
|
|
35
|
+
let failure;
|
|
36
|
+
const stopWith = (code) => {
|
|
37
|
+
failure ??= code;
|
|
38
|
+
child.kill("SIGTERM");
|
|
39
|
+
};
|
|
40
|
+
const collect = (stream) => {
|
|
41
|
+
if (!stream) return null;
|
|
42
|
+
const chunks = [];
|
|
43
|
+
let size = 0;
|
|
44
|
+
stream.on("data", (chunk) => {
|
|
45
|
+
chunks.push(chunk);
|
|
46
|
+
size += chunk.length;
|
|
47
|
+
if (size > maxBuffer) stopWith("ENOBUFS");
|
|
48
|
+
});
|
|
49
|
+
return chunks;
|
|
50
|
+
};
|
|
51
|
+
const stdout = collect(child.stdout);
|
|
52
|
+
const stderr = collect(child.stderr);
|
|
53
|
+
child.stdin?.end();
|
|
54
|
+
const timer = setTimeout(() => stopWith("ETIMEDOUT"), options.timeout);
|
|
55
|
+
let stopping;
|
|
56
|
+
const onAbort = () => {
|
|
57
|
+
if (child.pid === void 0) return;
|
|
58
|
+
stopping ??= terminateProcessTree(child.pid, { child }).catch(() => void 0);
|
|
59
|
+
};
|
|
60
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
61
|
+
const settle = () => {
|
|
62
|
+
clearTimeout(timer);
|
|
63
|
+
signal.removeEventListener("abort", onAbort);
|
|
64
|
+
};
|
|
65
|
+
child.on("error", (err) => {
|
|
66
|
+
if (child.pid !== void 0) return;
|
|
67
|
+
settle();
|
|
68
|
+
const spawnError = syscallError(err.code ?? "UNKNOWN", file, args);
|
|
69
|
+
const result = { status: null, signal: null, output: null, pid: 0 };
|
|
70
|
+
reject(Object.assign(spawnError, { error: spawnError }, result));
|
|
71
|
+
});
|
|
72
|
+
child.on("close", (status, exitSignal) => {
|
|
73
|
+
settle();
|
|
74
|
+
if (signal.aborted) {
|
|
75
|
+
void Promise.resolve(stopping).then(() => reject(signal.reason));
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const out = stdout && Buffer.concat(stdout);
|
|
79
|
+
const errText = stderr && Buffer.concat(stderr);
|
|
80
|
+
const result = {
|
|
81
|
+
status,
|
|
82
|
+
signal: exitSignal,
|
|
83
|
+
output: [null, out, errText],
|
|
84
|
+
pid: child.pid,
|
|
85
|
+
stdout: out,
|
|
86
|
+
stderr: errText
|
|
87
|
+
};
|
|
88
|
+
if (failure) {
|
|
89
|
+
const err = syscallError(failure, file, args);
|
|
90
|
+
return reject(Object.assign(err, { error: err }, result));
|
|
91
|
+
}
|
|
92
|
+
if (status === 0) return resolve();
|
|
93
|
+
const command = `Command failed: ${[file, ...args].join(" ")}`;
|
|
94
|
+
const message = errText?.length ? `${command}
|
|
95
|
+
${errText.toString()}` : command;
|
|
96
|
+
reject(Object.assign(new Error(message), result));
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export {
|
|
102
|
+
stoppableExecFile
|
|
103
|
+
};
|
|
@@ -6,8 +6,8 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
|
|
8
8
|
// src/version.ts
|
|
9
|
-
var VERSION = true ? "0.8.
|
|
10
|
-
var PRODUCER_VERSION = true ? "0.8.
|
|
9
|
+
var VERSION = true ? "0.8.150" : "0.0.0-dev";
|
|
10
|
+
var PRODUCER_VERSION = true ? "0.8.150" : "0.0.0-dev";
|
|
11
11
|
|
|
12
12
|
export {
|
|
13
13
|
VERSION,
|
|
@@ -7,6 +7,9 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
TRANSCRIPT_FILE
|
|
9
9
|
} from "./chunk-IR35BCLK.js";
|
|
10
|
+
import {
|
|
11
|
+
stoppableExecFile
|
|
12
|
+
} from "./chunk-HU2SPFNG.js";
|
|
10
13
|
|
|
11
14
|
// src/whisper/parakeet.ts
|
|
12
15
|
import { execFileSync } from "child_process";
|
|
@@ -163,7 +166,7 @@ function silenceCuts(samples, sampleRate, windowSeconds = 60) {
|
|
|
163
166
|
if (samples.length > 0) cuts.push(samples.length);
|
|
164
167
|
return cuts;
|
|
165
168
|
}
|
|
166
|
-
function transcribeWithParakeet(inputPath, dir, options) {
|
|
169
|
+
async function transcribeWithParakeet(inputPath, dir, options) {
|
|
167
170
|
const runner = findParakeet();
|
|
168
171
|
if (!runner) {
|
|
169
172
|
throw new Error(
|
|
@@ -188,7 +191,11 @@ function transcribeWithParakeet(inputPath, dir, options) {
|
|
|
188
191
|
model: PARAKEET_MODEL_LABEL,
|
|
189
192
|
status: "started"
|
|
190
193
|
});
|
|
191
|
-
|
|
194
|
+
await stoppableExecFile(runner, argv, {
|
|
195
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
196
|
+
timeout: 18e5,
|
|
197
|
+
signal: options?.signal
|
|
198
|
+
});
|
|
192
199
|
const produced = join(workDir, `${basename(inputPath, extname(inputPath))}.json`);
|
|
193
200
|
if (!existsSync(produced)) throw new Error("Parakeet did not produce output.");
|
|
194
201
|
const result = writeParakeetTranscript(
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// src/utils/processTree.ts
|
|
9
|
+
import { execFileSync, spawn } from "child_process";
|
|
10
|
+
import { readdirSync, readFileSync } from "fs";
|
|
11
|
+
function processIsAlive(pid) {
|
|
12
|
+
try {
|
|
13
|
+
process.kill(pid, 0);
|
|
14
|
+
return true;
|
|
15
|
+
} catch (error) {
|
|
16
|
+
return error?.code !== "ESRCH";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function processGroupIsAlive(pid) {
|
|
20
|
+
if (process.platform === "linux") {
|
|
21
|
+
try {
|
|
22
|
+
return readdirSync("/proc").some((entry) => {
|
|
23
|
+
if (!/^\d+$/.test(entry)) return false;
|
|
24
|
+
try {
|
|
25
|
+
const stat = readFileSync(`/proc/${entry}/stat`, "utf8");
|
|
26
|
+
const fields = stat.slice(stat.lastIndexOf(") ") + 2).split(/\s+/);
|
|
27
|
+
return fields[2] === String(pid) && fields[0] !== "Z" && fields[0] !== "X";
|
|
28
|
+
} catch {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return processIsAlive(-pid);
|
|
36
|
+
}
|
|
37
|
+
function waitForDelay(delayMs) {
|
|
38
|
+
return new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
39
|
+
}
|
|
40
|
+
async function waitForProcessGroupExit(pid) {
|
|
41
|
+
while (processGroupIsAlive(pid)) await waitForDelay(20);
|
|
42
|
+
}
|
|
43
|
+
function windowsProcessTreeKillArgs(pid) {
|
|
44
|
+
return ["/PID", String(pid), "/T", "/F"];
|
|
45
|
+
}
|
|
46
|
+
function terminateWindowsProcessTree(pid, spawnProcess = (command, args, options) => spawn(command, [...args], options)) {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const killer = spawnProcess("taskkill", windowsProcessTreeKillArgs(pid), {
|
|
49
|
+
stdio: "ignore",
|
|
50
|
+
windowsHide: true
|
|
51
|
+
});
|
|
52
|
+
killer.once("error", reject);
|
|
53
|
+
killer.once("close", (status) => {
|
|
54
|
+
if (status === 0) resolve();
|
|
55
|
+
else reject(new Error(`taskkill exited with status ${status ?? "unknown"}`));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function signalProcessGroup(pid, signal) {
|
|
60
|
+
try {
|
|
61
|
+
process.kill(-pid, signal);
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function getDescendants(pid) {
|
|
66
|
+
let children;
|
|
67
|
+
try {
|
|
68
|
+
const raw = execFileSync("pgrep", ["-P", String(pid)], {
|
|
69
|
+
encoding: "utf8",
|
|
70
|
+
timeout: 2e3
|
|
71
|
+
}).trim();
|
|
72
|
+
children = raw.split(/\r?\n/).map(Number).filter((childPid) => Number.isInteger(childPid) && childPid > 0);
|
|
73
|
+
} catch {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
return children.flatMap((childPid) => [childPid, ...getDescendants(childPid)]);
|
|
77
|
+
}
|
|
78
|
+
function signalProcesses(pids, signal) {
|
|
79
|
+
for (const pid of pids) {
|
|
80
|
+
try {
|
|
81
|
+
process.kill(pid, signal);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async function terminatePidTree(pid, signal) {
|
|
87
|
+
const pids = [...getDescendants(pid).reverse(), pid];
|
|
88
|
+
signalProcesses(pids, signal);
|
|
89
|
+
if (signal === "SIGKILL") return "SIGKILL";
|
|
90
|
+
await waitForDelay(500);
|
|
91
|
+
const survivors = pids.filter(processIsAlive);
|
|
92
|
+
signalProcesses(survivors, "SIGKILL");
|
|
93
|
+
return survivors.length > 0 ? "SIGKILL" : "SIGTERM";
|
|
94
|
+
}
|
|
95
|
+
async function terminateProcessGroup(pid, signal) {
|
|
96
|
+
signalProcessGroup(pid, signal);
|
|
97
|
+
if (signal === "SIGKILL") {
|
|
98
|
+
await waitForProcessGroupExit(pid);
|
|
99
|
+
return "SIGKILL";
|
|
100
|
+
}
|
|
101
|
+
await Promise.race([waitForProcessGroupExit(pid), waitForDelay(250)]);
|
|
102
|
+
if (!processGroupIsAlive(pid)) return "SIGTERM";
|
|
103
|
+
signalProcessGroup(pid, "SIGKILL");
|
|
104
|
+
await waitForProcessGroupExit(pid);
|
|
105
|
+
return "SIGKILL";
|
|
106
|
+
}
|
|
107
|
+
async function terminateProcessTree(pid, options = {}) {
|
|
108
|
+
if (process.platform === "win32") {
|
|
109
|
+
try {
|
|
110
|
+
await terminateWindowsProcessTree(pid, options.spawnProcess);
|
|
111
|
+
} catch (error) {
|
|
112
|
+
try {
|
|
113
|
+
options.child?.kill("SIGKILL");
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
if (options.child) throw error;
|
|
117
|
+
}
|
|
118
|
+
return "SIGKILL";
|
|
119
|
+
}
|
|
120
|
+
const signal = options.signal ?? "SIGTERM";
|
|
121
|
+
return options.processGroup ? terminateProcessGroup(pid, signal) : terminatePidTree(pid, signal);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {
|
|
125
|
+
processIsAlive,
|
|
126
|
+
terminateProcessTree
|
|
127
|
+
};
|