hyperframes 0.8.186 → 0.8.189
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-UGK7AZI6.js → add-TIKUM2YX.js} +12 -12
- package/dist/{animatedGifPrep-HPZPSB43.js → animatedGifPrep-25X4G5IE.js} +7 -7
- package/dist/api.js +15 -15
- package/dist/{asset-X2GTFWOY.js → asset-TPKLIP4R.js} +2 -2
- package/dist/{assetCataloger-5NWEG4IU.js → assetCataloger-PQAIV3FI.js} +7 -7
- package/dist/{audio-7PBM5F3H.js → audio-6RLPKB5X.js} +15 -15
- package/dist/{auth-WABSMO46.js → auth-O7QSTP6Y.js} +1 -1
- package/dist/{autoUpdate-6SCMLTSC.js → autoUpdate-TIEJODP7.js} +2 -2
- package/dist/{backgroundChecks-XOGPAAR3.js → backgroundChecks-K2AXYDYG.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-VR6IA77K.js → batchRender-ORVWYJAH.js} +4 -4
- package/dist/{beats-3IWXLMSC.js → beats-2VTB2ATR.js} +4 -4
- package/dist/{benchmark-2SSYATCX.js → benchmark-NLNBL6YR.js} +9 -9
- package/dist/{browser-PMRN345D.js → browser-M5UV6VJB.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-TT32MZBO.js → bundleWithLocalizedFonts-EDD2XDS2.js} +2 -2
- package/dist/{capture-4VD6AKUJ.js → capture-JSYVNFKO.js} +10 -10
- package/dist/{capture-BDGYTE57.js → capture-WHWEE5FE.js} +2 -2
- package/dist/{captureCompositionFrame-5FVLAETA.js → captureCompositionFrame-JANGQCIA.js} +13 -13
- package/dist/{catalog-HUYZO5D7.js → catalog-MPOOKNSZ.js} +12 -12
- package/dist/{catch-up-SSGTR2ZT.js → catch-up-6KZV3UMZ.js} +4 -4
- package/dist/{check-JWUWHGM2.js → check-G273NWK7.js} +37 -36
- package/dist/{checkBrowser-X7G6YNR7.js → checkBrowser-G53E2ZQI.js} +32 -33
- package/dist/{chunk-WHMFW5ET.js → chunk-2CYM34M7.js} +3 -3
- package/dist/{chunk-HZ7M2MZA.js → chunk-37EPEFXM.js} +1 -1
- package/dist/{chunk-4XFFJAWS.js → chunk-3OLOVRWS.js} +1 -1
- package/dist/{chunk-ZIRIDSDB.js → chunk-3X6LH25W.js} +1 -1
- package/dist/{chunk-TH7J3JZ5.js → chunk-44TJOEH5.js} +92 -25
- package/dist/{chunk-K6KBOORN.js → chunk-4DZ3HBKF.js} +2 -2
- package/dist/{chunk-U7QTMRLW.js → chunk-4QFKGRTB.js} +2 -2
- package/dist/{chunk-7MVODWQF.js → chunk-5544QB3U.js} +1 -1
- package/dist/{chunk-7AUMTARQ.js → chunk-565X6Q4X.js} +3 -3
- package/dist/{chunk-J36JVBLR.js → chunk-5C7R55BJ.js} +1 -1
- package/dist/{chunk-YRAJDFIN.js → chunk-5HJJEHGE.js} +1 -1
- package/dist/{chunk-5UBZPG74.js → chunk-6A45RKAK.js} +1 -1
- package/dist/{chunk-ROWEDRVX.js → chunk-6RA4TWGV.js} +1 -1
- package/dist/{chunk-3YHGQJI6.js → chunk-74Y43RJZ.js} +3 -3
- package/dist/{chunk-4AFNEKU7.js → chunk-ANYBRVPF.js} +1 -1
- package/dist/{chunk-R6IGQ5NO.js → chunk-AQ3L7DVB.js} +2 -2
- package/dist/{chunk-LDW3KVGK.js → chunk-ASZ4IQB4.js} +2 -2
- package/dist/{chunk-DQZMJS2P.js → chunk-AYBKDHYD.js} +2 -2
- package/dist/{chunk-RVZNSKRH.js → chunk-B52BJM5K.js} +2 -2
- package/dist/{chunk-GTMBII7X.js → chunk-B634ZCY2.js} +1 -1
- package/dist/chunk-BPX7LZG6.js +3896 -0
- package/dist/{chunk-5ZMIVTHN.js → chunk-BZQLTNMB.js} +219 -79
- package/dist/{chunk-MY6CVBDD.js → chunk-CE7EQUBV.js} +1 -1
- package/dist/{chunk-ZVBEGBII.js → chunk-CSYSEPWL.js} +31 -7
- package/dist/{chunk-EZINX6HH.js → chunk-CTF7BYCV.js} +3 -3
- package/dist/{chunk-2II34JPM.js → chunk-E676Y7AY.js} +82 -29
- package/dist/{chunk-YQICCAVA.js → chunk-E7TI5PAQ.js} +1 -1
- package/dist/{chunk-TTVHYD5R.js → chunk-EI7FP7F3.js} +1 -1
- package/dist/{chunk-UJZT6HNN.js → chunk-F45HHA3M.js} +1 -1
- package/dist/{chunk-TQ2RRB5V.js → chunk-FJF5JBYU.js} +1 -1
- package/dist/{chunk-Z5233OAN.js → chunk-GBT7P3OQ.js} +5 -5
- package/dist/{chunk-NPDPDEPP.js → chunk-GWYMAII7.js} +1 -1
- package/dist/{chunk-UAJCTEK2.js → chunk-HNMDLKA4.js} +1 -1
- package/dist/{chunk-FCWFV4P7.js → chunk-HQIFMCQN.js} +2278 -2273
- package/dist/{chunk-DTXDQ6OP.js → chunk-HUG47UEE.js} +1 -1
- package/dist/{chunk-7M7TMM4S.js → chunk-HXM2ISEK.js} +264 -124
- package/dist/{chunk-WLHNIIXU.js → chunk-IFXOMIBP.js} +3 -3
- package/dist/{chunk-77QM6YRQ.js → chunk-IPEP346Y.js} +1 -1
- package/dist/{chunk-22QKQDEE.js → chunk-JIPUWKLA.js} +14 -14
- package/dist/{chunk-YNH6ERDL.js → chunk-JZDVIDFH.js} +2 -2
- package/dist/{chunk-KNLSYCI5.js → chunk-KLWUB37U.js} +7 -7
- package/dist/{chunk-PEIV2SOG.js → chunk-KS4HMJJD.js} +1 -1
- package/dist/{chunk-4NTW45W5.js → chunk-M6FHSQZ3.js} +3 -3
- package/dist/{chunk-RFJ6SX4U.js → chunk-NDBWI7OA.js} +5 -5
- package/dist/{chunk-ACLABKEF.js → chunk-NSJ5HD6A.js} +5 -5
- package/dist/{chunk-FRLTKTOR.js → chunk-OHXHBMF4.js} +1 -1
- package/dist/{chunk-7MLFYMFB.js → chunk-QMFI4N7J.js} +1 -1
- package/dist/{chunk-HOFX63F2.js → chunk-QYQ2EYOI.js} +3 -3
- package/dist/{chunk-27H2363S.js → chunk-R5FS7GFU.js} +1 -1
- package/dist/{chunk-PFD25NAC.js → chunk-RIJHDTM5.js} +4 -0
- package/dist/{chunk-FH7WODJH.js → chunk-SGFMCNLY.js} +8 -0
- package/dist/{chunk-BRTDLVK3.js → chunk-SMF6YAUL.js} +9 -11
- package/dist/{chunk-6IOBAOU7.js → chunk-T37XXYRK.js} +1 -1
- package/dist/{chunk-T4RP55P2.js → chunk-TFUAKV6O.js} +1 -1
- package/dist/{chunk-U6RXZNZE.js → chunk-TMBUBLZB.js} +55 -23
- package/dist/{chunk-5ZMXGNGC.js → chunk-TPTQHOXU.js} +9 -9
- package/dist/{chunk-U4BMRIE6.js → chunk-TREMHDWT.js} +12 -10
- package/dist/{chunk-Q447CX26.js → chunk-TSFA2Y5C.js} +60 -47
- package/dist/{chunk-Y2M6XSNK.js → chunk-VRQU564T.js} +1 -1
- package/dist/{chunk-ID5AJ4L3.js → chunk-WMJJCHVQ.js} +2 -2
- package/dist/{chunk-RNZEQTWZ.js → chunk-WYCFMNU3.js} +15 -2
- package/dist/{chunk-UJKQWGFF.js → chunk-X7HBSTCZ.js} +8 -0
- package/dist/{chunk-ZKBW7NU2.js → chunk-XJVXROOL.js} +2 -2
- package/dist/{chunk-CML25PAF.js → chunk-XNFDDVJS.js} +27 -3
- package/dist/{chunk-RPUIMFHF.js → chunk-Z2BW2WJS.js} +1 -1
- package/dist/{chunk-2PZZMAME.js → chunk-ZPMF6GAQ.js} +17 -12
- package/dist/{clean-IM2JIAUT.js → clean-PS4VYGQ6.js} +17 -17
- package/dist/cli.js +53 -53
- package/dist/{cloud-6IPBCJSX.js → cloud-E47CE5VQ.js} +4 -4
- package/dist/{cloudrun-MWZ6S2I2.js → cloudrun-3J4SQBXE.js} +5 -5
- package/dist/{compare-WD7A2TV5.js → compare-EAKHXBDO.js} +29 -29
- package/dist/{compiler-2EKSMC3I.js → compiler-23MT6CX6.js} +4 -4
- package/dist/{component-JKALWH36.js → component-QBOXYJJS.js} +3 -3
- package/dist/{compositions-643NAG4A.js → compositions-QC3EO3MJ.js} +11 -11
- package/dist/{delete-EASPXKHQ.js → delete-TXEOLPC6.js} +4 -4
- package/dist/deploy-3B3WJ6PM.js +300 -0
- package/dist/{destroy-4B5HW5FH.js → destroy-SSPAKADI.js} +13 -3
- package/dist/{dist-F6FOKRSU.js → dist-F4UJFK4S.js} +5 -3
- package/dist/{dist-LM7AVHOU.js → dist-JH32CBQL.js} +1 -1
- package/dist/{doctor-7XUVYDJQ.js → doctor-2CRFH4B3.js} +11 -11
- package/dist/{events-TULV6D3G.js → events-GUIOSBIB.js} +3 -3
- package/dist/{events-5TTPYBKG.js → events-KVTX3QFV.js} +2 -2
- package/dist/{feedback-4FTPWM6P.js → feedback-VQIOSTIB.js} +7 -7
- package/dist/{ffmpeg-MP7ZVYLZ.js → ffmpeg-BPCZGXFW.js} +7 -7
- package/dist/{figma-B7LFWYKO.js → figma-QIOKCH26.js} +3 -3
- package/dist/fontLocalizeCli.js +9 -9
- package/dist/{get-F7W4AQ2V.js → get-TU45SNXF.js} +4 -4
- package/dist/{gpuPolicy-NSNVDFXC.js → gpuPolicy-AWAJBGYY.js} +7 -7
- package/dist/{grade-compare-6QXDTLS2.js → grade-compare-LDNUXX3Q.js} +30 -30
- package/dist/{help-RJAA4O74.js → help-YUCHJKKL.js} +1 -1
- package/dist/{history-OOQBDVV5.js → history-MMHFUMIG.js} +7 -7
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +65 -64
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-5OGGYYLO.js → info-HBHOFSC2.js} +8 -8
- package/dist/{init-DM3TJKW2.js → init-3E4GUXIZ.js} +27 -27
- package/dist/{inspect-FECQCLS5.js → inspect-YNUPJVIH.js} +30 -30
- package/dist/{installer-WOG4VORV.js → installer-WLCRP33K.js} +5 -5
- package/dist/{keyframes-SZHWUF5Y.js → keyframes-Z47GHCGO.js} +6 -6
- package/dist/{lambda-JG2ZRGMC.js → lambda-CA4PEUO2.js} +20 -13
- package/dist/{layout-7ACF7ZKC.js → layout-YPV6PIKF.js} +30 -30
- package/dist/{lint-ZCQGMILV.js → lint-3AVVQ74A.js} +7 -7
- package/dist/{lintProject-JATQKR64.js → lintProject-XM3DLUKG.js} +1 -1
- package/dist/{list-MH2X3Y2T.js → list-JH52Y735.js} +7 -7
- package/dist/{login-CK46WX5U.js → login-G7NPJUAW.js} +4 -4
- package/dist/{manager-GXTPNJVW.js → manager-2LSMMZY4.js} +8 -8
- package/dist/{media-treatment-EH2AT34Z.js → media-treatment-BVMMD5EN.js} +13 -13
- package/dist/{models-D5XP2UK6.js → models-P3TNRVRV.js} +11 -11
- package/dist/{motionShot-UR7D3SRQ.js → motionShot-LK62QHNE.js} +18 -18
- package/dist/{normalize-audio-635JOR5W.js → normalize-audio-Y7BAQ7AR.js} +6 -6
- package/dist/{open-6WE5WFVM.js → open-CCFFLAT7.js} +12 -12
- package/dist/{parakeetRunner-STHZPG32.js → parakeetRunner-N2BWSOSD.js} +12 -12
- package/dist/{pipeline-LVEKRETU.js → pipeline-3VT2DQGU.js} +8 -8
- package/dist/{play-W6TDW4FE.js → play-G4I5IFHO.js} +20 -20
- package/dist/{policies-XXNGXWHV.js → policies-MBWGLMWB.js} +17 -0
- package/dist/{preflight-LIMQXLR7.js → preflight-2KU2QLCZ.js} +8 -8
- package/dist/{present-RX5QX6UR.js → present-EJ7XHGQO.js} +16 -16
- package/dist/{preview-KIWTWK63.js → preview-O23BYFAY.js} +18 -18
- package/dist/{producer-TSNKSCUM.js → producer-UJQVLKLP.js} +1 -1
- package/dist/{progress-NHJIHAAG.js → progress-PX3PVAIM.js} +5 -3
- package/dist/{projectConfig-NCP7JRH4.js → projectConfig-QFVIBT37.js} +7 -7
- package/dist/{publication-5W5UZWGC.js → publication-4UYGFB2X.js} +3 -3
- package/dist/{publish-7WR4XJ6I.js → publish-MHLVJLCR.js} +9 -9
- package/dist/{remove-background-43JGBRWQ.js → remove-background-N7AHTZWP.js} +9 -9
- package/dist/{render-7T44HIM6.js → render-6HQV4LZJ.js} +11 -9
- package/dist/{render-WHMLYIOI.js → render-CDATEVDJ.js} +31 -22
- package/dist/{render-456HCO6O.js → render-EI2ODKOP.js} +45 -29
- package/dist/{render-batch-LURBJTBV.js → render-batch-F7HMC7XH.js} +7 -7
- package/dist/renderSetupWorker.js +1 -1
- package/dist/{resolver-MBIW4VC4.js → resolver-63DB5JCY.js} +5 -5
- package/dist/{sam-MC24SZHC.js → sam-FHJ7IL7T.js} +3 -1
- package/dist/{sherpa-5J2AALED.js → sherpa-AK3MTPL3.js} +11 -11
- package/dist/{sites-MAVH57MO.js → sites-5PWHAMEG.js} +1 -1
- package/dist/skills/hyperframes/references/motion.md +1 -0
- package/dist/{skills-UHOXOGGF.js → skills-EVIDL7PV.js} +5 -5
- package/dist/{skillsUpdateCheck-PDZIFUJE.js → skillsUpdateCheck-YCNJYDJO.js} +3 -3
- package/dist/{snapshot-PFV7ALLH.js → snapshot-WSYZKR3C.js} +35 -35
- package/dist/{src-XK5YIR6L.js → src-KTD6WTEV.js} +8 -8
- package/dist/{src-DCVSEODX.js → src-YNXBU4ZQ.js} +12 -6
- package/dist/{state-ORRPOLMQ.js → state-JPNCCXAV.js} +3 -1
- package/dist/{staticProjectServer-4IE4G4JO.js → staticProjectServer-D2D3BKBP.js} +18 -16
- package/dist/studio/assets/{hyperframes-player-B_skzvYC.js → hyperframes-player-CkK8Zijf.js} +1 -1
- package/dist/studio/assets/{index-CgLbvCUo.js → index-ATnRoBug.js} +1 -1
- package/dist/studio/assets/{index-Dn5FAk2e.js → index-B2JcCaRF.js} +130 -130
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-JMWYU7KF.js → studio-api-3ZGQPE5J.js} +10 -10
- package/dist/{studioServer-BWLSTGIG.js → studioServer-VWM4J7ZP.js} +48 -48
- package/dist/{telemetry-JCU3AV7W.js → telemetry-BEVI64BB.js} +3 -3
- package/dist/templates/_shared/AGENTS.md +5 -0
- package/dist/templates/_shared/CLAUDE.md +5 -0
- package/dist/{timeline-BCIFQYOM.js → timeline-P57FUXJQ.js} +18 -18
- package/dist/{tokens-7IXKALMQ.js → tokens-OUQY6LPD.js} +2 -2
- package/dist/{transcribe-ZUQD3B32.js → transcribe-CK66VIU4.js} +10 -10
- package/dist/{transcribe-HW7HGJ4V.js → transcribe-QUPX67KC.js} +16 -16
- package/dist/{updateCheck-Z6LNEK7B.js → updateCheck-XZ43CH3L.js} +2 -2
- package/dist/{upgrade-JYH72JGL.js → upgrade-7QQNGI7I.js} +2 -2
- package/dist/{urlDownloader-WKLFHSUH.js → urlDownloader-ESAEL6YX.js} +6 -6
- package/dist/{validate-QCC27YYI.js → validate-5GZ6KFRU.js} +24 -24
- package/dist/{video-EZ7ONY6L.js → video-AQNVR6PE.js} +7 -7
- package/dist/warmCheck.js +37 -38
- package/package.json +18 -2
- package/dist/chunk-KANNRHY7.js +0 -53
- package/dist/chunk-UOZX5W5T.js +0 -3852
- package/dist/deploy-CDKCQ5MX.js +0 -196
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
formatPreviewProxyBox,
|
|
14
14
|
hdrToSdrToneMapFilter,
|
|
15
15
|
parseFirstFrameColour
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WYCFMNU3.js";
|
|
17
17
|
import {
|
|
18
18
|
decodeAuthoredAttribute,
|
|
19
19
|
scanHtmlOpeningTags
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
rewriteAssetPath
|
|
37
37
|
} from "./chunk-BSQ7XANM.js";
|
|
38
38
|
|
|
39
|
-
// ../studio-server/dist/chunk-
|
|
39
|
+
// ../studio-server/dist/chunk-XMNHDWQI.js
|
|
40
40
|
import { statSync } from "fs";
|
|
41
41
|
import { sep } from "path";
|
|
42
42
|
import { execFile } from "child_process";
|
|
@@ -139,7 +139,7 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
|
|
|
139
139
|
"-v",
|
|
140
140
|
"error",
|
|
141
141
|
"-show_entries",
|
|
142
|
-
"stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode",
|
|
142
|
+
"stream=codec_type,codec_name,profile,pix_fmt,color_space,color_transfer,color_primaries,bits_per_raw_sample:stream_disposition=attached_pic:stream_tags=alpha_mode:format=duration",
|
|
143
143
|
"-of",
|
|
144
144
|
"json",
|
|
145
145
|
"--",
|
|
@@ -163,6 +163,8 @@ async function probeMediaMetadata(filePath, runner = execFileRunner) {
|
|
|
163
163
|
if (kind === "video") {
|
|
164
164
|
metadata.hasAudio = (parsed.streams ?? []).some((item) => item.codec_type === "audio");
|
|
165
165
|
metadata.hasAlpha = stream !== void 0 && videoStreamHasAlpha(stream);
|
|
166
|
+
const duration = Number(parsed.format?.duration);
|
|
167
|
+
if (Number.isFinite(duration) && duration > 0) metadata.durationSeconds = duration;
|
|
166
168
|
}
|
|
167
169
|
return metadata;
|
|
168
170
|
} catch {
|
|
@@ -338,13 +340,23 @@ async function scanProjectMediaCodecMap(projectDir, htmlSources, options = {}) {
|
|
|
338
340
|
return map;
|
|
339
341
|
}
|
|
340
342
|
|
|
341
|
-
// ../studio-server/dist/chunk-
|
|
343
|
+
// ../studio-server/dist/chunk-N2HH4SGD.js
|
|
342
344
|
import { spawn } from "child_process";
|
|
343
345
|
import { createHash, randomUUID } from "crypto";
|
|
344
|
-
import {
|
|
345
|
-
|
|
346
|
+
import {
|
|
347
|
+
existsSync as existsSync2,
|
|
348
|
+
mkdtempSync,
|
|
349
|
+
renameSync,
|
|
350
|
+
rmSync,
|
|
351
|
+
statSync as statSync2,
|
|
352
|
+
unlinkSync as unlinkSync2,
|
|
353
|
+
utimesSync,
|
|
354
|
+
writeFileSync
|
|
355
|
+
} from "fs";
|
|
356
|
+
import { tmpdir } from "os";
|
|
357
|
+
import { basename, dirname, extname as extname2, isAbsolute, join as join2, relative, resolve, sep as sep2 } from "path";
|
|
346
358
|
import { existsSync, readdirSync, statSync as statSync3, unlinkSync } from "fs";
|
|
347
|
-
import { extname as
|
|
359
|
+
import { extname as extname3, join } from "path";
|
|
348
360
|
var DEFAULT_MAX_BYTES = 10 * 1024 * 1024 * 1024;
|
|
349
361
|
var DEFAULT_STALE_TEMP_MS = 60 * 60 * 1e3;
|
|
350
362
|
var DEFAULT_MIN_SWEEP_INTERVAL_MS = 5 * 60 * 1e3;
|
|
@@ -352,7 +364,9 @@ var PROXY_EXTENSIONS = new Set(
|
|
|
352
364
|
Object.values(PROXY_VARIANT_CONFIG).map(({ extension }) => extension)
|
|
353
365
|
);
|
|
354
366
|
var TRANSCODER_PROXY_NAME = /^[0-9a-f]{64}\.\w+$/;
|
|
355
|
-
var TRANSCODER_TEMP_NAME = /^\.tmp-[0-9a-f-]{36}-[0-9a-f]{64}\.\w+$/;
|
|
367
|
+
var TRANSCODER_TEMP_NAME = /^\.tmp-[0-9a-f-]{36}-(?:\.part-[0-9a-f]{64}-\d+|[0-9a-f]{64})\.\w+$/;
|
|
368
|
+
var TRANSCODER_PIECE_NAME = /^\.part-([0-9a-f]{64})-\d+(\.\w+)$/;
|
|
369
|
+
var STALE_PIECE_MS = 60 * 60 * 1e3;
|
|
356
370
|
var lastSweepAt = /* @__PURE__ */ new Map();
|
|
357
371
|
function positiveEnvNumber(name, fallback) {
|
|
358
372
|
const parsed = Number(process.env[name]);
|
|
@@ -375,6 +389,15 @@ function shouldSkipSweep(cacheDir, now, minSweepIntervalMs) {
|
|
|
375
389
|
lastSweepAt.set(cacheDir, now);
|
|
376
390
|
return false;
|
|
377
391
|
}
|
|
392
|
+
function isLeftoverName(name) {
|
|
393
|
+
return TRANSCODER_TEMP_NAME.test(name) || TRANSCODER_PIECE_NAME.test(name);
|
|
394
|
+
}
|
|
395
|
+
function leftoverIsDead(cacheDir, name, modifiedAt, protectedPaths, now, staleTempMs) {
|
|
396
|
+
const piece = TRANSCODER_PIECE_NAME.exec(name);
|
|
397
|
+
if (!piece) return now - modifiedAt >= staleTempMs;
|
|
398
|
+
const copyIsRunning = protectedPaths.has(join(cacheDir, `${piece[1]}${piece[2]}`));
|
|
399
|
+
return !copyIsRunning && now - modifiedAt >= STALE_PIECE_MS;
|
|
400
|
+
}
|
|
378
401
|
function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
|
|
379
402
|
const entries = [];
|
|
380
403
|
const staleTemps = [];
|
|
@@ -388,9 +411,11 @@ function readCacheInventory(cacheDir, protectedPaths, now, staleTempMs) {
|
|
|
388
411
|
modifiedAt: stat.mtimeMs,
|
|
389
412
|
protected: protectedPaths.has(path)
|
|
390
413
|
};
|
|
391
|
-
if (
|
|
392
|
-
if (
|
|
393
|
-
|
|
414
|
+
if (isLeftoverName(dirent.name)) {
|
|
415
|
+
if (leftoverIsDead(cacheDir, dirent.name, stat.mtimeMs, protectedPaths, now, staleTempMs)) {
|
|
416
|
+
staleTemps.push(entry);
|
|
417
|
+
}
|
|
418
|
+
} else if (TRANSCODER_PROXY_NAME.test(dirent.name) && PROXY_EXTENSIONS.has(extname3(dirent.name))) {
|
|
394
419
|
entries.push(entry);
|
|
395
420
|
}
|
|
396
421
|
}
|
|
@@ -452,11 +477,15 @@ var MAX_CONCURRENT_TRANSCODES = boundedEnvInteger("HYPERFRAMES_PROXY_MAX_CONCURR
|
|
|
452
477
|
var MAX_QUEUED_TRANSCODES = boundedEnvInteger("HYPERFRAMES_PROXY_MAX_QUEUE", 8, 0, 256);
|
|
453
478
|
var STDERR_TAIL_MAX_CHARS = 4e3;
|
|
454
479
|
var TRANSCODE_TIMEOUT_MS = 15 * 60 * 1e3;
|
|
480
|
+
var PROXY_CHUNK_SECONDS = 60;
|
|
481
|
+
var CHUNK_PREFIX = ".part-";
|
|
482
|
+
var CONCAT_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
455
483
|
var FAILURE_CACHE_TTL_MS = 60 * 1e3;
|
|
456
484
|
var PROXY_PENDING_RETRY_AFTER_SECONDS = 2;
|
|
457
485
|
var ENVIRONMENT_FAILURE_TTL_MS = 5 * PROXY_PENDING_RETRY_AFTER_SECONDS * 1e3;
|
|
458
486
|
var MAX_FAILURE_CACHE_ENTRIES = 128;
|
|
459
487
|
var DEFAULT_PROXY_WAIT_TIMEOUT_MS = 2 * 60 * 1e3;
|
|
488
|
+
var UNTOUCHED_TEMP_IS_DEAD_MS = 10 * 60 * 1e3;
|
|
460
489
|
var ProxyTranscodeError = class extends Error {
|
|
461
490
|
exitCode;
|
|
462
491
|
stderrTail;
|
|
@@ -624,9 +653,9 @@ var inFlight = /* @__PURE__ */ new Map();
|
|
|
624
653
|
function forget(job) {
|
|
625
654
|
if (inFlight.get(job.cachePath)?.job === job) inFlight.delete(job.cachePath);
|
|
626
655
|
}
|
|
627
|
-
function maintainProxyCache(cacheDir) {
|
|
656
|
+
function maintainProxyCache(cacheDir, staleTempMs) {
|
|
628
657
|
try {
|
|
629
|
-
cleanupProxyCache(cacheDir, { protectedPaths: new Set(inFlight.keys()) });
|
|
658
|
+
cleanupProxyCache(cacheDir, { protectedPaths: new Set(inFlight.keys()), staleTempMs });
|
|
630
659
|
} catch (error) {
|
|
631
660
|
console.warn(
|
|
632
661
|
`[media-proxy] cache cleanup failed: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -688,83 +717,173 @@ function stderrReason(stderrTail) {
|
|
|
688
717
|
const line = errorLines.at(-1) ?? lines.at(-1);
|
|
689
718
|
return line ? `: ${line.replace(/[.!]+$/, "")}` : "";
|
|
690
719
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
|
|
695
|
-
|
|
720
|
+
function chunkRanges(durationSeconds) {
|
|
721
|
+
if (!durationSeconds || durationSeconds <= PROXY_CHUNK_SECONDS * 1.5) return null;
|
|
722
|
+
const count = Math.floor(durationSeconds / PROXY_CHUNK_SECONDS);
|
|
723
|
+
return Array.from({ length: count }, (_, index) => ({
|
|
724
|
+
startSeconds: index * PROXY_CHUNK_SECONDS,
|
|
725
|
+
lengthSeconds: index === count - 1 ? durationSeconds - index * PROXY_CHUNK_SECONDS : PROXY_CHUNK_SECONDS
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
728
|
+
function ffmpegBudgetError(chunksKept, chunkCount) {
|
|
729
|
+
return new ProxyTranscodeError(
|
|
730
|
+
`ffmpeg ran out of its ${TRANSCODE_TIMEOUT_MS}ms budget with ${chunksKept}/${chunkCount} pieces done; the finished pieces are kept and the next attempt continues from them`,
|
|
731
|
+
null,
|
|
732
|
+
""
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
async function encodeInChunks(ranges, chunkPrefix, tempPath, encode, concat) {
|
|
736
|
+
const extension = extname2(tempPath);
|
|
737
|
+
const deadline = Date.now() + TRANSCODE_TIMEOUT_MS;
|
|
738
|
+
const pieces = ranges.map((_, index) => `${chunkPrefix}${index}${extension}`);
|
|
739
|
+
for (const [index, range] of ranges.entries()) {
|
|
740
|
+
const piece = pieces[index];
|
|
741
|
+
if (existsSync2(piece)) continue;
|
|
742
|
+
const timeoutMs = deadline - Date.now();
|
|
743
|
+
if (timeoutMs <= 0) throw ffmpegBudgetError(index, ranges.length);
|
|
744
|
+
const pieceTemp = join2(dirname(piece), `.tmp-${randomUUID()}-${basename(piece)}`);
|
|
745
|
+
try {
|
|
746
|
+
await encode(pieceTemp, timeoutMs, range);
|
|
747
|
+
renameSync(pieceTemp, piece);
|
|
748
|
+
} finally {
|
|
749
|
+
if (existsSync2(pieceTemp)) unlinkSync2(pieceTemp);
|
|
750
|
+
}
|
|
696
751
|
}
|
|
697
|
-
const
|
|
752
|
+
const listDir = mkdtempSync(join2(tmpdir(), "hf-proxy-join-"));
|
|
753
|
+
try {
|
|
754
|
+
const listPath = join2(listDir, "pieces.txt");
|
|
755
|
+
writeFileSync(
|
|
756
|
+
listPath,
|
|
757
|
+
pieces.map((piece) => `file '${piece.replace(/\\/g, "/").replace(/'/g, "'\\''")}'
|
|
758
|
+
`).join("")
|
|
759
|
+
);
|
|
760
|
+
await concat(listPath, tempPath);
|
|
761
|
+
} finally {
|
|
762
|
+
rmSync(listDir, { recursive: true, force: true });
|
|
763
|
+
}
|
|
764
|
+
for (const piece of pieces) if (existsSync2(piece)) unlinkSync2(piece);
|
|
765
|
+
}
|
|
766
|
+
var H264_ARGS = [
|
|
767
|
+
"-c:v",
|
|
768
|
+
"libx264",
|
|
769
|
+
"-profile:v",
|
|
770
|
+
"high",
|
|
771
|
+
"-pix_fmt",
|
|
772
|
+
"yuv420p",
|
|
773
|
+
"-colorspace",
|
|
774
|
+
"bt709",
|
|
775
|
+
"-color_primaries",
|
|
776
|
+
"bt709",
|
|
777
|
+
"-color_trc",
|
|
778
|
+
"bt709",
|
|
779
|
+
"-crf",
|
|
780
|
+
"18",
|
|
781
|
+
"-preset",
|
|
782
|
+
"veryfast",
|
|
783
|
+
"-c:a",
|
|
784
|
+
"aac",
|
|
785
|
+
"-movflags",
|
|
786
|
+
"+faststart"
|
|
787
|
+
];
|
|
788
|
+
var VP8_ARGS = [
|
|
789
|
+
"-c:v",
|
|
790
|
+
"libvpx",
|
|
791
|
+
"-b:v",
|
|
792
|
+
"0",
|
|
793
|
+
"-crf",
|
|
794
|
+
"23",
|
|
795
|
+
"-deadline",
|
|
796
|
+
"good",
|
|
797
|
+
"-pix_fmt",
|
|
798
|
+
"yuva420p",
|
|
799
|
+
"-colorspace",
|
|
800
|
+
"bt709",
|
|
801
|
+
"-color_primaries",
|
|
802
|
+
"bt709",
|
|
803
|
+
"-color_trc",
|
|
804
|
+
"bt709",
|
|
805
|
+
"-cpu-used",
|
|
806
|
+
"4",
|
|
807
|
+
"-auto-alt-ref",
|
|
808
|
+
"0",
|
|
809
|
+
"-metadata:s:v:0",
|
|
810
|
+
"alpha_mode=1",
|
|
811
|
+
"-ac",
|
|
812
|
+
"2",
|
|
813
|
+
"-c:a",
|
|
814
|
+
"libopus"
|
|
815
|
+
];
|
|
816
|
+
async function buildVideoFilter(ffmpegPath, sourcePath, metadata, keepsAlpha, box) {
|
|
698
817
|
const { hdrTransfer } = metadata.color;
|
|
699
818
|
const toneMap = (hdrTransfer === "pq" || hdrTransfer === "hlg") && !keepsAlpha;
|
|
700
819
|
if (toneMap) await ensureHdrFilters(ffmpegPath);
|
|
701
820
|
const firstFrame = toneMap ? await probeFirstFrameColour(sourcePath) : {};
|
|
702
821
|
const evenScale = proxyScaleFilter(box);
|
|
703
822
|
const pixelFormat = keepsAlpha ? "yuva420p" : "yuv420p";
|
|
704
|
-
|
|
823
|
+
return toneMap ? [
|
|
705
824
|
hdrToSdrToneMapFilter(metadata.color, firstFrame),
|
|
706
825
|
`${evenScale}:out_color_matrix=bt709:out_range=tv`,
|
|
707
826
|
`format=${pixelFormat}`
|
|
708
827
|
].join(",") : [evenScale, `format=${pixelFormat}`].join(",");
|
|
828
|
+
}
|
|
829
|
+
async function runFfmpeg(sourcePath, outputPath, chunkPrefix, variant, box, signal) {
|
|
830
|
+
const metadata = await probeMediaMetadata(sourcePath);
|
|
831
|
+
const ffmpegPath = findFfBinary("ffmpeg", { configuredMustExist: true });
|
|
832
|
+
if (!ffmpegPath) {
|
|
833
|
+
throw new FfmpegUnavailableError();
|
|
834
|
+
}
|
|
835
|
+
const keepsAlpha = variant === "vp8";
|
|
836
|
+
const videoFilter = await buildVideoFilter(ffmpegPath, sourcePath, metadata, keepsAlpha, box);
|
|
837
|
+
const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
|
|
838
|
+
const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
|
|
839
|
+
const encode = (target, timeoutMs, range) => spawnFfmpeg(
|
|
840
|
+
ffmpegPath,
|
|
841
|
+
[
|
|
842
|
+
"-y",
|
|
843
|
+
...range ? ["-ss", String(range.startSeconds)] : [],
|
|
844
|
+
...decoderArgs,
|
|
845
|
+
"-i",
|
|
846
|
+
sourcePath,
|
|
847
|
+
...range ? ["-t", String(range.lengthSeconds)] : [],
|
|
848
|
+
"-vf",
|
|
849
|
+
videoFilter,
|
|
850
|
+
...variant === "vp8" ? VP8_ARGS : H264_ARGS,
|
|
851
|
+
target
|
|
852
|
+
],
|
|
853
|
+
timeoutMs,
|
|
854
|
+
signal
|
|
855
|
+
);
|
|
856
|
+
const ranges = chunkRanges(metadata.durationSeconds);
|
|
857
|
+
if (!ranges) return encode(outputPath, TRANSCODE_TIMEOUT_MS);
|
|
858
|
+
await encodeInChunks(
|
|
859
|
+
ranges,
|
|
860
|
+
chunkPrefix,
|
|
861
|
+
outputPath,
|
|
862
|
+
encode,
|
|
863
|
+
(listPath, target) => spawnFfmpeg(ffmpegPath, concatArgs(listPath, target, variant), CONCAT_TIMEOUT_MS, signal)
|
|
864
|
+
);
|
|
865
|
+
}
|
|
866
|
+
function concatArgs(listPath, target, variant) {
|
|
867
|
+
return [
|
|
868
|
+
"-y",
|
|
869
|
+
"-f",
|
|
870
|
+
"concat",
|
|
871
|
+
"-safe",
|
|
872
|
+
"0",
|
|
873
|
+
"-i",
|
|
874
|
+
listPath,
|
|
875
|
+
"-c",
|
|
876
|
+
"copy",
|
|
877
|
+
...variant === "h264" ? ["-movflags", "+faststart"] : [],
|
|
878
|
+
target
|
|
879
|
+
];
|
|
880
|
+
}
|
|
881
|
+
function spawnFfmpeg(ffmpegPath, args, timeoutMs, signal) {
|
|
709
882
|
return new Promise((resolvePromise, reject) => {
|
|
710
|
-
const alphaDecoder = keepsAlpha ? alphaDecoderFor(metadata.color.codecName) : null;
|
|
711
|
-
const decoderArgs = alphaDecoder ? ["-c:v", alphaDecoder] : [];
|
|
712
|
-
const commonArgs = ["-y", ...decoderArgs, "-i", sourcePath, "-vf", videoFilter];
|
|
713
|
-
const h264Args = [
|
|
714
|
-
"-c:v",
|
|
715
|
-
"libx264",
|
|
716
|
-
"-profile:v",
|
|
717
|
-
"high",
|
|
718
|
-
"-pix_fmt",
|
|
719
|
-
"yuv420p",
|
|
720
|
-
"-colorspace",
|
|
721
|
-
"bt709",
|
|
722
|
-
"-color_primaries",
|
|
723
|
-
"bt709",
|
|
724
|
-
"-color_trc",
|
|
725
|
-
"bt709",
|
|
726
|
-
"-crf",
|
|
727
|
-
"18",
|
|
728
|
-
"-preset",
|
|
729
|
-
"veryfast",
|
|
730
|
-
"-c:a",
|
|
731
|
-
"aac",
|
|
732
|
-
"-movflags",
|
|
733
|
-
"+faststart"
|
|
734
|
-
];
|
|
735
|
-
const vp8Args = [
|
|
736
|
-
"-c:v",
|
|
737
|
-
"libvpx",
|
|
738
|
-
"-b:v",
|
|
739
|
-
"0",
|
|
740
|
-
"-crf",
|
|
741
|
-
"23",
|
|
742
|
-
"-deadline",
|
|
743
|
-
"good",
|
|
744
|
-
"-pix_fmt",
|
|
745
|
-
"yuva420p",
|
|
746
|
-
"-colorspace",
|
|
747
|
-
"bt709",
|
|
748
|
-
"-color_primaries",
|
|
749
|
-
"bt709",
|
|
750
|
-
"-color_trc",
|
|
751
|
-
"bt709",
|
|
752
|
-
"-cpu-used",
|
|
753
|
-
"4",
|
|
754
|
-
"-auto-alt-ref",
|
|
755
|
-
"0",
|
|
756
|
-
"-metadata:s:v:0",
|
|
757
|
-
"alpha_mode=1",
|
|
758
|
-
"-ac",
|
|
759
|
-
"2",
|
|
760
|
-
"-c:a",
|
|
761
|
-
"libopus"
|
|
762
|
-
];
|
|
763
|
-
const args = [...commonArgs, ...variant === "vp8" ? vp8Args : h264Args, outputPath];
|
|
764
883
|
signal.throwIfAborted();
|
|
765
884
|
const proc = spawn(ffmpegPath, args, {
|
|
766
885
|
stdio: ["ignore", "ignore", "pipe"],
|
|
767
|
-
timeout:
|
|
886
|
+
timeout: timeoutMs,
|
|
768
887
|
killSignal: "SIGKILL",
|
|
769
888
|
signal,
|
|
770
889
|
windowsHide: true
|
|
@@ -783,7 +902,7 @@ async function runFfmpeg(sourcePath, outputPath, variant, box, signal) {
|
|
|
783
902
|
} else if (signal2) {
|
|
784
903
|
reject(
|
|
785
904
|
new ProxyTranscodeError(
|
|
786
|
-
`ffmpeg killed by ${signal2} (timeout ${
|
|
905
|
+
`ffmpeg killed by ${signal2} (timeout ${timeoutMs}ms or external kill)`,
|
|
787
906
|
null,
|
|
788
907
|
stderrTail
|
|
789
908
|
)
|
|
@@ -808,7 +927,18 @@ async function transcodeToCache(job, projectDir, absoluteSourcePath, cachePath,
|
|
|
808
927
|
mkdirWithinProject(projectDir, cacheDir);
|
|
809
928
|
const tempPath = join2(cacheDir, `.tmp-${randomUUID()}-${basename(cachePath)}`);
|
|
810
929
|
try {
|
|
811
|
-
|
|
930
|
+
const chunkPrefix = join2(
|
|
931
|
+
cacheDir,
|
|
932
|
+
`${CHUNK_PREFIX}${basename(cachePath, extname2(cachePath))}-`
|
|
933
|
+
);
|
|
934
|
+
await runFfmpeg(
|
|
935
|
+
absoluteSourcePath,
|
|
936
|
+
tempPath,
|
|
937
|
+
chunkPrefix,
|
|
938
|
+
variant,
|
|
939
|
+
box,
|
|
940
|
+
job.abandoned.signal
|
|
941
|
+
);
|
|
812
942
|
renameSync(tempPath, cachePath);
|
|
813
943
|
maintainProxyCache(cacheDir);
|
|
814
944
|
return cachePath;
|
|
@@ -876,13 +1006,23 @@ async function resolveProxy(projectDir, absoluteSourcePath, variant = "h264", bo
|
|
|
876
1006
|
}
|
|
877
1007
|
async function resolveProxies(projectDir, sources, onSettled = () => {
|
|
878
1008
|
}) {
|
|
1009
|
+
const first = sources[0];
|
|
1010
|
+
if (first) {
|
|
1011
|
+
maintainProxyCache(
|
|
1012
|
+
dirname(getProxyCachePath(projectDir, first.sourcePath, first.variant)),
|
|
1013
|
+
Math.min(
|
|
1014
|
+
Number(process.env.HYPERFRAMES_PROXY_CACHE_STALE_TEMP_MS) || UNTOUCHED_TEMP_IS_DEAD_MS,
|
|
1015
|
+
UNTOUCHED_TEMP_IS_DEAD_MS
|
|
1016
|
+
)
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
879
1019
|
const results = [];
|
|
880
1020
|
let next = 0;
|
|
881
1021
|
const worker = async () => {
|
|
882
1022
|
for (let index = next++; index < sources.length; index = next++) {
|
|
883
|
-
const { sourcePath, variant } = sources[index];
|
|
1023
|
+
const { sourcePath, variant, box } = sources[index];
|
|
884
1024
|
results[index] = await waitForProxy(
|
|
885
|
-
resolveProxy(projectDir, sourcePath, variant),
|
|
1025
|
+
resolveProxy(projectDir, sourcePath, variant, box),
|
|
886
1026
|
TRANSCODE_TIMEOUT_MS
|
|
887
1027
|
).then(
|
|
888
1028
|
(value) => ({ status: "fulfilled", value }),
|
|
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
getMimeType,
|
|
9
9
|
injectMediaCodecMapIntoHtml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ZPMF6GAQ.js";
|
|
11
11
|
import {
|
|
12
12
|
PROXY_VARIANT_CONFIG,
|
|
13
13
|
ProxyCapacityError,
|
|
@@ -18,10 +18,17 @@ import {
|
|
|
18
18
|
recordProxyRequest,
|
|
19
19
|
resolveProxy,
|
|
20
20
|
resolveProxyVariantRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-BZQLTNMB.js";
|
|
22
|
+
import {
|
|
23
|
+
findStageProxyBox
|
|
24
|
+
} from "./chunk-SGFMCNLY.js";
|
|
22
25
|
import {
|
|
23
26
|
resolveAutoProxy
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-Z2BW2WJS.js";
|
|
28
|
+
import {
|
|
29
|
+
PREVIEW_PROXY_BOX_PARAM,
|
|
30
|
+
parsePreviewProxyBox
|
|
31
|
+
} from "./chunk-WYCFMNU3.js";
|
|
25
32
|
import {
|
|
26
33
|
decodeWellFormedEscapes
|
|
27
34
|
} from "./chunk-BSQ7XANM.js";
|
|
@@ -141,7 +148,7 @@ function writeProxyError(err, res) {
|
|
|
141
148
|
res.writeHead(500);
|
|
142
149
|
res.end();
|
|
143
150
|
}
|
|
144
|
-
async function serveProxyRequest(projectDir, filePath, request, autoProxy, rangeHeader, res, signal) {
|
|
151
|
+
async function serveProxyRequest(projectDir, filePath, request, box, autoProxy, rangeHeader, res, signal) {
|
|
145
152
|
const contentType = getMimeType(filePath);
|
|
146
153
|
if (!autoProxy || !contentType.startsWith("video/")) {
|
|
147
154
|
res.writeHead(404);
|
|
@@ -168,7 +175,7 @@ async function serveProxyRequest(projectDir, filePath, request, autoProxy, range
|
|
|
168
175
|
return;
|
|
169
176
|
}
|
|
170
177
|
recordProxyRequest();
|
|
171
|
-
const proxyPath = await resolveProxy(projectDir, filePath, variant,
|
|
178
|
+
const proxyPath = await resolveProxy(projectDir, filePath, variant, box, { signal });
|
|
172
179
|
if (res.writableEnded || res.destroyed) return;
|
|
173
180
|
serveFileWithRange(proxyPath, rangeHeader, res, PROXY_VARIANT_CONFIG[variant].contentType);
|
|
174
181
|
} catch (err) {
|
|
@@ -179,7 +186,15 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
179
186
|
const roots = [projectDir, ...assetRoots];
|
|
180
187
|
const autoProxy = resolveAutoProxy(projectDir, autoProxyOverride);
|
|
181
188
|
const copies = new AbortController();
|
|
182
|
-
const servedHtml = autoProxy ? await injectMediaCodecMapIntoHtml(
|
|
189
|
+
const servedHtml = autoProxy ? await injectMediaCodecMapIntoHtml(
|
|
190
|
+
html,
|
|
191
|
+
projectDir,
|
|
192
|
+
[{ html }],
|
|
193
|
+
void 0,
|
|
194
|
+
true,
|
|
195
|
+
copies.signal,
|
|
196
|
+
findStageProxyBox(html)
|
|
197
|
+
) : html;
|
|
183
198
|
const server = createServer((req, res) => {
|
|
184
199
|
const url = req.url ?? "/";
|
|
185
200
|
if (url === "/" || url === "/index.html") {
|
|
@@ -189,8 +204,16 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
189
204
|
}
|
|
190
205
|
const queryIndex = url.indexOf("?");
|
|
191
206
|
const pathOnly = queryIndex === -1 ? url : url.slice(0, queryIndex);
|
|
192
|
-
const
|
|
207
|
+
const query = new URLSearchParams(queryIndex === -1 ? "" : url.slice(queryIndex + 1));
|
|
208
|
+
const proxyParam = query.get("hf-proxy");
|
|
193
209
|
const proxyRequest = proxyParam !== null && isProxyVariantRequest(proxyParam) ? proxyParam : null;
|
|
210
|
+
const boxParam = query.get(PREVIEW_PROXY_BOX_PARAM);
|
|
211
|
+
const proxyBox = boxParam === null ? void 0 : parsePreviewProxyBox(boxParam);
|
|
212
|
+
if (proxyBox === null || proxyBox && !proxyRequest) {
|
|
213
|
+
res.writeHead(404);
|
|
214
|
+
res.end();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
194
217
|
const requestPath = decodeWellFormedEscapes(pathOnly).replace(/^\//, "");
|
|
195
218
|
for (const root of roots) {
|
|
196
219
|
const filePath = resolve(root, requestPath);
|
|
@@ -202,6 +225,7 @@ async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Fail
|
|
|
202
225
|
projectDir,
|
|
203
226
|
filePath,
|
|
204
227
|
proxyRequest,
|
|
228
|
+
proxyBox,
|
|
205
229
|
autoProxy,
|
|
206
230
|
req.headers.range,
|
|
207
231
|
res,
|
|
@@ -7,14 +7,14 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
trackLintReport,
|
|
9
9
|
trackLintRuleStreak
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-IPEP346Y.js";
|
|
11
11
|
import {
|
|
12
12
|
shouldTrack
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-T37XXYRK.js";
|
|
14
14
|
import {
|
|
15
15
|
LINT_RULE_COUNT,
|
|
16
16
|
LINT_RULE_GROUP_COUNTS
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TSFA2Y5C.js";
|
|
18
18
|
|
|
19
19
|
// src/telemetry/lintStreaks.ts
|
|
20
20
|
import { createHash } from "crypto";
|