hyperframes 0.8.183 → 0.8.184
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-HW3ZGR36.js → add-5ZTD3MUZ.js} +11 -11
- package/dist/{animatedGifPrep-EPLN37ZN.js → animatedGifPrep-AGASIWVA.js} +6 -5
- package/dist/api.js +14 -13
- package/dist/{asset-TOASKL3Z.js → asset-LSTEMPIB.js} +2 -2
- package/dist/{assetCataloger-PZN5HYG2.js → assetCataloger-BKBMNL3A.js} +6 -5
- package/dist/{audio-F5OIQVJO.js → audio-KGK44XE4.js} +13 -12
- package/dist/{auth-YVQLRS3T.js → auth-MJWKYK77.js} +1 -1
- package/dist/{autoUpdate-EG4ZFW4D.js → autoUpdate-2GGDKYR2.js} +2 -2
- package/dist/{backgroundChecks-WINNQVR2.js → backgroundChecks-7GRX5VQY.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-PASZTMEE.js → batchRender-BCV2LELR.js} +3 -3
- package/dist/{beats-KGIOEBLW.js → beats-7BCFRBAL.js} +4 -4
- package/dist/{benchmark-ZNY2L7HN.js → benchmark-2R6CN5MQ.js} +8 -8
- package/dist/{browser-REAO7RU4.js → browser-6AFGOI7G.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-OAYLYC4W.js → bundleWithLocalizedFonts-2EGPA5ZO.js} +2 -2
- package/dist/{capture-IK6GWQDD.js → capture-HA2UHLIU.js} +2 -2
- package/dist/{capture-WOSF276U.js → capture-HOIAW6MO.js} +9 -8
- package/dist/{captureCompositionFrame-DDZNKYRE.js → captureCompositionFrame-4236FVWJ.js} +10 -9
- package/dist/{catalog-AKTXS7OJ.js → catalog-A6CZAWW4.js} +11 -11
- package/dist/{catch-up-O3VZMPVE.js → catch-up-TNA4DJOA.js} +4 -4
- package/dist/{check-6E46NIWI.js → check-5E5U2EQZ.js} +30 -29
- package/dist/{checkBrowser-UNZHQFNH.js → checkBrowser-FNINXBMZ.js} +27 -26
- package/dist/{chunk-5MBLWFLM.js → chunk-2PVE4WS2.js} +1 -1
- package/dist/{chunk-TOHA5NAU.js → chunk-2ULXZ4PG.js} +10 -10
- package/dist/{chunk-GAGMLVCV.js → chunk-2XA7KXQO.js} +2 -2
- package/dist/{chunk-4UFJWRHG.js → chunk-3MDJIWOV.js} +174 -62
- package/dist/{chunk-NZ3BE2QE.js → chunk-3QVMJ7GX.js} +7 -7
- package/dist/{chunk-3Q47QC46.js → chunk-3TXNNBI2.js} +1 -1
- package/dist/{chunk-Z4R35NJS.js → chunk-4KKKBEP3.js} +3 -3
- package/dist/{chunk-RZXUQR42.js → chunk-4N4P3ZWL.js} +2 -2
- package/dist/{chunk-J4L5TPLS.js → chunk-5UDRPPN2.js} +48 -6
- package/dist/{chunk-XJHKJXT4.js → chunk-74JMKLVU.js} +1 -1
- package/dist/{chunk-OH56PXFH.js → chunk-7HJALUIO.js} +1 -1
- package/dist/{chunk-BP4VNTZL.js → chunk-7MB2ZAQF.js} +1 -1
- package/dist/{chunk-HLBODNGW.js → chunk-7NRI7HYX.js} +1 -1
- package/dist/{chunk-ANR6WOC3.js → chunk-ABZYYUUH.js} +1 -1
- package/dist/{chunk-VH5KESLX.js → chunk-BCHSTE7U.js} +1 -1
- package/dist/{chunk-KRFAX5JK.js → chunk-CXABAXB3.js} +1 -1
- package/dist/{chunk-LBWRQ4XA.js → chunk-DWUGKEHR.js} +1 -1
- package/dist/{chunk-MIZDJVPZ.js → chunk-E32ZQ2WO.js} +1 -1
- package/dist/{chunk-CAHTO62O.js → chunk-EM7C7H7S.js} +7 -7
- package/dist/{chunk-B2SZZFWW.js → chunk-ES426XRJ.js} +3 -3
- package/dist/{chunk-O7N3A7PE.js → chunk-FGJEUV4S.js} +1 -1
- package/dist/{chunk-Q6UYKWBG.js → chunk-GDEV42FA.js} +14 -14
- package/dist/{chunk-TXGZZKDF.js → chunk-HR23IKLZ.js} +2 -2
- package/dist/{chunk-XOVHO3TT.js → chunk-ICJEAFPD.js} +7 -7
- package/dist/{chunk-4FQKS7BJ.js → chunk-IWTNTUPQ.js} +4 -4
- package/dist/chunk-IZCW2NKT.js +29 -0
- package/dist/{chunk-X3IA5RYH.js → chunk-J36JVBLR.js} +9 -2
- package/dist/{chunk-VFBAKPRC.js → chunk-J3QM7AHP.js} +1 -1
- package/dist/{chunk-ITSLKUQM.js → chunk-JB6ARMQS.js} +1 -1
- package/dist/{chunk-DLC2FICN.js → chunk-JIUTXKWA.js} +1 -1
- package/dist/{chunk-GTE5WZAM.js → chunk-KN46TGHV.js} +1 -1
- package/dist/{chunk-VDJO4DJ7.js → chunk-LLC4CS6I.js} +2 -2
- package/dist/{chunk-TJB4GAV6.js → chunk-LRGYPXHF.js} +1 -1
- package/dist/{chunk-CGK4XZ2J.js → chunk-MFAETWIF.js} +1 -1
- package/dist/{chunk-QGOYNPQT.js → chunk-OLZENUPI.js} +47 -4
- package/dist/{chunk-K2Z5DZBS.js → chunk-PFYWVUHA.js} +1 -1
- package/dist/{chunk-F6WHPHLF.js → chunk-PSKEKWVU.js} +1 -1
- package/dist/{chunk-3OLIGYWN.js → chunk-Q33P4EAC.js} +2 -2
- package/dist/{chunk-CJYAJ3QM.js → chunk-QL2PNIXC.js} +9 -9
- package/dist/{chunk-IC2WYONA.js → chunk-R2BFTECP.js} +3 -3
- package/dist/chunk-R2SQBPMH.js +3805 -0
- package/dist/{chunk-73LTCCZI.js → chunk-RGXVEYHI.js} +15 -15
- package/dist/{chunk-SAQYJLI6.js → chunk-SAX7HQ5E.js} +1 -1
- package/dist/{chunk-GPE3WWTO.js → chunk-SN7KI5JA.js} +13 -10
- package/dist/{chunk-ATMDOUNN.js → chunk-TE427YID.js} +2 -2
- package/dist/{chunk-VAK7A2N6.js → chunk-UJKUB2LH.js} +10 -10
- package/dist/{chunk-DEORFAWP.js → chunk-UKOTVJFV.js} +1 -1
- package/dist/{chunk-ZFO3A3QL.js → chunk-UNNXFKVG.js} +2 -2
- package/dist/{chunk-UNOSCGBG.js → chunk-VDM3FEDP.js} +1 -1
- package/dist/{chunk-QX4GGPMY.js → chunk-VNVQGDPC.js} +1 -1
- package/dist/{chunk-3BA2GP4H.js → chunk-WHPN2TIT.js} +5 -5
- package/dist/{chunk-XR5BSEUF.js → chunk-WTFUDNW2.js} +3 -3
- package/dist/{chunk-U5YVWG5W.js → chunk-X3CG5YQA.js} +3 -3
- package/dist/{chunk-XAQDR5Y5.js → chunk-XGHHVYC7.js} +94 -32
- package/dist/{chunk-WT4PYV2J.js → chunk-YALM6XN4.js} +200 -53
- package/dist/{chunk-R6OV4J4K.js → chunk-YOZPQCSR.js} +3 -3
- package/dist/{chunk-COTLNID2.js → chunk-YWHCXIMD.js} +5 -5
- package/dist/{chunk-5OGDBU4G.js → chunk-YWNJTZGN.js} +2 -2
- package/dist/{chunk-AKFADCMS.js → chunk-ZOCHDXDG.js} +1 -1
- package/dist/{chunk-EVAQPW6O.js → chunk-ZRHO6YMM.js} +2 -2
- package/dist/{clean-WNEIVBF3.js → clean-HGASSMWI.js} +14 -13
- package/dist/cli.js +53 -53
- package/dist/{cloud-6GSSDCJL.js → cloud-JPDVNXHN.js} +4 -4
- package/dist/{cloudrun-4NEJRE4T.js → cloudrun-AMMGSDRP.js} +4 -4
- package/dist/{compare-2JWQ5ABA.js → compare-LHHVHUN3.js} +24 -23
- package/dist/{compiler-27KQD7KW.js → compiler-Q3N6QXMT.js} +2 -2
- package/dist/{component-HCRET3MH.js → component-D72J32Q7.js} +3 -3
- package/dist/{compositions-HTSQ6SUJ.js → compositions-UQRJ5ROG.js} +10 -9
- package/dist/{delete-GHQ5UYM7.js → delete-P42VIDDA.js} +3 -3
- package/dist/{deploy-I3Z3NAVA.js → deploy-WZTH57O4.js} +1 -1
- package/dist/{deterministicFonts-JFLSSKRB.js → deterministicFonts-VQ5UBMXY.js} +1 -1
- package/dist/{dist-WRDLWRMS.js → dist-DYS24AMA.js} +2 -2
- package/dist/{doctor-UGFVQZHI.js → doctor-KEJIG2SK.js} +10 -9
- package/dist/{events-YS4OVX3I.js → events-CYKSNR7N.js} +2 -2
- package/dist/{events-BLJGWMNP.js → events-UZXFQPMT.js} +3 -3
- package/dist/{feedback-AZ3SJ5HF.js → feedback-LXNQF7CA.js} +7 -7
- package/dist/{ffmpeg-2AECXG7V.js → ffmpeg-BYHON577.js} +6 -5
- package/dist/{figma-DRYIJQHV.js → figma-EIQ35PS6.js} +3 -3
- package/dist/fontLocalizeCli.js +9 -8
- package/dist/{get-DDEAOFPB.js → get-CC2YL7QO.js} +3 -3
- package/dist/{gpuPolicy-UDJT2MQK.js → gpuPolicy-VFSACUQV.js} +6 -5
- package/dist/{grade-compare-LJKK5NSY.js → grade-compare-TUQL7IV2.js} +25 -24
- package/dist/{help-TQBGYOID.js → help-ROROO5K6.js} +1 -1
- package/dist/{history-5TOOCF2Y.js → history-PNELYLXX.js} +6 -6
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +59 -59
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-ENI5MP4W.js → info-4FZTH6AS.js} +7 -7
- package/dist/{init-JXPXWV3G.js → init-I43GHHVP.js} +26 -25
- package/dist/{inspect-WZNYQ5AB.js → inspect-IT4TYIZ3.js} +25 -24
- package/dist/{installer-3SGRBLJW.js → installer-CWOJVK5K.js} +4 -4
- package/dist/{keyframes-HEOC4CT4.js → keyframes-3FBOGVD4.js} +6 -6
- package/dist/{lambda-2VHQ4AL2.js → lambda-H3V32I7M.js} +6 -6
- package/dist/{layout-7WEUNO6T.js → layout-BZ5LYJ5C.js} +25 -24
- package/dist/{lint-5YMAF3L7.js → lint-ZTNSGP2S.js} +6 -6
- package/dist/{list-BIE3X7CO.js → list-XM4GWJYY.js} +3 -3
- package/dist/{login-YDIGJWCG.js → login-H6HYKMWX.js} +4 -4
- package/dist/{manager-D2UV6RDQ.js → manager-TWVDSJXO.js} +7 -6
- package/dist/{media-treatment-FSKHPMWA.js → media-treatment-N7MY5NXB.js} +12 -11
- package/dist/{models-COEK6LXG.js → models-WEMIMYBD.js} +10 -9
- package/dist/{motionShot-HYZ2ZGJQ.js → motionShot-RHICTVPU.js} +13 -12
- package/dist/{normalize-audio-UXR6WQ7Q.js → normalize-audio-ZFUZCJE3.js} +4 -4
- package/dist/{open-OFT2GIDG.js → open-IBJ4FL3G.js} +11 -11
- package/dist/{parakeetRunner-4NZ3QXS3.js → parakeetRunner-XXO4WSLR.js} +11 -10
- package/dist/{pipeline-ZKE54JMG.js → pipeline-6ML3LUVK.js} +7 -6
- package/dist/{play-2VG77FT6.js → play-RV4NAVF5.js} +17 -16
- package/dist/{preflight-QTWDIM5C.js → preflight-R3DEFMLA.js} +7 -6
- package/dist/{present-OONXQLJG.js → present-5TBJGE6B.js} +13 -12
- package/dist/{preview-6RZJFU76.js → preview-FLKZ5CXJ.js} +23 -22
- package/dist/{producer-6YM3UH3B.js → producer-7XYSPVKH.js} +1 -1
- package/dist/{projectConfig-YMW4P2X6.js → projectConfig-TBU2VWZX.js} +6 -6
- package/dist/{publication-SEINUAPZ.js → publication-CWWUJYJ5.js} +2 -2
- package/dist/{publish-KZBTBWFO.js → publish-FSNE4FEB.js} +9 -8
- package/dist/{remove-background-BIQNMIR7.js → remove-background-MDFWRWCT.js} +8 -7
- package/dist/render-DBGQZAZT.js +1516 -0
- package/dist/{render-FIH37HJA.js → render-F4JQ553X.js} +27 -26
- package/dist/{render-LW76HOMJ.js → render-LWZKXCLY.js} +3 -3
- package/dist/{render-batch-POLEEYD4.js → render-batch-PU7NMLIJ.js} +3 -3
- package/dist/{resolver-O2SED3XB.js → resolver-RUBGFXPC.js} +4 -4
- package/dist/{sherpa-HTFFFTVQ.js → sherpa-X2TBNO6P.js} +10 -9
- package/dist/{skills-J6MBGS5O.js → skills-WHKMWO2D.js} +5 -5
- package/dist/{skillsUpdateCheck-ZAXNLBF3.js → skillsUpdateCheck-XQGZGJJG.js} +3 -3
- package/dist/{snapshot-TL7TTFS6.js → snapshot-M4NUUSNU.js} +28 -27
- package/dist/{src-EL6HGIS4.js → src-4UYM2K3S.js} +5 -4
- package/dist/{src-Z5H5N5T4.js → src-6MSC62U2.js} +11 -7
- package/dist/{staticProjectServer-EO7X7RAY.js → staticProjectServer-ERDTFP45.js} +13 -12
- package/dist/studio/assets/{hyperframes-player-hz_VqxBZ.js → hyperframes-player-DEncBxR7.js} +1 -1
- package/dist/studio/assets/{index-S1ceEagc.js → index-BABXr78Q.js} +4 -4
- package/dist/studio/assets/{index-CV_ojgp5.js → index-Cc22mgvY.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-CUZDC5B3.js → studio-api-SAKD3VKC.js} +7 -6
- package/dist/{studioServer-EZPRV43Y.js → studioServer-IRI7EVOM.js} +43 -42
- package/dist/{telemetry-LFUVHARP.js → telemetry-F4XADVAF.js} +3 -3
- package/dist/{timeline-GSH743JE.js → timeline-5I444RRE.js} +15 -14
- package/dist/{tokens-3ZMPSH7B.js → tokens-LRRYM35A.js} +2 -2
- package/dist/{transcribe-4SHNDPWW.js → transcribe-44XDFNVU.js} +15 -14
- package/dist/{transcribe-TV7JBZQS.js → transcribe-WHYHWAB2.js} +9 -8
- package/dist/{updateCheck-W7FTFOQF.js → updateCheck-7CPH3CAZ.js} +2 -2
- package/dist/{upgrade-7YYYNAPF.js → upgrade-WW4GQ2RI.js} +2 -2
- package/dist/{urlDownloader-PQSUS2CP.js → urlDownloader-OHLLP45A.js} +5 -4
- package/dist/{validate-GCHAEVXM.js → validate-VNCDH2LW.js} +19 -18
- package/dist/{video-KGN7NJS5.js → video-5OHTLL2D.js} +6 -5
- package/dist/warmCheck.js +32 -31
- package/package.json +1 -1
- package/dist/chunk-GMNHAOMJ.js +0 -3805
- package/dist/render-65K3K6SD.js +0 -719
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
EncoderInterruptedError,
|
|
9
9
|
encoderFailureError,
|
|
10
10
|
prepareAnimatedGifInputs
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-TE427YID.js";
|
|
12
12
|
import {
|
|
13
13
|
GENERIC_FAMILIES,
|
|
14
14
|
collectFontFamilyCustomProperties,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
iterateFontFamilyDeclarations,
|
|
17
17
|
normalizeSystemFontPrimaryFamilies,
|
|
18
18
|
resolveFontFamilyDeclarationFamilies
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-OLZENUPI.js";
|
|
20
20
|
import {
|
|
21
21
|
parseEncoderOptions
|
|
22
22
|
} from "./chunk-KLIKCX6Q.js";
|
|
@@ -154,7 +154,7 @@ import {
|
|
|
154
154
|
validateEngineConfigSnapshot,
|
|
155
155
|
verifyDiskDrawElementSamples,
|
|
156
156
|
writeCapturedFrame
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-RGXVEYHI.js";
|
|
158
158
|
import {
|
|
159
159
|
DISTRIBUTED_FPS,
|
|
160
160
|
HF_VFX_ATTR,
|
|
@@ -169,7 +169,7 @@ import {
|
|
|
169
169
|
parseVfxChain,
|
|
170
170
|
resolveAuthoredTimingWindow,
|
|
171
171
|
toFps
|
|
172
|
-
} from "./chunk-
|
|
172
|
+
} from "./chunk-J3QM7AHP.js";
|
|
173
173
|
import {
|
|
174
174
|
assignBundledRuntimeCompositionIds,
|
|
175
175
|
buildVariablesByCompScript,
|
|
@@ -182,7 +182,7 @@ import {
|
|
|
182
182
|
isTemplateEntry,
|
|
183
183
|
parsesAsScript,
|
|
184
184
|
prepareFlattenedInnerRoot
|
|
185
|
-
} from "./chunk-
|
|
185
|
+
} from "./chunk-YALM6XN4.js";
|
|
186
186
|
import {
|
|
187
187
|
COMPOSITION_SOURCE_URL,
|
|
188
188
|
HF_COLOR_GRADING_ATTR,
|
|
@@ -210,7 +210,7 @@ import {
|
|
|
210
210
|
shouldClampResolvedMediaDuration,
|
|
211
211
|
sourceTimeAt,
|
|
212
212
|
styleElementsFor
|
|
213
|
-
} from "./chunk-
|
|
213
|
+
} from "./chunk-R2SQBPMH.js";
|
|
214
214
|
import {
|
|
215
215
|
MAX_AUDIO_GAIN
|
|
216
216
|
} from "./chunk-UJKQWGFF.js";
|
|
@@ -6604,7 +6604,7 @@ async function readLocalFont(absPath) {
|
|
|
6604
6604
|
return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
|
|
6605
6605
|
}
|
|
6606
6606
|
async function embedLocalFontFaces(html, projectDir) {
|
|
6607
|
-
const { fontToDataUri: toDataUri } = await import("./deterministicFonts-
|
|
6607
|
+
const { fontToDataUri: toDataUri } = await import("./deterministicFonts-VQ5UBMXY.js");
|
|
6608
6608
|
const styleBlockRe = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
|
|
6609
6609
|
const fontFaceRe = /@font-face\s*\{([^}]*)\}/gi;
|
|
6610
6610
|
let result = html;
|
|
@@ -8623,6 +8623,7 @@ async function runCaptureStage(input) {
|
|
|
8623
8623
|
if (progress.capturedFrames === 0) reportWorkerStartup(job, progress, onProgress);
|
|
8624
8624
|
return;
|
|
8625
8625
|
}
|
|
8626
|
+
if (progress.landedFrame) input.onFrameLanded?.(progress.landedFrame);
|
|
8626
8627
|
job.framesRendered = progress.capturedFrames;
|
|
8627
8628
|
checkDiskProjection(progress.capturedFrames);
|
|
8628
8629
|
const frameProgress = progress.capturedFrames / progress.totalFrames;
|
|
@@ -9769,6 +9770,7 @@ import {
|
|
|
9769
9770
|
statSync as statSync4,
|
|
9770
9771
|
writeFileSync as writeFileSync4
|
|
9771
9772
|
} from "fs";
|
|
9773
|
+
import { readFile as readFile2 } from "fs/promises";
|
|
9772
9774
|
import { dirname as dirname7, join as join23 } from "path";
|
|
9773
9775
|
|
|
9774
9776
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
@@ -9900,6 +9902,124 @@ function startEncodeProgress(job, stage, onProgress) {
|
|
|
9900
9902
|
});
|
|
9901
9903
|
return (frames = total) => reportEncodeProgress(job, frames, total, onProgress, 75);
|
|
9902
9904
|
}
|
|
9905
|
+
function resolveEngineConfig(input) {
|
|
9906
|
+
return input.engineConfig ?? input.job.config.producerConfig ?? resolveConfig();
|
|
9907
|
+
}
|
|
9908
|
+
function videoEncoderOptions(input, engineCfg) {
|
|
9909
|
+
const { job, preset } = input;
|
|
9910
|
+
return {
|
|
9911
|
+
fps: job.config.fps,
|
|
9912
|
+
width: input.width,
|
|
9913
|
+
height: input.height,
|
|
9914
|
+
codec: preset.codec,
|
|
9915
|
+
preset: preset.preset,
|
|
9916
|
+
quality: input.effectiveQuality,
|
|
9917
|
+
bitrate: input.effectiveBitrate,
|
|
9918
|
+
pixelFormat: preset.pixelFormat,
|
|
9919
|
+
vp9CpuUsed: engineCfg.vp9CpuUsed,
|
|
9920
|
+
useGpu: job.config.useGpu,
|
|
9921
|
+
hdr: preset.hdr,
|
|
9922
|
+
// Distributed chunk renders pass these so the encoder writes closed-GOP
|
|
9923
|
+
// keyframes that survive `-f concat -c copy` at assemble time. In-process
|
|
9924
|
+
// renders leave both undefined → preserves the existing open-GOP output.
|
|
9925
|
+
lockGopForChunkConcat: input.lockGopForChunkConcat === true,
|
|
9926
|
+
gopSize: input.gopSize
|
|
9927
|
+
};
|
|
9928
|
+
}
|
|
9929
|
+
function canEncodeWhileCapturing(input, workerCount, cpuCount) {
|
|
9930
|
+
return workerCount > 1 && workerCount < cpuCount && !input.isPngSequence && !input.isGif && !input.enableChunkedEncode && input.preset.codec === "h264" && !input.preset.hdr && input.job.config.useGpu !== true && input.captureImageFormat === "jpeg" && input.lockGopForChunkConcat !== true;
|
|
9931
|
+
}
|
|
9932
|
+
async function readLandedFrame(workerPath, mergedPath) {
|
|
9933
|
+
if (workerPath !== void 0) {
|
|
9934
|
+
try {
|
|
9935
|
+
return await readFile2(workerPath);
|
|
9936
|
+
} catch (error) {
|
|
9937
|
+
if (error.code !== "ENOENT") throw error;
|
|
9938
|
+
}
|
|
9939
|
+
}
|
|
9940
|
+
return readFile2(mergedPath);
|
|
9941
|
+
}
|
|
9942
|
+
function encodeWhileCapturing(input, totalFrames) {
|
|
9943
|
+
const engineCfg = resolveEngineConfig(input);
|
|
9944
|
+
const stop = new AbortController();
|
|
9945
|
+
const signal = input.abortSignal ? AbortSignal.any([input.abortSignal, stop.signal]) : stop.signal;
|
|
9946
|
+
const landed = /* @__PURE__ */ new Map();
|
|
9947
|
+
let captureDone = false;
|
|
9948
|
+
let framesFed = 0;
|
|
9949
|
+
let wake = null;
|
|
9950
|
+
const nudge = () => {
|
|
9951
|
+
wake?.();
|
|
9952
|
+
wake = null;
|
|
9953
|
+
};
|
|
9954
|
+
signal.addEventListener("abort", nudge, { once: true });
|
|
9955
|
+
let reportFed = null;
|
|
9956
|
+
const encoder = spawnStreamingEncoder(
|
|
9957
|
+
input.videoOnlyPath,
|
|
9958
|
+
{ ...videoEncoderOptions(input, engineCfg), imageFormat: "jpeg" },
|
|
9959
|
+
signal,
|
|
9960
|
+
engineCfg
|
|
9961
|
+
);
|
|
9962
|
+
const fed = (async () => {
|
|
9963
|
+
const stream = await encoder;
|
|
9964
|
+
for (let next = 0; next < totalFrames; next++) {
|
|
9965
|
+
while (!landed.has(next) && !captureDone && !signal.aborted) {
|
|
9966
|
+
await new Promise((resolve11) => wake = resolve11);
|
|
9967
|
+
}
|
|
9968
|
+
if (signal.aborted) return;
|
|
9969
|
+
const mergedPath = join23(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
9970
|
+
const frame = await readLandedFrame(landed.get(next), mergedPath);
|
|
9971
|
+
landed.delete(next);
|
|
9972
|
+
if (!await stream.writeFrame(frame)) {
|
|
9973
|
+
throw new Error(stream.getExitError() ?? "encoder exited before the last frame");
|
|
9974
|
+
}
|
|
9975
|
+
framesFed++;
|
|
9976
|
+
reportFed?.(framesFed);
|
|
9977
|
+
}
|
|
9978
|
+
})().then(
|
|
9979
|
+
() => void 0,
|
|
9980
|
+
(error) => error ?? new Error("encode failed")
|
|
9981
|
+
);
|
|
9982
|
+
const closeEncoder = async () => (await encoder.catch(() => null))?.close();
|
|
9983
|
+
return {
|
|
9984
|
+
onFrameLanded: (frame) => {
|
|
9985
|
+
landed.set(frame.index, frame.path);
|
|
9986
|
+
nudge();
|
|
9987
|
+
},
|
|
9988
|
+
finish: async () => {
|
|
9989
|
+
const start = Date.now();
|
|
9990
|
+
captureDone = true;
|
|
9991
|
+
input.log.info("[Render] Encoded frames while capturing", {
|
|
9992
|
+
framesFed,
|
|
9993
|
+
totalFrames
|
|
9994
|
+
});
|
|
9995
|
+
const encoded = startEncodeProgress(input.job, "Encoding video", input.onProgress);
|
|
9996
|
+
reportFed = encoded;
|
|
9997
|
+
nudge();
|
|
9998
|
+
const failure = await fed;
|
|
9999
|
+
const result = await closeEncoder();
|
|
10000
|
+
input.assertNotAborted();
|
|
10001
|
+
if (failure === void 0 && result?.success) {
|
|
10002
|
+
encoded();
|
|
10003
|
+
return { encodeMs: Date.now() - start };
|
|
10004
|
+
}
|
|
10005
|
+
input.log.warn(
|
|
10006
|
+
"[Render] Encoding while capturing failed; encoding the frames after capture",
|
|
10007
|
+
{
|
|
10008
|
+
error: String(failure ?? result?.error)
|
|
10009
|
+
}
|
|
10010
|
+
);
|
|
10011
|
+
return runEncodeStage(input);
|
|
10012
|
+
},
|
|
10013
|
+
abort: async () => {
|
|
10014
|
+
stop.abort();
|
|
10015
|
+
await fed;
|
|
10016
|
+
await closeEncoder();
|
|
10017
|
+
},
|
|
10018
|
+
get framesFed() {
|
|
10019
|
+
return framesFed;
|
|
10020
|
+
}
|
|
10021
|
+
};
|
|
10022
|
+
}
|
|
9903
10023
|
async function runEncodeStage(input) {
|
|
9904
10024
|
const {
|
|
9905
10025
|
job,
|
|
@@ -9907,16 +10027,11 @@ async function runEncodeStage(input) {
|
|
|
9907
10027
|
outputPath,
|
|
9908
10028
|
framesDir,
|
|
9909
10029
|
videoOnlyPath,
|
|
9910
|
-
width,
|
|
9911
|
-
height,
|
|
9912
10030
|
needsAlpha,
|
|
9913
10031
|
hasAudio,
|
|
9914
10032
|
audioOutputPath,
|
|
9915
10033
|
isPngSequence,
|
|
9916
10034
|
isGif,
|
|
9917
|
-
preset,
|
|
9918
|
-
effectiveQuality,
|
|
9919
|
-
effectiveBitrate,
|
|
9920
10035
|
enableChunkedEncode,
|
|
9921
10036
|
chunkedEncodeSize,
|
|
9922
10037
|
abortSignal,
|
|
@@ -9946,7 +10061,7 @@ async function runEncodeStage(input) {
|
|
|
9946
10061
|
encoded();
|
|
9947
10062
|
return { encodeMs: Date.now() - stage5Start };
|
|
9948
10063
|
}
|
|
9949
|
-
const engineCfg = input
|
|
10064
|
+
const engineCfg = resolveEngineConfig(input);
|
|
9950
10065
|
if (isGif) {
|
|
9951
10066
|
const encoded = startEncodeProgress(job, "Encoding GIF", onProgress);
|
|
9952
10067
|
if (hasAudio) {
|
|
@@ -9976,24 +10091,7 @@ async function runEncodeStage(input) {
|
|
|
9976
10091
|
const videoEngineCfg = scaledEncodeTimeout > engineCfg.ffmpegEncodeTimeout ? { ...engineCfg, ffmpegEncodeTimeout: scaledEncodeTimeout } : engineCfg;
|
|
9977
10092
|
const frameExt = frameFileExtension(input.captureImageFormat);
|
|
9978
10093
|
const framePattern = `frame_%06d.${frameExt}`;
|
|
9979
|
-
const encoderOpts =
|
|
9980
|
-
fps: job.config.fps,
|
|
9981
|
-
width,
|
|
9982
|
-
height,
|
|
9983
|
-
codec: preset.codec,
|
|
9984
|
-
preset: preset.preset,
|
|
9985
|
-
quality: effectiveQuality,
|
|
9986
|
-
bitrate: effectiveBitrate,
|
|
9987
|
-
pixelFormat: preset.pixelFormat,
|
|
9988
|
-
vp9CpuUsed: engineCfg.vp9CpuUsed,
|
|
9989
|
-
useGpu: job.config.useGpu,
|
|
9990
|
-
hdr: preset.hdr,
|
|
9991
|
-
// Distributed chunk renders pass these so the encoder writes closed-GOP
|
|
9992
|
-
// keyframes that survive `-f concat -c copy` at assemble time. In-process
|
|
9993
|
-
// renders leave both undefined → preserves the existing open-GOP output.
|
|
9994
|
-
lockGopForChunkConcat: input.lockGopForChunkConcat === true,
|
|
9995
|
-
gopSize: input.gopSize
|
|
9996
|
-
};
|
|
10094
|
+
const encoderOpts = videoEncoderOptions(input, engineCfg);
|
|
9997
10095
|
const encodeResult = enableChunkedEncode ? await encodeFramesChunkedConcat(
|
|
9998
10096
|
framesDir,
|
|
9999
10097
|
framePattern,
|
|
@@ -12901,6 +12999,34 @@ async function executeRenderPipeline(input) {
|
|
|
12901
12999
|
throw new Error(`Disk capture requires sdr_disk plan; got ${capturePlan.kind}`);
|
|
12902
13000
|
}
|
|
12903
13001
|
resetCaptureAttemptProgress(job);
|
|
13002
|
+
const encodeInput = {
|
|
13003
|
+
job,
|
|
13004
|
+
log,
|
|
13005
|
+
outputPath: stagedOutputPath,
|
|
13006
|
+
framesDir,
|
|
13007
|
+
videoOnlyPath,
|
|
13008
|
+
width,
|
|
13009
|
+
height,
|
|
13010
|
+
needsAlpha,
|
|
13011
|
+
captureImageFormat: captureOptions.format ?? "jpeg",
|
|
13012
|
+
hasAudio,
|
|
13013
|
+
audioOutputPath,
|
|
13014
|
+
isPngSequence,
|
|
13015
|
+
isGif,
|
|
13016
|
+
preset,
|
|
13017
|
+
effectiveQuality,
|
|
13018
|
+
effectiveBitrate,
|
|
13019
|
+
enableChunkedEncode,
|
|
13020
|
+
chunkedEncodeSize,
|
|
13021
|
+
engineConfig: cfg,
|
|
13022
|
+
// Same value the streaming encoder above spreads — the disk and
|
|
13023
|
+
// chunked-concat encoders need an identical GOP lock for HLS.
|
|
13024
|
+
...hlsEncoderGopLock,
|
|
13025
|
+
abortSignal: executionSignal,
|
|
13026
|
+
assertNotAborted,
|
|
13027
|
+
onProgress
|
|
13028
|
+
};
|
|
13029
|
+
const overlap = !cfg.useDrawElement && workerSizing !== void 0 && canEncodeWhileCapturing(encodeInput, capturePlan.workerCount, workerSizing.cpuCount) ? encodeWhileCapturing(encodeInput, totalFrames) : null;
|
|
12904
13030
|
const captureFrameStart = Date.now();
|
|
12905
13031
|
const invokeDiskCapture = (diskPlan) => observeRenderStage(
|
|
12906
13032
|
observability,
|
|
@@ -12922,13 +13048,15 @@ async function executeRenderPipeline(input) {
|
|
|
12922
13048
|
createRenderVideoFrameInjector,
|
|
12923
13049
|
abortSignal: executionSignal,
|
|
12924
13050
|
assertNotAborted,
|
|
12925
|
-
onProgress
|
|
13051
|
+
onProgress,
|
|
13052
|
+
onFrameLanded: (frame) => overlap?.onFrameLanded(frame)
|
|
12926
13053
|
})
|
|
12927
13054
|
);
|
|
12928
13055
|
let captureRes;
|
|
12929
13056
|
try {
|
|
12930
13057
|
captureRes = await invokeDiskCapture(capturePlan);
|
|
12931
13058
|
} catch (err) {
|
|
13059
|
+
await overlap?.abort();
|
|
12932
13060
|
if (!isDrawElementVerificationError(err) && !isDrawElementCaptureError(err) || err instanceof RenderCancelledError || executionSignal?.aborted === true) {
|
|
12933
13061
|
throw err;
|
|
12934
13062
|
}
|
|
@@ -12997,33 +13125,7 @@ async function executeRenderPipeline(input) {
|
|
|
12997
13125
|
isGif,
|
|
12998
13126
|
chunkedEncode: enableChunkedEncode
|
|
12999
13127
|
}),
|
|
13000
|
-
() => runEncodeStage(
|
|
13001
|
-
job,
|
|
13002
|
-
log,
|
|
13003
|
-
outputPath: stagedOutputPath,
|
|
13004
|
-
framesDir,
|
|
13005
|
-
videoOnlyPath,
|
|
13006
|
-
width,
|
|
13007
|
-
height,
|
|
13008
|
-
needsAlpha,
|
|
13009
|
-
captureImageFormat: captureOptions.format ?? "jpeg",
|
|
13010
|
-
hasAudio,
|
|
13011
|
-
audioOutputPath,
|
|
13012
|
-
isPngSequence,
|
|
13013
|
-
isGif,
|
|
13014
|
-
preset,
|
|
13015
|
-
effectiveQuality,
|
|
13016
|
-
effectiveBitrate,
|
|
13017
|
-
enableChunkedEncode,
|
|
13018
|
-
chunkedEncodeSize,
|
|
13019
|
-
engineConfig: cfg,
|
|
13020
|
-
// Same value the streaming encoder above spreads — the disk and
|
|
13021
|
-
// chunked-concat encoders need an identical GOP lock for HLS.
|
|
13022
|
-
...hlsEncoderGopLock,
|
|
13023
|
-
abortSignal: executionSignal,
|
|
13024
|
-
assertNotAborted,
|
|
13025
|
-
onProgress
|
|
13026
|
-
})
|
|
13128
|
+
() => overlap ? overlap.finish() : runEncodeStage(encodeInput)
|
|
13027
13129
|
);
|
|
13028
13130
|
perfStages.encodeMs = encodeRes.encodeMs;
|
|
13029
13131
|
}
|
|
@@ -15361,7 +15463,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
15361
15463
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
15362
15464
|
if (probeResult.probeSession) {
|
|
15363
15465
|
try {
|
|
15364
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
15466
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-4UYM2K3S.js");
|
|
15365
15467
|
await closeCaptureSession2(probeResult.probeSession);
|
|
15366
15468
|
} catch (err) {
|
|
15367
15469
|
log.warn("[plan] probe session close failed", {
|
|
@@ -17024,7 +17126,7 @@ function startServer(options = {}) {
|
|
|
17024
17126
|
});
|
|
17025
17127
|
async function shutdown(signal) {
|
|
17026
17128
|
log.info(`Received ${signal}, shutting down`);
|
|
17027
|
-
const { drainBrowserPool } = await import("./src-
|
|
17129
|
+
const { drainBrowserPool } = await import("./src-4UYM2K3S.js");
|
|
17028
17130
|
await drainBrowserPool().catch(() => {
|
|
17029
17131
|
});
|
|
17030
17132
|
const handle = await Promise.race([
|
|
@@ -18266,6 +18368,12 @@ function validatePlanVideosForChunk(value) {
|
|
|
18266
18368
|
);
|
|
18267
18369
|
}
|
|
18268
18370
|
}
|
|
18371
|
+
var MIN_FRAMES_PER_CHUNK_BROWSER = 20;
|
|
18372
|
+
function resolveChunkCaptureWorkers(framesInChunk, machineSized, maxCaptureWorkers) {
|
|
18373
|
+
if (maxCaptureWorkers === void 0) return machineSized;
|
|
18374
|
+
const byFrames = Math.floor(framesInChunk / MIN_FRAMES_PER_CHUNK_BROWSER);
|
|
18375
|
+
return Math.max(machineSized, Math.floor(Math.min(maxCaptureWorkers, byFrames)));
|
|
18376
|
+
}
|
|
18269
18377
|
function resolveChunkFrameRange(slice, chunkIndex, frameRange) {
|
|
18270
18378
|
if (frameRange === void 0) return { startFrame: slice.startFrame, endFrame: slice.endFrame };
|
|
18271
18379
|
const { startFrame, endFrame } = frameRange;
|
|
@@ -18502,7 +18610,11 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
18502
18610
|
deferredVideos.filter((video) => remoteVideoIds.has(video.videoId))
|
|
18503
18611
|
)
|
|
18504
18612
|
});
|
|
18505
|
-
const chunkWorkerCount =
|
|
18613
|
+
const chunkWorkerCount = resolveChunkCaptureWorkers(
|
|
18614
|
+
framesInChunk,
|
|
18615
|
+
calculateOptimalWorkers(framesInChunk, void 0, cfg),
|
|
18616
|
+
options?.maxCaptureWorkers
|
|
18617
|
+
);
|
|
18506
18618
|
let session = null;
|
|
18507
18619
|
let outputKind;
|
|
18508
18620
|
let framesEncoded = 0;
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
splitElementInHtml,
|
|
20
20
|
unwrapElementsFromHtml,
|
|
21
21
|
wrapElementsInHtml
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ZRHO6YMM.js";
|
|
23
23
|
import {
|
|
24
24
|
MEDIA_LINK_ATTR,
|
|
25
25
|
relinkSplitHalves
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
scanProjectMediaCodecMap,
|
|
69
69
|
shouldPrewarmProxy,
|
|
70
70
|
waitForProxy
|
|
71
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-SN7KI5JA.js";
|
|
72
72
|
import {
|
|
73
73
|
STUDIO_MOTION_PATH,
|
|
74
74
|
createStudioMotionRenderBodyScript,
|
|
@@ -109,12 +109,12 @@ import {
|
|
|
109
109
|
motionPathPluginUrl,
|
|
110
110
|
parseFps,
|
|
111
111
|
parsePreviewProxyBox
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-J3QM7AHP.js";
|
|
113
113
|
import {
|
|
114
114
|
addScenePartsManifest,
|
|
115
115
|
ensureHfIds,
|
|
116
116
|
stampHfIdsInPlace
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-YALM6XN4.js";
|
|
118
118
|
import {
|
|
119
119
|
AFTER_FONTS_SCRIPT_TYPE,
|
|
120
120
|
RUNTIME_BOOTSTRAP_ATTR,
|
|
@@ -128,7 +128,7 @@ import {
|
|
|
128
128
|
resolveRateSpec,
|
|
129
129
|
sourceTimeAt,
|
|
130
130
|
stripEmbeddedRuntimeScripts
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-R2SQBPMH.js";
|
|
132
132
|
import {
|
|
133
133
|
HTML_ATTRIBUTE_ENTITIES,
|
|
134
134
|
MagicString,
|
|
@@ -306,7 +306,7 @@ function clearElementScreenshotIsolation() {
|
|
|
306
306
|
page.__hfThumbnailFaded = [];
|
|
307
307
|
}
|
|
308
308
|
|
|
309
|
-
// ../studio-server/dist/chunk-
|
|
309
|
+
// ../studio-server/dist/chunk-T5CGF7VZ.js
|
|
310
310
|
import { resolve } from "path";
|
|
311
311
|
function isAutoProxyEnabled(adapter) {
|
|
312
312
|
return adapter.autoProxy !== false;
|
|
@@ -5499,7 +5499,7 @@ async function prepareGsapMutationScript(c, res, firstMutation) {
|
|
|
5499
5499
|
let block = extractGsapScriptBlock(html);
|
|
5500
5500
|
if (!block && (firstMutation.type === "add" || firstMutation.type === "add-with-keyframes")) {
|
|
5501
5501
|
const compId = html.match(/data-composition-id="([^"]+)"/)?.[1] ?? "main";
|
|
5502
|
-
const { GSAP_CDN } = await import("./dist-
|
|
5502
|
+
const { GSAP_CDN } = await import("./dist-DYS24AMA.js");
|
|
5503
5503
|
const bootstrap = [
|
|
5504
5504
|
`<script src="${GSAP_CDN}"></script>`,
|
|
5505
5505
|
"<script>",
|
|
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
getMimeType,
|
|
9
9
|
injectMediaCodecMapIntoHtml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3QVMJ7GX.js";
|
|
11
11
|
import {
|
|
12
12
|
PROXY_VARIANT_CONFIG,
|
|
13
13
|
ProxyCapacityError,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
recordProxyRequest,
|
|
19
19
|
resolveProxy,
|
|
20
20
|
resolveProxyVariantRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-SN7KI5JA.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveAutoProxy
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PFYWVUHA.js";
|
|
25
25
|
import {
|
|
26
26
|
decodeWellFormedEscapes
|
|
27
27
|
} from "./chunk-BSQ7XANM.js";
|
|
@@ -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.184" : "0.0.0-dev";
|
|
10
|
+
var PRODUCER_VERSION = true ? "0.8.184" : "0.0.0-dev";
|
|
11
11
|
|
|
12
12
|
export {
|
|
13
13
|
VERSION,
|
|
@@ -10,12 +10,21 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// src/cloud/upload.ts
|
|
12
12
|
import { createHash } from "crypto";
|
|
13
|
+
import { createReadStream } from "fs";
|
|
14
|
+
import { request as httpRequest } from "http";
|
|
15
|
+
import { request as httpsRequest } from "https";
|
|
16
|
+
import { pipeline } from "stream/promises";
|
|
13
17
|
var COMPLETE_MAX_RETRIES = 5;
|
|
14
18
|
var COMPLETE_RETRY_BASE_MS = 500;
|
|
15
19
|
var CONTENT_TYPE_ZIP = "application/zip";
|
|
16
20
|
function sha256Hex(bytes) {
|
|
17
21
|
return createHash("sha256").update(bytes).digest("hex");
|
|
18
22
|
}
|
|
23
|
+
async function sha256OfFile(path) {
|
|
24
|
+
const hash = createHash("sha256");
|
|
25
|
+
for await (const chunk of createReadStream(path)) hash.update(chunk);
|
|
26
|
+
return hash.digest("hex");
|
|
27
|
+
}
|
|
19
28
|
function sleep(ms) {
|
|
20
29
|
return new Promise((r) => setTimeout(r, ms));
|
|
21
30
|
}
|
|
@@ -27,15 +36,16 @@ function normalizeUploadHeaders(raw) {
|
|
|
27
36
|
}
|
|
28
37
|
return out;
|
|
29
38
|
}
|
|
30
|
-
async function putBytesToPresignedUrl(fetchImpl, uploadUrl, uploadHeaders,
|
|
39
|
+
async function putBytesToPresignedUrl(fetchImpl, uploadUrl, uploadHeaders, body, contentType) {
|
|
31
40
|
const headers = {
|
|
32
41
|
"content-type": contentType,
|
|
33
42
|
...normalizeUploadHeaders(uploadHeaders)
|
|
34
43
|
};
|
|
44
|
+
if (!(body instanceof Uint8Array)) return putFileToPresignedUrl(uploadUrl, headers, body);
|
|
35
45
|
const res = await fetchImpl(uploadUrl, {
|
|
36
46
|
method: "PUT",
|
|
37
47
|
headers,
|
|
38
|
-
body
|
|
48
|
+
body
|
|
39
49
|
});
|
|
40
50
|
if (!res.ok) {
|
|
41
51
|
const detail = await res.text().catch(() => "");
|
|
@@ -44,6 +54,36 @@ async function putBytesToPresignedUrl(fetchImpl, uploadUrl, uploadHeaders, bytes
|
|
|
44
54
|
);
|
|
45
55
|
}
|
|
46
56
|
}
|
|
57
|
+
async function putFileToPresignedUrl(uploadUrl, headers, file) {
|
|
58
|
+
const send = new URL(uploadUrl).protocol === "https:" ? httpsRequest : httpRequest;
|
|
59
|
+
const req = send(uploadUrl, {
|
|
60
|
+
method: "PUT",
|
|
61
|
+
headers: { ...headers, "content-length": String(file.size) }
|
|
62
|
+
});
|
|
63
|
+
const response = new Promise((resolve, reject) => {
|
|
64
|
+
req.once("response", resolve).once("error", reject);
|
|
65
|
+
});
|
|
66
|
+
const sent = pipeline(createReadStream(file.path), req);
|
|
67
|
+
let res;
|
|
68
|
+
try {
|
|
69
|
+
res = await response;
|
|
70
|
+
} catch (err) {
|
|
71
|
+
await sent.catch(() => void 0);
|
|
72
|
+
throw err;
|
|
73
|
+
}
|
|
74
|
+
const status = res.statusCode ?? 0;
|
|
75
|
+
const ok = status >= 200 && status < 300;
|
|
76
|
+
await sent.catch((err) => {
|
|
77
|
+
if (ok) throw err;
|
|
78
|
+
});
|
|
79
|
+
let detail = "";
|
|
80
|
+
for await (const chunk of res) detail += String(chunk);
|
|
81
|
+
if (!ok) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Direct upload PUT failed: ${status} ${res.statusMessage ?? ""}${detail ? ` \u2014 ${detail.slice(0, 300)}` : ""}`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
47
87
|
async function completeWithRetry(client, asset_id, checksum_sha256) {
|
|
48
88
|
let lastErr;
|
|
49
89
|
for (let attempt = 0; attempt < COMPLETE_MAX_RETRIES; attempt++) {
|
|
@@ -65,9 +105,10 @@ async function completeWithRetry(client, asset_id, checksum_sha256) {
|
|
|
65
105
|
}
|
|
66
106
|
async function uploadAssetViaDirectUpload(opts) {
|
|
67
107
|
const start = Date.now();
|
|
68
|
-
const {
|
|
69
|
-
const
|
|
70
|
-
const
|
|
108
|
+
const { filename, idempotencyKey } = opts;
|
|
109
|
+
const body = "bytes" in opts ? opts.bytes : { path: opts.path, size: opts.size };
|
|
110
|
+
const size_bytes = body instanceof Uint8Array ? body.byteLength : body.size;
|
|
111
|
+
const checksum_sha256 = body instanceof Uint8Array ? sha256Hex(body) : await sha256OfFile(body.path);
|
|
71
112
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
72
113
|
opts.onProgress?.({ phase: "initialize" });
|
|
73
114
|
const initialize = await opts.client.createAssetUpload({
|
|
@@ -79,7 +120,7 @@ async function uploadAssetViaDirectUpload(opts) {
|
|
|
79
120
|
fetchImpl,
|
|
80
121
|
initialize.upload_url,
|
|
81
122
|
initialize.upload_headers,
|
|
82
|
-
|
|
123
|
+
body,
|
|
83
124
|
opts.contentType
|
|
84
125
|
);
|
|
85
126
|
opts.onProgress?.({ phase: "upload", percent: 100 });
|
|
@@ -87,6 +128,7 @@ async function uploadAssetViaDirectUpload(opts) {
|
|
|
87
128
|
const completed = await completeWithRetry(opts.client, initialize.asset_id, checksum_sha256);
|
|
88
129
|
return {
|
|
89
130
|
asset_id: completed.asset_id,
|
|
131
|
+
url: completed.url,
|
|
90
132
|
size_bytes,
|
|
91
133
|
duration_ms: Date.now() - start
|
|
92
134
|
};
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
shouldTrack
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-UKOTVJFV.js";
|
|
10
10
|
|
|
11
11
|
// src/telemetry/renderObservability.ts
|
|
12
12
|
function renderObservabilityTelemetryPayload(observability) {
|
|
@@ -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-4N4P3ZWL.js";
|
|
10
10
|
|
|
11
11
|
// src/registry/compatibility.ts
|
|
12
12
|
import { compareVersions } from "compare-versions";
|