hyperframes 0.9.66 → 0.9.67
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-Q4W2PAZ6.js → add-2FYFE3ZX.js} +11 -11
- package/dist/{agentPromptGenerator-BZ77OPI4.js → agentPromptGenerator-5YFPYST7.js} +5 -5
- package/dist/{animatedGifPrep-3UBRNEEA.js → animatedGifPrep-SIL3ADIS.js} +5 -5
- package/dist/api.js +30 -30
- package/dist/{asset-ZRTGYYEN.js → asset-D5BXLEK4.js} +4 -4
- package/dist/{assetCataloger-GTSOUOBQ.js → assetCataloger-7UREFLWJ.js} +6 -6
- package/dist/{audio-ZUW3RHEO.js → audio-NGQW5Z7O.js} +15 -15
- package/dist/{auth-TE5FMKUT.js → auth-L2MGMG62.js} +4 -4
- package/dist/{autoUpdate-6JGNDMLP.js → autoUpdate-FKWV43U5.js} +2 -2
- package/dist/{avatars-BJEF4TZR.js → avatars-SM7BUIVL.js} +12 -12
- package/dist/{backgroundChecks-EN5XLRLY.js → backgroundChecks-XGOO6ETM.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-EEMYIEYR.js → batchRender-LK46EDAZ.js} +3 -3
- package/dist/{beats-IPGSP5BV.js → beats-FPJEEBO2.js} +7 -7
- package/dist/{benchmark-GZOATIPM.js → benchmark-BMM3E56O.js} +10 -10
- package/dist/{billing-3LF2YYP7.js → billing-S37OJE6G.js} +13 -13
- package/dist/{browser-2IH45NN6.js → browser-ACTTU67A.js} +5 -5
- package/dist/{bundleWithLocalizedFonts-QV6WDOXF.js → bundleWithLocalizedFonts-H2UJUDSF.js} +1 -1
- package/dist/{capture-K75SADNY.js → capture-N24KHG3V.js} +14 -14
- package/dist/{capture-4SIGWC4Q.js → capture-V4ATIGRR.js} +5 -5
- package/dist/{captureCompositionFrame-XVEPPU4X.js → captureCompositionFrame-Y2GGNU43.js} +12 -12
- package/dist/{catalog-6N22YQEE.js → catalog-4FAP2CFF.js} +11 -11
- package/dist/{catch-up-67LVADSA.js → catch-up-6RCTMCTI.js} +6 -6
- package/dist/{check-NYD3WGR2.js → check-P6XW2CX7.js} +39 -39
- package/dist/{checkAudio-APZTSEHX.js → checkAudio-R7ZSNHPD.js} +8 -8
- package/dist/{checkBrowser-2UA6O65I.js → checkBrowser-ZTEBVQMM.js} +32 -32
- package/dist/{chunk-XMKDDEX4.js → chunk-2F2HLVI5.js} +6 -6
- package/dist/{chunk-JGKI7FHX.js → chunk-2FKIIF2W.js} +10 -11
- package/dist/{chunk-OI5WGQE3.js → chunk-2SE62YIX.js} +2 -2
- package/dist/{chunk-FBOKUG5B.js → chunk-2U6Z7QH5.js} +5 -5
- package/dist/{chunk-NOCU3FBX.js → chunk-3DENR37V.js} +3 -3
- package/dist/{chunk-Y4QE4LEB.js → chunk-3F7MJNGG.js} +1 -1
- package/dist/{chunk-NSADX4IV.js → chunk-3NPAQ5FV.js} +1 -1
- package/dist/{chunk-MKZ73C57.js → chunk-3RUFJGIT.js} +1 -1
- package/dist/{chunk-7BREEOLQ.js → chunk-3XS35R5E.js} +12 -12
- package/dist/{chunk-N6VNR4YE.js → chunk-4E3AKTSD.js} +1 -1
- package/dist/{chunk-3WE4UZHN.js → chunk-4MJCBHXI.js} +1 -1
- package/dist/{chunk-TU2WFCGS.js → chunk-4SBR3ZP7.js} +1 -1
- package/dist/{chunk-ESYW3LJU.js → chunk-5U4QTHAS.js} +2 -2
- package/dist/{chunk-JHPOKDZI.js → chunk-6QKW4E7D.js} +11 -11
- package/dist/{chunk-TXTVVIW7.js → chunk-6U5JJJFB.js} +1 -1
- package/dist/{chunk-XKIXRSVB.js → chunk-77SURLKL.js} +2 -2
- package/dist/{chunk-HMNDJPLQ.js → chunk-A4AMJI7L.js} +1 -1
- package/dist/{chunk-XTKNMYRR.js → chunk-A4USKCUY.js} +1 -1
- package/dist/{chunk-MH46RGG6.js → chunk-A5ZULLJX.js} +1 -1
- package/dist/{chunk-K2NOQNNY.js → chunk-AEBDHKTJ.js} +1 -1
- package/dist/{chunk-YMSOS6CF.js → chunk-AH4QO6YC.js} +1 -1
- package/dist/{chunk-7EOREMZI.js → chunk-AJPSKAQ6.js} +11 -11
- package/dist/{chunk-37SEGJEO.js → chunk-AMQBBQCF.js} +2 -2
- package/dist/{chunk-AWOHPIKF.js → chunk-AQYZW46G.js} +8 -8
- package/dist/{chunk-Y6A5LED6.js → chunk-AWP277ZO.js} +1 -1
- package/dist/{chunk-R5C2CV7J.js → chunk-B3HZTUCD.js} +2 -2
- package/dist/{chunk-NMASYQXY.js → chunk-BAL7FD4W.js} +2 -2
- package/dist/{chunk-7CKKKBNM.js → chunk-BANMRXAN.js} +1 -1
- package/dist/{chunk-M4ABCFJO.js → chunk-BC24UT7V.js} +2 -2
- package/dist/{chunk-OMFIMZZD.js → chunk-BHOQKOW3.js} +1 -1
- package/dist/{chunk-Y57R6C5U.js → chunk-BLPMKSO7.js} +2 -1
- package/dist/{chunk-3ODOQWSB.js → chunk-BO2FQEM4.js} +2 -2
- package/dist/{chunk-PXMEW6TM.js → chunk-CGHKK2BY.js} +3 -3
- package/dist/{chunk-ULE2EYEY.js → chunk-D7W642TJ.js} +2 -2
- package/dist/{chunk-LNOG6KKM.js → chunk-DKEP2QM5.js} +4 -4
- package/dist/{chunk-LBFV45YF.js → chunk-DNBMLRSA.js} +1 -1
- package/dist/{chunk-TZ3EPV4B.js → chunk-EMUKI7UB.js} +1 -1
- package/dist/{chunk-WMJ3PV37.js → chunk-EYFZRI6U.js} +1 -1
- package/dist/{chunk-JDJ6BM5E.js → chunk-FHSBI5MM.js} +1 -1
- package/dist/{chunk-TMB4L4GG.js → chunk-FXQRMULT.js} +1 -1
- package/dist/{chunk-6QITYZN7.js → chunk-FZT7QWVE.js} +2 -2
- package/dist/{chunk-FAJRDYFU.js → chunk-GHPPUALY.js} +2 -2
- package/dist/{chunk-MEZAMIT6.js → chunk-H3AH7NDI.js} +7 -7
- package/dist/{chunk-TIGMUHSL.js → chunk-HPENBBIH.js} +1 -1
- package/dist/{chunk-FCNBAYZ6.js → chunk-HUUPDIBE.js} +3 -3
- package/dist/{chunk-TUJB74AE.js → chunk-IFC533NZ.js} +2 -2
- package/dist/{chunk-DPMEWIVZ.js → chunk-IRW7AWIC.js} +4 -4
- package/dist/{chunk-A6O65H7G.js → chunk-ITBQLYIV.js} +3 -3
- package/dist/{chunk-KFWSPEDG.js → chunk-JB7OF43L.js} +1 -1
- package/dist/{chunk-EIION6EA.js → chunk-JK2WTAKR.js} +6 -2
- package/dist/{chunk-6PYUPO4M.js → chunk-JOW7SA7F.js} +2 -2
- package/dist/{chunk-2Z7IW5EY.js → chunk-JXUDMAKX.js} +1 -1
- package/dist/{chunk-AI4MXYGK.js → chunk-JYFQXM2E.js} +1 -1
- package/dist/{chunk-66D5BC5K.js → chunk-K7VV4XSD.js} +1 -1
- package/dist/{chunk-H6LFXHAV.js → chunk-KNRZBLQH.js} +2 -2
- package/dist/{chunk-74M47HVE.js → chunk-KRRKEWWI.js} +1 -1
- package/dist/{chunk-6PGDI5NG.js → chunk-L7YERJVL.js} +660 -508
- package/dist/{chunk-3BKNPN36.js → chunk-LHCQ4TMY.js} +1 -1
- package/dist/{chunk-WWQWDRKU.js → chunk-MDFQC4J2.js} +1 -1
- package/dist/{chunk-WY6354ZO.js → chunk-MDWOXUEU.js} +4 -4
- package/dist/{chunk-XEIVSW2F.js → chunk-MIPRIUWU.js} +5 -5
- package/dist/{chunk-D5YHSTHZ.js → chunk-NNKKJ2MI.js} +1 -1
- package/dist/{chunk-UCQTLZDJ.js → chunk-NYJ4OV4H.js} +1 -1
- package/dist/{chunk-OB56G4VA.js → chunk-O3ENZQHQ.js} +2 -2
- package/dist/{chunk-ZHIAAYY2.js → chunk-OMLJTCNR.js} +2 -2
- package/dist/{chunk-5UOYRGKV.js → chunk-P6WWZ4ZZ.js} +2 -2
- package/dist/{chunk-745HLQBA.js → chunk-PAKYOFVJ.js} +1 -1
- package/dist/{chunk-CEHYC2UD.js → chunk-PEXUCK6Y.js} +2 -2
- package/dist/{chunk-CUOX3TDY.js → chunk-PHBS5KEY.js} +1 -1
- package/dist/{chunk-EPBYIJPM.js → chunk-PI6ZYIGK.js} +1 -1
- package/dist/{chunk-KDQRJHLU.js → chunk-PS26KCCH.js} +3 -3
- package/dist/{chunk-LAXD6VM7.js → chunk-Q3OZGUZ4.js} +6 -6
- package/dist/{chunk-IXGZSANV.js → chunk-QOIEPOKY.js} +1 -1
- package/dist/{chunk-2OSPWUGX.js → chunk-QTLKOGK4.js} +2 -2
- package/dist/{chunk-DZ3JB4F3.js → chunk-RVQQUHIT.js} +2 -2
- package/dist/{chunk-ZQPXWUCP.js → chunk-S36C2TEK.js} +3 -3
- package/dist/chunk-S3IQW75Q.js +5146 -0
- package/dist/{chunk-SITGBEFO.js → chunk-SIVDQSNV.js} +20 -20
- package/dist/{chunk-XSARHJSW.js → chunk-STUDSWGR.js} +1 -1
- package/dist/{chunk-CTDCYNVK.js → chunk-SW4TVGUR.js} +2 -2
- package/dist/{chunk-AI5KNXSL.js → chunk-T73BVHZ5.js} +4 -4
- package/dist/{chunk-3B4WQYCW.js → chunk-TNO5EVXS.js} +4 -4
- package/dist/{chunk-XNJEXXKC.js → chunk-TTG6TSI6.js} +1 -1
- package/dist/{chunk-QSQNXAHE.js → chunk-U4BP54JI.js} +1 -1
- package/dist/{chunk-2UIAN6N7.js → chunk-U55SJQPA.js} +1 -1
- package/dist/{chunk-MG7UJJCP.js → chunk-ULR3HM3L.js} +2 -2
- package/dist/{chunk-LIXAC5NE.js → chunk-UN5SNMRS.js} +7 -7
- package/dist/{chunk-X3JZA7KH.js → chunk-VQ72HDX3.js} +2 -2
- package/dist/{chunk-L7BY2FDJ.js → chunk-VW733NCS.js} +13 -13
- package/dist/{chunk-TQYHQKOK.js → chunk-W3AUR4EP.js} +1 -1
- package/dist/{chunk-7LQFVACU.js → chunk-W742C6SA.js} +1 -1
- package/dist/{chunk-W672RTMC.js → chunk-W7MKF4I2.js} +4 -4
- package/dist/{chunk-ZY55U6ER.js → chunk-WMUBDXHG.js} +3 -2
- package/dist/{chunk-RHZE7BIX.js → chunk-WU3JL3BC.js} +2 -2
- package/dist/{chunk-S73AVUHJ.js → chunk-X2VXJFX2.js} +1 -1
- package/dist/{chunk-AAZF6D3Z.js → chunk-XEP7ER4Z.js} +1 -1
- package/dist/{chunk-6QZNF3JF.js → chunk-XNBVJAL4.js} +50 -57
- package/dist/chunk-XO4BTSA5.js +38 -0
- package/dist/{chunk-KXCAIQE4.js → chunk-XOXWJAWW.js} +3 -3
- package/dist/{chunk-ROODLZY7.js → chunk-YU4OCNWW.js} +7 -7
- package/dist/{chunk-U3WUAVAX.js → chunk-ZHNHAA6O.js} +3 -3
- package/dist/{chunk-BSY6ZHP6.js → chunk-ZTD6VXAE.js} +1 -1
- package/dist/{clean-73IDEWIJ.js → clean-NP652D74.js} +15 -15
- package/dist/cli.js +66 -66
- package/dist/{cloud-P32MAEIJ.js → cloud-EBVLMT6V.js} +4 -4
- package/dist/{cloud-SOZPWTDL.js → cloud-TNWRELD4.js} +6 -6
- package/dist/{cloudrun-H5TW5T4R.js → cloudrun-NAQ26OGP.js} +4 -4
- package/dist/{compare-BQSDHPZ3.js → compare-NPK5WR6F.js} +30 -30
- package/dist/{compiler-WNVDGRBH.js → compiler-TYKIETZY.js} +2 -2
- package/dist/{component-WWICYJFN.js → component-YTC25I6A.js} +5 -5
- package/dist/{compositions-VEMHHQR6.js → compositions-A3WYG7XA.js} +9 -9
- package/dist/{curve-5SCSMYX4.js → curve-HULZZNO2.js} +9 -9
- package/dist/{cuts-POUL3RQ5.js → cuts-EEN2AJLR.js} +10 -10
- package/dist/{delete-NVS5PXRM.js → delete-QBPY4DUZ.js} +8 -8
- package/dist/{deploy-SPJ5OWAI.js → deploy-ZOTTUJKO.js} +2 -2
- package/dist/{describeProject-KJGRR7FM.js → describeProject-AT42RQAC.js} +6 -6
- package/dist/{destroy-CPLVCITS.js → destroy-72TCFGIU.js} +2 -2
- package/dist/{diff-O2JUFV2N.js → diff-L76A3S3I.js} +30 -30
- package/dist/{dist-DCRKIIL4.js → dist-56QKGCNA.js} +8 -8
- package/dist/{dist-TTOW2KVO.js → dist-FU3Y3LDE.js} +2 -2
- package/dist/{doctor-L5GGDS2F.js → doctor-MTSMQTIP.js} +9 -9
- package/dist/{dotEnv-7P4XI4ID.js → dotEnv-NMTSGEYW.js} +3 -3
- package/dist/{energy-43JTPLLL.js → energy-Y7UZSF5R.js} +10 -10
- package/dist/{events-XRO5CFTD.js → events-5IZJ6IG4.js} +2 -2
- package/dist/{events-33NDGOZM.js → events-NLBWWYJR.js} +12 -12
- package/dist/{events-K576EL47.js → events-RY7F26WJ.js} +5 -5
- package/dist/{execute-EWZ3WK3L.js → execute-X6GOJYI7.js} +23 -23
- package/dist/{extract-NW375CQM.js → extract-PO4ERZG7.js} +10 -10
- package/dist/{face-IVXIPAO5.js → face-GS7FT77Y.js} +7 -7
- package/dist/{face-AVVUVV5L.js → face-O7W6DN3E.js} +10 -10
- package/dist/{feedback-MS34KB74.js → feedback-OLPHMAVY.js} +11 -11
- package/dist/{ffmpeg-I376KCKD.js → ffmpeg-6R5HYRLA.js} +5 -5
- package/dist/{figma-M37MXYPR.js → figma-3WLCHH7N.js} +3 -3
- package/dist/fontLocalizeCli.js +8 -8
- package/dist/{frames-6VGAHZBO.js → frames-RELC7P5I.js} +11 -11
- package/dist/{generate-TM7AOJ27.js → generate-KDKHARPX.js} +22 -22
- package/dist/{get-2JAJO7AP.js → get-Y4JVREKO.js} +8 -8
- package/dist/{gpuPolicy-DEH3KKNF.js → gpuPolicy-IJE7MB5Y.js} +5 -5
- package/dist/{grade-compare-UN6MPWVF.js → grade-compare-T25JDQLV.js} +29 -29
- package/dist/{hands-ANSG7WHU.js → hands-WXGO4FOI.js} +11 -11
- package/dist/{heifImagePrep-YC3ZMWUC.js → heifImagePrep-5X36VXGL.js} +6 -6
- package/dist/{help-63QQYCMJ.js → help-N66Y52S7.js} +1 -1
- package/dist/{history-DRSL755Q.js → history-F7C2MXWT.js} +8 -8
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +61 -61
- package/dist/hyperframes-player.global.js +1 -1
- package/dist/{info-UNIWLP7I.js → info-IHOMN6HZ.js} +11 -11
- package/dist/{init-3W3XSGXC.js → init-S2SZ3YJW.js} +25 -25
- package/dist/{ink-OXJJIEQ7.js → ink-DMKCUCA4.js} +10 -10
- package/dist/{inspect-UOXP5ICV.js → inspect-ILBSFULF.js} +33 -33
- package/dist/{installer-OWZSFVV2.js → installer-5ZPAYISO.js} +4 -4
- package/dist/{keyframes-LNCXSQJ6.js → keyframes-U4XFMXJ3.js} +11 -11
- package/dist/{lambda-3ZIM5NW2.js → lambda-DYOGW62Q.js} +10 -10
- package/dist/{launch-HOSRCHWS.js → launch-D5BGD7YR.js} +6 -6
- package/dist/{layout-MRBHBZEA.js → layout-F7SIJYUI.js} +33 -33
- package/dist/{lint-U4PINYKO.js → lint-3HQJQBVK.js} +8 -8
- package/dist/{list-AMH6UUTI.js → list-JUPBF73K.js} +8 -8
- package/dist/{localPage-JJ56YNKB.js → localPage-SI4COAH7.js} +5 -5
- package/dist/{login-U42SSWF4.js → login-H6EP7A3D.js} +8 -8
- package/dist/{logout-DQVPSI4E.js → logout-S5JLGTKW.js} +4 -4
- package/dist/{look-6VTGMGIF.js → look-X5LTWUIV.js} +10 -10
- package/dist/{manager-GHP2QIUD.js → manager-GGOPVDOZ.js} +6 -6
- package/dist/{measure-NC4LN7EZ.js → measure-XUHMK2AU.js} +12 -12
- package/dist/{media-VKM5WFRK.js → media-YXE5MDL4.js} +6 -6
- package/dist/{media-treatment-VNZS2MIT.js → media-treatment-SJXT2VQM.js} +11 -11
- package/dist/{media-use-JOQWGBS5.js → media-use-VK62B4E2.js} +7 -7
- package/dist/{models-S55TNWF7.js → models-GBAKNMXA.js} +9 -9
- package/dist/{motionShot-OUOXFKUG.js → motionShot-6DNYNDSA.js} +15 -15
- package/dist/{normalize-audio-GYTTK5QE.js → normalize-audio-RWERSIGD.js} +8 -8
- package/dist/{open-KGXPI4BY.js → open-3YMOWNPY.js} +12 -12
- package/dist/{parakeetRunner-IXUUFPGG.js → parakeetRunner-TVDHLBTI.js} +10 -10
- package/dist/{pipeline-UE2Y2ZRB.js → pipeline-WCH5HSYI.js} +8 -8
- package/dist/{plan-AD4FZA6N.js → plan-HVP3IH7H.js} +16 -16
- package/dist/{play-G6JYDYIH.js → play-CQQ7HHSQ.js} +49 -42
- package/dist/{preflight-QNDXHMOT.js → preflight-6B6A46GT.js} +6 -6
- package/dist/{present-OK7QMCLR.js → present-UB6UPVOL.js} +19 -15
- package/dist/{preview-XD7J2KHY.js → preview-BVSDP4Z7.js} +17 -17
- package/dist/{privateProjectFile-2WJ6GPY6.js → privateProjectFile-NBXWYT2G.js} +2 -2
- package/dist/{probe-34RS6LVV.js → probe-BOCLZXCU.js} +10 -10
- package/dist/{producer-AX7EDIPJ.js → producer-HKFKQO2J.js} +1 -1
- package/dist/{projectConfig-YBFY4W5A.js → projectConfig-S7ZS2Q7T.js} +6 -6
- package/dist/{publication-JPKV2ZQO.js → publication-A6ZCUXEK.js} +2 -2
- package/dist/{publish-LRUVQX2E.js → publish-UA5UUDMQ.js} +15 -15
- package/dist/{receivedRecordFollow-6MPKPG36.js → receivedRecordFollow-Y7JQ2W2O.js} +5 -5
- package/dist/{refresh-HFE7YV57.js → refresh-T3APLU23.js} +4 -4
- package/dist/{remove-background-TS4QUALS.js → remove-background-YZ4FAKSD.js} +9 -9
- package/dist/{render-PSUJ4UCJ.js → render-CTU3KQWD.js} +37 -50
- package/dist/{render-UQICTWO6.js → render-HZFDCEBU.js} +26 -26
- package/dist/{render-NYFK74KL.js → render-POJSNMDW.js} +5 -5
- package/dist/{render-batch-57ZDTS7Z.js → render-batch-XUPWNAEB.js} +5 -5
- package/dist/{resolver-3HJC4XU3.js → resolver-XFJ2W7CE.js} +4 -4
- package/dist/{reverse-CIMYQVFI.js → reverse-DP3LTE2X.js} +1 -1
- package/dist/{run-EFRNU53Z.js → run-7YFWJGQA.js} +6 -6
- package/dist/{screenshotCapture-K63UAXO7.js → screenshotCapture-XDIKLRCX.js} +7 -7
- package/dist/{service-EEEGLRHX.js → service-BMH3KCG2.js} +11 -11
- package/dist/{share-WQVRXWH4.js → share-GNE5S6JA.js} +14 -14
- package/dist/{sherpa-BOHH3Q32.js → sherpa-2NMBO7EI.js} +9 -9
- package/dist/{skills-KB7UH26E.js → skills-SB465LBL.js} +8 -8
- package/dist/{skillsUpdateCheck-ZDA5FPJB.js → skillsUpdateCheck-OO3QYY7I.js} +3 -3
- package/dist/{snapshot-HRR6LIPD.js → snapshot-YYE5X4D6.js} +37 -37
- package/dist/{snapshotHeldVideos-QGJBXBJM.js → snapshotHeldVideos-WKU5Q4NL.js} +6 -6
- package/dist/{src-FCITTGFH.js → src-COKNEXLI.js} +6 -4
- package/dist/{src-QOVNNDZN.js → src-UEZXRPFJ.js} +7 -7
- package/dist/{start-I7H5I3AS.js → start-RXKU3NS3.js} +20 -20
- package/dist/{staticProjectServer-XEZD7JZE.js → staticProjectServer-PYOO5BKL.js} +16 -16
- package/dist/{status-2GKACMVC.js → status-OO7JXNVG.js} +13 -13
- package/dist/studio/assets/{hyperframes-player-VGx6ow_e.js → hyperframes-player-DHYu0XuV.js} +1 -1
- package/dist/studio/assets/{index-B8Xt_Oyw.js → index-BBKHfua5.js} +128 -128
- package/dist/studio/assets/{index-BH18TdX9.js → index-DqND4rHq.js} +1 -1
- package/dist/studio/assets/{pausedVideoDecoder-Bx3fGNkU.js → pausedVideoDecoder-B1FNXBMe.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-KQ7DR667.js → studio-api-3QHWJQ5S.js} +8 -8
- package/dist/{studioServer-KAU2XZ4F.js → studioServer-DDL676LA.js} +55 -55
- package/dist/subCompositionWorker.js +3 -3
- package/dist/{sync-3OJZRVPG.js → sync-JOQ6E5IN.js} +10 -10
- package/dist/{telemetry-HIZZLE6W.js → telemetry-PEPGYBEH.js} +5 -5
- package/dist/{templates-35GCXKO2.js → templates-U3LTK3E6.js} +13 -13
- package/dist/{textOverFace-Q4I3PREP.js → textOverFace-665L5B6Q.js} +3 -3
- package/dist/{timeline-U2V63I7B.js → timeline-5H5XHN2E.js} +16 -16
- package/dist/{tokens-24TKAZCA.js → tokens-ZT2YAOJ2.js} +4 -4
- package/dist/{transcribe-M3JJZ27F.js → transcribe-62GITMY3.js} +8 -8
- package/dist/{transcribe-YHGN4HEM.js → transcribe-DVXDCZX7.js} +24 -24
- package/dist/{tts-CDBXQSAQ.js → tts-V36EOYBQ.js} +2 -2
- package/dist/{update-4DIZ3YQQ.js → update-QVKPG5CA.js} +9 -9
- package/dist/{updateCheck-F56HX6MZ.js → updateCheck-X36OZADC.js} +2 -2
- package/dist/{upgrade-6WAFZ7WN.js → upgrade-YE57GX33.js} +3 -3
- package/dist/{urlDownloader-DNNB6UOI.js → urlDownloader-UJ5T4WGL.js} +4 -4
- package/dist/{validate-N5KPU4GC.js → validate-IXPYD4ZO.js} +23 -23
- package/dist/{video-T6YYFBNI.js → video-OX3ZLXXC.js} +6 -6
- package/dist/{voices-OI37IYYG.js → voices-ND6HWM5H.js} +20 -20
- package/dist/warmCheck.js +39 -39
- package/package.json +1 -1
- package/dist/chunk-RAHYMZNU.js +0 -5146
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Semaphore,
|
|
17
17
|
prepareHeifImageInputs,
|
|
18
18
|
withMediaProbeSlot
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WU3JL3BC.js";
|
|
20
20
|
import {
|
|
21
21
|
EncoderInterruptedError,
|
|
22
22
|
encoderFailureError,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
refusesOutsideLink,
|
|
31
31
|
resolveRenderPaths,
|
|
32
32
|
toExternalAssetKey
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-KNRZBLQH.js";
|
|
34
34
|
import {
|
|
35
35
|
linksOutside
|
|
36
36
|
} from "./chunk-6ACARSAZ.js";
|
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
computeWorkerSizing,
|
|
94
94
|
concatVideoFiles,
|
|
95
95
|
createCaptureSession,
|
|
96
|
+
createConcurrencyLimit,
|
|
96
97
|
createFrameLookupTable,
|
|
97
98
|
createFrameReorderBuffer,
|
|
98
99
|
createReferenceBackgroundRecorder,
|
|
@@ -211,7 +212,7 @@ import {
|
|
|
211
212
|
withPublicOnlyProxy,
|
|
212
213
|
writeCapturedFrame,
|
|
213
214
|
writeUrlDownloadTelemetry
|
|
214
|
-
} from "./chunk-
|
|
215
|
+
} from "./chunk-WMUBDXHG.js";
|
|
215
216
|
import {
|
|
216
217
|
settleOnBrowserSafePort
|
|
217
218
|
} from "./chunk-PJQVJSMG.js";
|
|
@@ -236,7 +237,7 @@ import {
|
|
|
236
237
|
parsesAsScript,
|
|
237
238
|
prepareFlattenedInnerRoot,
|
|
238
239
|
stripSdrPngColourTags
|
|
239
|
-
} from "./chunk-
|
|
240
|
+
} from "./chunk-2FKIIF2W.js";
|
|
240
241
|
import {
|
|
241
242
|
RENDER_TEMP_DIR
|
|
242
243
|
} from "./chunk-F6PI5O3H.js";
|
|
@@ -264,7 +265,7 @@ import {
|
|
|
264
265
|
redactTelemetryString,
|
|
265
266
|
resolveAuthoredTimingWindow,
|
|
266
267
|
toFps
|
|
267
|
-
} from "./chunk-
|
|
268
|
+
} from "./chunk-STUDSWGR.js";
|
|
268
269
|
import {
|
|
269
270
|
CAPTURE_CANVAS_SELECTOR,
|
|
270
271
|
COMPOSITION_SOURCE_URL,
|
|
@@ -301,7 +302,7 @@ import {
|
|
|
301
302
|
sourceTimeAt,
|
|
302
303
|
styleElementsFor,
|
|
303
304
|
timeAtSourceTime
|
|
304
|
-
} from "./chunk-
|
|
305
|
+
} from "./chunk-S3IQW75Q.js";
|
|
305
306
|
import {
|
|
306
307
|
isSafePath,
|
|
307
308
|
terminalText
|
|
@@ -376,7 +377,7 @@ import {
|
|
|
376
377
|
|
|
377
378
|
// ../producer/src/services/renderOrchestrator.ts
|
|
378
379
|
import {
|
|
379
|
-
existsSync as
|
|
380
|
+
existsSync as existsSync21,
|
|
380
381
|
mkdirSync as mkdirSync10,
|
|
381
382
|
readdirSync as readdirSync6,
|
|
382
383
|
rmSync as rmSync10,
|
|
@@ -385,7 +386,7 @@ import {
|
|
|
385
386
|
copyFileSync as copyFileSync3,
|
|
386
387
|
appendFileSync
|
|
387
388
|
} from "fs";
|
|
388
|
-
import { tmpdir as
|
|
389
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
389
390
|
|
|
390
391
|
// ../producer/src/services/htmlTagScans.ts
|
|
391
392
|
function forwardFinder(text, pattern) {
|
|
@@ -679,7 +680,7 @@ function firstCompositionIdTag(html) {
|
|
|
679
680
|
}
|
|
680
681
|
|
|
681
682
|
// ../producer/src/services/renderOrchestrator.ts
|
|
682
|
-
import { join as
|
|
683
|
+
import { join as join30, dirname as dirname12, resolve as resolve7 } from "path";
|
|
683
684
|
import { totalmem as totalmem2 } from "os";
|
|
684
685
|
import { randomUUID } from "crypto";
|
|
685
686
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
@@ -1497,13 +1498,13 @@ function createFileServer(options) {
|
|
|
1497
1498
|
if (!streamOwnsFd) closeSync(fd);
|
|
1498
1499
|
}
|
|
1499
1500
|
});
|
|
1500
|
-
return new Promise((
|
|
1501
|
+
return new Promise((resolve12, reject) => {
|
|
1501
1502
|
const connections = /* @__PURE__ */ new Set();
|
|
1502
1503
|
const server = serve({ fetch: app.fetch, port, hostname: "127.0.0.1" }, (info) => {
|
|
1503
1504
|
const bound = port === 0 ? settleOnBrowserSafePort(server, "127.0.0.1") : Promise.resolve(info.port);
|
|
1504
1505
|
bound.then((boundPort) => {
|
|
1505
1506
|
listeningPort = boundPort;
|
|
1506
|
-
|
|
1507
|
+
resolve12({
|
|
1507
1508
|
url: `http://localhost:${boundPort}`,
|
|
1508
1509
|
port: boundPort,
|
|
1509
1510
|
addPreHeadScript: (script) => {
|
|
@@ -2054,10 +2055,117 @@ function buildRenderErrorDetails(input) {
|
|
|
2054
2055
|
perfStages: Object.keys(input.perfStages).length > 0 ? { ...input.perfStages } : void 0,
|
|
2055
2056
|
hdrDiagnostics: input.hdrDiagnostics.videoExtractionFailures > 0 || input.hdrDiagnostics.imageDecodeFailures > 0 ? { ...input.hdrDiagnostics } : void 0,
|
|
2056
2057
|
observability: input.observability,
|
|
2057
|
-
subTimelineWait: input.subTimelineWait
|
|
2058
|
+
subTimelineWait: input.subTimelineWait,
|
|
2059
|
+
missingPath: input.missingPath
|
|
2058
2060
|
};
|
|
2059
2061
|
}
|
|
2060
2062
|
|
|
2063
|
+
// ../producer/src/services/render/missingPath.ts
|
|
2064
|
+
import { existsSync as existsSync4, lstatSync, readlinkSync } from "fs";
|
|
2065
|
+
import { tmpdir } from "os";
|
|
2066
|
+
import { basename as basename2, join as join3, relative as relative2, resolve as resolve4, isAbsolute as isAbsolute2, sep as sep2 } from "path";
|
|
2067
|
+
|
|
2068
|
+
// ../core/dist/missingPath.js
|
|
2069
|
+
var quotedPath = (text) => /'([^']+)'/.exec(text)?.[1] ?? "";
|
|
2070
|
+
function errorChain(error) {
|
|
2071
|
+
const chain = [];
|
|
2072
|
+
for (let seen = error; seen instanceof Error && chain.length < 5; seen = seen.cause)
|
|
2073
|
+
chain.push(seen);
|
|
2074
|
+
return chain;
|
|
2075
|
+
}
|
|
2076
|
+
function missingPathOf(error) {
|
|
2077
|
+
const enoent = errorChain(error).find((seen) => seen.code === "ENOENT");
|
|
2078
|
+
if (enoent)
|
|
2079
|
+
return enoent.path ?? quotedPath(enoent.message);
|
|
2080
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2081
|
+
return /\bENOENT\b/.test(message) ? quotedPath(message) : void 0;
|
|
2082
|
+
}
|
|
2083
|
+
function errnoMissingPathOf(error) {
|
|
2084
|
+
const enoent = errorChain(error).find((seen) => seen.code === "ENOENT");
|
|
2085
|
+
return enoent?.path;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
// ../producer/src/services/render/missingPath.ts
|
|
2089
|
+
var SYNCED = /onedrive|dropbox|icloud|mobile documents|clouddocs|google ?drive|cloudstorage/i;
|
|
2090
|
+
var inside = (path, folder) => {
|
|
2091
|
+
const rel = relative2(resolve4(folder), resolve4(path));
|
|
2092
|
+
return rel === "" || !rel.startsWith("..") && !isAbsolute2(rel);
|
|
2093
|
+
};
|
|
2094
|
+
function lstatOrNull(path) {
|
|
2095
|
+
try {
|
|
2096
|
+
return lstatSync(path);
|
|
2097
|
+
} catch {
|
|
2098
|
+
return null;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
var ROOT_SCOPES = [
|
|
2102
|
+
["tempRoot", "temp_root"],
|
|
2103
|
+
["cacheDir", "cache_root"],
|
|
2104
|
+
["workDir", "work_dir"]
|
|
2105
|
+
];
|
|
2106
|
+
var NAME_SCOPES = [
|
|
2107
|
+
[/\.partial/, "cache_partial"],
|
|
2108
|
+
[/^hfcache-/, "cache_entry"],
|
|
2109
|
+
[/^hyperframes-extract-cache/, "cache_root"],
|
|
2110
|
+
[/^(hf-render-|work-[0-9a-f]{8}-)/, "work_dir"]
|
|
2111
|
+
];
|
|
2112
|
+
function scopeOfGone(path, where, throughLink) {
|
|
2113
|
+
const root = ROOT_SCOPES.find(([key]) => {
|
|
2114
|
+
const dir = where[key];
|
|
2115
|
+
return !!dir && resolve4(path) === resolve4(dir);
|
|
2116
|
+
});
|
|
2117
|
+
if (root) return root[1];
|
|
2118
|
+
const name = basename2(path);
|
|
2119
|
+
return NAME_SCOPES.find(([pattern]) => pattern.test(name))?.[1] ?? (throughLink ? "link_target" : "other");
|
|
2120
|
+
}
|
|
2121
|
+
var MAX_LINK_HOPS = 4;
|
|
2122
|
+
function rootOf(path, where) {
|
|
2123
|
+
if (inside(path, where.tempRoot)) return "system_temp";
|
|
2124
|
+
if (where.cacheDir && inside(path, where.cacheDir)) return "cache_dir";
|
|
2125
|
+
return "other";
|
|
2126
|
+
}
|
|
2127
|
+
var ownerOf = (path, where) => [where.tempRoot, where.cacheDir, where.workDir].filter((root) => !!root && inside(path, root)).sort((a, b) => resolve4(a).length - resolve4(b).length)[0];
|
|
2128
|
+
var linkTarget = (link, folder) => resolve4(folder, readlinkSync(link).replace(/^\\\\\?\\/, ""));
|
|
2129
|
+
function goneAt(path, last, where, hops) {
|
|
2130
|
+
const scope = scopeOfGone(path, where, hops > 0);
|
|
2131
|
+
return last && scope === "other" ? "file" : scope;
|
|
2132
|
+
}
|
|
2133
|
+
function highestGone(path, where, hops = 0) {
|
|
2134
|
+
const root = ownerOf(path, where);
|
|
2135
|
+
if (!root || hops > MAX_LINK_HOPS) return "link_target";
|
|
2136
|
+
if (!existsSync4(root)) return scopeOfGone(root, where, hops > 0);
|
|
2137
|
+
const parts = relative2(resolve4(root), resolve4(path)).split(sep2).filter(Boolean);
|
|
2138
|
+
let at = resolve4(root);
|
|
2139
|
+
for (const [index, part] of parts.entries()) {
|
|
2140
|
+
const next = join3(at, part);
|
|
2141
|
+
const stat = lstatOrNull(next);
|
|
2142
|
+
if (!stat) return goneAt(next, index === parts.length - 1, where, hops);
|
|
2143
|
+
at = stat.isSymbolicLink() ? linkTarget(next, at) : next;
|
|
2144
|
+
const gone = at === next ? void 0 : highestGone(at, where, hops + 1);
|
|
2145
|
+
if (gone) return gone;
|
|
2146
|
+
}
|
|
2147
|
+
return void 0;
|
|
2148
|
+
}
|
|
2149
|
+
var isSpawnFailure = (error) => !!error?.syscall?.startsWith("spawn");
|
|
2150
|
+
function describeMissingPath(error, {
|
|
2151
|
+
cacheDir,
|
|
2152
|
+
workDir,
|
|
2153
|
+
tempRoot = tmpdir()
|
|
2154
|
+
} = {}) {
|
|
2155
|
+
try {
|
|
2156
|
+
const path = errnoMissingPathOf(error);
|
|
2157
|
+
if (!path || isSpawnFailure(error)) return void 0;
|
|
2158
|
+
const where = { tempRoot, cacheDir, workDir };
|
|
2159
|
+
return {
|
|
2160
|
+
scope: ownerOf(path, where) ? highestGone(path, where) ?? "other" : scopeOfGone(path, where, false),
|
|
2161
|
+
synced: SYNCED.test(path),
|
|
2162
|
+
root: rootOf(path, where)
|
|
2163
|
+
};
|
|
2164
|
+
} catch {
|
|
2165
|
+
return void 0;
|
|
2166
|
+
}
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2061
2169
|
// ../producer/src/services/render/renderEventPublisher.ts
|
|
2062
2170
|
var FLUSH_TIMEOUT_MS = 1e4;
|
|
2063
2171
|
function snapshotJob(job) {
|
|
@@ -2092,8 +2200,8 @@ var OrderedRenderEventPublisher = class {
|
|
|
2092
2200
|
let timer;
|
|
2093
2201
|
const drained = await Promise.race([
|
|
2094
2202
|
this.tail.then(() => true),
|
|
2095
|
-
new Promise((
|
|
2096
|
-
timer = setTimeout(() =>
|
|
2203
|
+
new Promise((resolve12) => {
|
|
2204
|
+
timer = setTimeout(() => resolve12(false), FLUSH_TIMEOUT_MS);
|
|
2097
2205
|
})
|
|
2098
2206
|
]);
|
|
2099
2207
|
clearTimeout(timer);
|
|
@@ -2176,21 +2284,21 @@ var RenderExecutionContext = class {
|
|
|
2176
2284
|
};
|
|
2177
2285
|
|
|
2178
2286
|
// ../producer/src/services/render/artifactTransaction.ts
|
|
2179
|
-
import { closeSync as closeSync2, existsSync as
|
|
2180
|
-
import { basename as
|
|
2287
|
+
import { closeSync as closeSync2, existsSync as existsSync6, fstatSync as fstatSync2, openSync as openSync2, readSync, readdirSync as readdirSync2, rmSync as rmSync3 } from "fs";
|
|
2288
|
+
import { basename as basename4, dirname as dirname4, extname as extname2, join as join5, resolve as resolve5 } from "path";
|
|
2181
2289
|
|
|
2182
2290
|
// ../producer/src/services/render/renderDirOwner.ts
|
|
2183
2291
|
import {
|
|
2184
|
-
existsSync as
|
|
2185
|
-
lstatSync,
|
|
2292
|
+
existsSync as existsSync5,
|
|
2293
|
+
lstatSync as lstatSync2,
|
|
2186
2294
|
readFileSync as readFileSync2,
|
|
2187
2295
|
readdirSync,
|
|
2188
|
-
readlinkSync,
|
|
2296
|
+
readlinkSync as readlinkSync2,
|
|
2189
2297
|
rmSync as rmSync2,
|
|
2190
2298
|
writeFileSync as writeFileSync2
|
|
2191
2299
|
} from "fs";
|
|
2192
2300
|
import { hostname, uptime } from "os";
|
|
2193
|
-
import { basename as
|
|
2301
|
+
import { basename as basename3, dirname as dirname3, join as join4 } from "path";
|
|
2194
2302
|
var OWNER_FILE = "owner.json";
|
|
2195
2303
|
var TRANSACTION_BACKUP = "backup";
|
|
2196
2304
|
var RENDER_JOB_DIR = /^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/;
|
|
@@ -2206,13 +2314,13 @@ function pidScope() {
|
|
|
2206
2314
|
host: hostname(),
|
|
2207
2315
|
// Without /proc (macOS, Windows) the boot time, to the minute, stands in for the boot id.
|
|
2208
2316
|
boot: attempt(() => readFileSync2("/proc/sys/kernel/random/boot_id", "utf-8").trim()) ?? attempt(() => String(Math.round(Date.now() / 6e4 - uptime() / 60))),
|
|
2209
|
-
pidns: attempt(() =>
|
|
2317
|
+
pidns: attempt(() => readlinkSync2("/proc/self/ns/pid"))
|
|
2210
2318
|
};
|
|
2211
2319
|
}
|
|
2212
2320
|
function createOwnedRenderDir(prefix) {
|
|
2213
|
-
const dir = createStagingDir(dirname3(prefix),
|
|
2321
|
+
const dir = createStagingDir(dirname3(prefix), basename3(prefix));
|
|
2214
2322
|
const owner = { pid: process.pid, ...pidScope() };
|
|
2215
|
-
writeFileSync2(
|
|
2323
|
+
writeFileSync2(join4(dir, OWNER_FILE), JSON.stringify(owner));
|
|
2216
2324
|
return dir;
|
|
2217
2325
|
}
|
|
2218
2326
|
function alive(pid) {
|
|
@@ -2235,7 +2343,7 @@ function inThisPidScope(owner) {
|
|
|
2235
2343
|
function ownerState(dir) {
|
|
2236
2344
|
let owner;
|
|
2237
2345
|
try {
|
|
2238
|
-
owner = JSON.parse(readFileSync2(
|
|
2346
|
+
owner = JSON.parse(readFileSync2(join4(dir, OWNER_FILE), "utf-8"));
|
|
2239
2347
|
} catch (error) {
|
|
2240
2348
|
return error.code === "ENOENT" ? "none" : "unknown";
|
|
2241
2349
|
}
|
|
@@ -2246,16 +2354,16 @@ function ownerState(dir) {
|
|
|
2246
2354
|
return alive(pid) ? "live" : "gone";
|
|
2247
2355
|
}
|
|
2248
2356
|
function newestWriteMs(path) {
|
|
2249
|
-
const stat =
|
|
2357
|
+
const stat = lstatSync2(path);
|
|
2250
2358
|
if (!stat.isDirectory()) return stat.mtimeMs;
|
|
2251
2359
|
return readdirSync(path).reduce(
|
|
2252
|
-
(newest, name) => Math.max(newest, newestWriteMs(
|
|
2360
|
+
(newest, name) => Math.max(newest, newestWriteMs(join4(path, name))),
|
|
2253
2361
|
stat.mtimeMs
|
|
2254
2362
|
);
|
|
2255
2363
|
}
|
|
2256
2364
|
function isAbandoned(dir, ownerlessIdleMs, now) {
|
|
2257
2365
|
try {
|
|
2258
|
-
if (!
|
|
2366
|
+
if (!lstatSync2(dir).isDirectory() || existsSync5(join4(dir, TRANSACTION_BACKUP))) return false;
|
|
2259
2367
|
const owner = ownerState(dir);
|
|
2260
2368
|
if (owner === "gone") return true;
|
|
2261
2369
|
return owner === "none" && ownerlessIdleMs !== void 0 && now - newestWriteMs(dir) >= ownerlessIdleMs;
|
|
@@ -2271,7 +2379,7 @@ function listAbandonedRenderDirs(parent, options = {}) {
|
|
|
2271
2379
|
return [];
|
|
2272
2380
|
}
|
|
2273
2381
|
const now = Date.now();
|
|
2274
|
-
return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) =>
|
|
2382
|
+
return names.filter((name) => (options.names ?? RENDER_TEMP_DIR).test(name)).map((name) => join4(parent, name)).filter((dir) => isAbandoned(dir, options.ownerlessIdleMs, now));
|
|
2275
2383
|
}
|
|
2276
2384
|
function createRenderWorkDir(prefix, outputDir) {
|
|
2277
2385
|
for (const parent of /* @__PURE__ */ new Set([outputDir, dirname3(prefix)])) {
|
|
@@ -2287,7 +2395,7 @@ function createRenderWorkDir(prefix, outputDir) {
|
|
|
2287
2395
|
|
|
2288
2396
|
// ../producer/src/services/render/artifactTransaction.ts
|
|
2289
2397
|
var defaultFileSystem = {
|
|
2290
|
-
existsSync:
|
|
2398
|
+
existsSync: existsSync6,
|
|
2291
2399
|
renameSync: (source, destination) => renameWithRetry(source, destination),
|
|
2292
2400
|
rmSync: rmSync3
|
|
2293
2401
|
};
|
|
@@ -2320,8 +2428,8 @@ function buildArtifactExpectation(input) {
|
|
|
2320
2428
|
function createSiblingTransactionDirectory(destination) {
|
|
2321
2429
|
const parent = dirname4(destination);
|
|
2322
2430
|
const extension = extname2(destination);
|
|
2323
|
-
const stem = extension ?
|
|
2324
|
-
return createOwnedRenderDir(
|
|
2431
|
+
const stem = extension ? basename4(destination, extension) : basename4(destination);
|
|
2432
|
+
return createOwnedRenderDir(join5(parent, `.${stem}.hf-transaction-`));
|
|
2325
2433
|
}
|
|
2326
2434
|
function assertReadableNonEmptyFile(path) {
|
|
2327
2435
|
const fd = openSync2(path, "r");
|
|
@@ -2339,7 +2447,7 @@ function collectDirectoryFiles(root) {
|
|
|
2339
2447
|
const files = [];
|
|
2340
2448
|
const visit = (directory) => {
|
|
2341
2449
|
for (const entry of readdirSync2(directory, { withFileTypes: true })) {
|
|
2342
|
-
const path =
|
|
2450
|
+
const path = join5(directory, entry.name);
|
|
2343
2451
|
if (entry.isDirectory()) visit(path);
|
|
2344
2452
|
else if (entry.isFile()) files.push(path);
|
|
2345
2453
|
}
|
|
@@ -2394,10 +2502,10 @@ var ArtifactTransaction = class {
|
|
|
2394
2502
|
this.kind = kind;
|
|
2395
2503
|
this.fileSystem = fileSystem;
|
|
2396
2504
|
this.logger = logger;
|
|
2397
|
-
this.destinationPath =
|
|
2505
|
+
this.destinationPath = resolve5(destinationPath);
|
|
2398
2506
|
this.transactionDirectory = createSiblingTransactionDirectory(this.destinationPath);
|
|
2399
|
-
this.stagingPath =
|
|
2400
|
-
this.backupPath =
|
|
2507
|
+
this.stagingPath = join5(this.transactionDirectory, basename4(this.destinationPath));
|
|
2508
|
+
this.backupPath = join5(this.transactionDirectory, TRANSACTION_BACKUP);
|
|
2401
2509
|
this.durationProbe = durationProbe;
|
|
2402
2510
|
}
|
|
2403
2511
|
kind;
|
|
@@ -2440,19 +2548,19 @@ var ArtifactTransaction = class {
|
|
|
2440
2548
|
*/
|
|
2441
2549
|
async assertDirectoryExpectation(expected, files) {
|
|
2442
2550
|
for (const required of expected.requiredFiles ?? []) {
|
|
2443
|
-
const path =
|
|
2444
|
-
if (!
|
|
2551
|
+
const path = join5(this.stagingPath, required);
|
|
2552
|
+
if (!existsSync6(path)) {
|
|
2445
2553
|
throw new Error(`Render artifact directory is missing ${required}: ${this.stagingPath}`);
|
|
2446
2554
|
}
|
|
2447
2555
|
assertReadableNonEmptyFile(path);
|
|
2448
2556
|
}
|
|
2449
2557
|
if (expected.probeTarget !== void 0) {
|
|
2450
|
-
await this.assertArtifactDuration(expected,
|
|
2558
|
+
await this.assertArtifactDuration(expected, join5(this.stagingPath, expected.probeTarget));
|
|
2451
2559
|
return;
|
|
2452
2560
|
}
|
|
2453
2561
|
if (expected.expectedFrames === void 0) return;
|
|
2454
2562
|
const frameCount = files.filter(
|
|
2455
|
-
(file) => dirname4(file) === this.stagingPath && /^frame_\d+\.png$/.test(
|
|
2563
|
+
(file) => dirname4(file) === this.stagingPath && /^frame_\d+\.png$/.test(basename4(file))
|
|
2456
2564
|
).length;
|
|
2457
2565
|
if (frameCount === 0) {
|
|
2458
2566
|
throw new Error(
|
|
@@ -2690,8 +2798,8 @@ function replanAfterFailure(plan2, failure) {
|
|
|
2690
2798
|
}
|
|
2691
2799
|
|
|
2692
2800
|
// ../producer/src/services/render/stages/captureSegmentedStage.ts
|
|
2693
|
-
import { existsSync as
|
|
2694
|
-
import { join as
|
|
2801
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3, rmSync as rmSync6, statSync as statSync3 } from "fs";
|
|
2802
|
+
import { join as join9 } from "path";
|
|
2695
2803
|
|
|
2696
2804
|
// ../producer/src/services/render/perfSummary.ts
|
|
2697
2805
|
import { arch, platform, totalmem } from "os";
|
|
@@ -3084,7 +3192,7 @@ function getCaptureStageBrowserConsole(error) {
|
|
|
3084
3192
|
|
|
3085
3193
|
// ../producer/src/services/hdrCompositor.ts
|
|
3086
3194
|
import { readSync as readSync2 } from "fs";
|
|
3087
|
-
import { join as
|
|
3195
|
+
import { join as join6 } from "path";
|
|
3088
3196
|
function countNonZeroAlpha(rgba) {
|
|
3089
3197
|
let n = 0;
|
|
3090
3198
|
for (let p = 3; p < rgba.length; p += 4) {
|
|
@@ -3511,7 +3619,7 @@ async function compositeHdrFrame(ctx, canvas, time, fullStacking, elementFilter,
|
|
|
3511
3619
|
if (shouldLog && debugDumpDir) {
|
|
3512
3620
|
const after = countNonZeroRgb48(canvas);
|
|
3513
3621
|
const dumpName = `frame_${String(debugFrameIndex).padStart(4, "0")}_layer_${String(layerIdx).padStart(2, "0")}_dom.png`;
|
|
3514
|
-
const dumpPath =
|
|
3622
|
+
const dumpPath = join6(debugDumpDir, dumpName);
|
|
3515
3623
|
writeFileExclusiveSync(dumpPath, domPng);
|
|
3516
3624
|
log.info("[diag] dom layer blit", {
|
|
3517
3625
|
frame: debugFrameIndex,
|
|
@@ -3550,7 +3658,7 @@ import { mkdirSync as mkdirSync2, readFileSync as readFileSync3, rmSync as rmSyn
|
|
|
3550
3658
|
|
|
3551
3659
|
// ../producer/src/services/hdrFrameWindows.ts
|
|
3552
3660
|
import { closeSync as closeSync3, constants as constants2, openSync as openSync3, rmSync as rmSync4 } from "fs";
|
|
3553
|
-
import { join as
|
|
3661
|
+
import { join as join7 } from "path";
|
|
3554
3662
|
function createHdrFrameWindows(opts) {
|
|
3555
3663
|
const { dir, frameSize, windowFrames, maxResident, extract } = opts;
|
|
3556
3664
|
let totalFrames = opts.totalFrames;
|
|
@@ -3574,7 +3682,7 @@ function createHdrFrameWindows(opts) {
|
|
|
3574
3682
|
const firstFrame = index * windowFrames;
|
|
3575
3683
|
const w = {
|
|
3576
3684
|
firstFrame,
|
|
3577
|
-
path:
|
|
3685
|
+
path: join7(dir, `window-${index}.rgb48le`),
|
|
3578
3686
|
frames: 0,
|
|
3579
3687
|
fd: -1,
|
|
3580
3688
|
pins: 0,
|
|
@@ -4373,8 +4481,8 @@ function isTargetLossError(error) {
|
|
|
4373
4481
|
|
|
4374
4482
|
// ../producer/src/services/render/stages/captureStreamingStage.ts
|
|
4375
4483
|
import { mkdtemp, writeFile } from "fs/promises";
|
|
4376
|
-
import { tmpdir } from "os";
|
|
4377
|
-
import { join as
|
|
4484
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
4485
|
+
import { join as join8 } from "path";
|
|
4378
4486
|
|
|
4379
4487
|
// ../producer/src/services/render/stallClock.ts
|
|
4380
4488
|
var SUSPEND_GAP_MS = 15e3;
|
|
@@ -4448,7 +4556,7 @@ var SequentialCaptureStallError = class extends Error {
|
|
|
4448
4556
|
}
|
|
4449
4557
|
};
|
|
4450
4558
|
function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
4451
|
-
return new Promise((
|
|
4559
|
+
return new Promise((resolve12, reject) => {
|
|
4452
4560
|
const clock = createStallClock();
|
|
4453
4561
|
const trip = () => reject(
|
|
4454
4562
|
signal?.aborted ? new Error(
|
|
@@ -4473,7 +4581,7 @@ function raceAgainstStall(promise, deadlineMs, input, signal) {
|
|
|
4473
4581
|
promise.then(
|
|
4474
4582
|
(value) => {
|
|
4475
4583
|
clearTimeout(timer);
|
|
4476
|
-
|
|
4584
|
+
resolve12(value);
|
|
4477
4585
|
},
|
|
4478
4586
|
(error) => {
|
|
4479
4587
|
clearTimeout(timer);
|
|
@@ -4577,11 +4685,11 @@ async function verifyDrawElementSample(session, idx, buf, ctx) {
|
|
|
4577
4685
|
return;
|
|
4578
4686
|
}
|
|
4579
4687
|
if (db < verifyMinDb) {
|
|
4580
|
-
const dumpDir = await mkdtemp(
|
|
4688
|
+
const dumpDir = await mkdtemp(join8(tmpdir2(), "hf-de-verify-fail-")).catch(() => null);
|
|
4581
4689
|
if (dumpDir) {
|
|
4582
4690
|
await Promise.all([
|
|
4583
|
-
writeFile(
|
|
4584
|
-
writeFile(
|
|
4691
|
+
writeFile(join8(dumpDir, `frame-${idx}-de.jpg`), buf),
|
|
4692
|
+
writeFile(join8(dumpDir, `frame-${idx}-truth.jpg`), truth)
|
|
4585
4693
|
]).catch(() => {
|
|
4586
4694
|
});
|
|
4587
4695
|
}
|
|
@@ -5152,7 +5260,7 @@ async function runCaptureStreamingStage(input) {
|
|
|
5152
5260
|
|
|
5153
5261
|
// ../producer/src/services/render/stages/captureSegmentedStage.ts
|
|
5154
5262
|
function segmentOutputPath(segmentDir, index) {
|
|
5155
|
-
return
|
|
5263
|
+
return join9(segmentDir, `segment_${String(index).padStart(5, "0")}.mp4`);
|
|
5156
5264
|
}
|
|
5157
5265
|
function segmentEncoderOptions(base, segment) {
|
|
5158
5266
|
return {
|
|
@@ -5251,7 +5359,7 @@ async function captureSegmentToEncoder(ctx, segment) {
|
|
|
5251
5359
|
path: segmentPath,
|
|
5252
5360
|
// Recorded so resume can prove the file on disk is the one that
|
|
5253
5361
|
// finished; absent only in unit tests, whose fake encoder writes none.
|
|
5254
|
-
bytes:
|
|
5362
|
+
bytes: existsSync7(segmentPath) ? statSync3(segmentPath).size : 0
|
|
5255
5363
|
});
|
|
5256
5364
|
return encodeResult;
|
|
5257
5365
|
} finally {
|
|
@@ -5485,7 +5593,7 @@ async function runCaptureSegmentedStage(input) {
|
|
|
5485
5593
|
const { log, dedupPerfs, assertNotAborted } = input;
|
|
5486
5594
|
const deps = { ...DEFAULT_DEPS, ...input.deps };
|
|
5487
5595
|
const segments = planSegments(input.totalFrames, input.segmentFrames);
|
|
5488
|
-
const segmentDir = input.segmentDir ??
|
|
5596
|
+
const segmentDir = input.segmentDir ?? join9(input.workDir, "segments");
|
|
5489
5597
|
mkdirSync3(segmentDir, { recursive: true });
|
|
5490
5598
|
const skip = input.completedSegments ?? /* @__PURE__ */ new Set();
|
|
5491
5599
|
const pending = segments.filter((s) => !skip.has(s.index));
|
|
@@ -5641,7 +5749,7 @@ function startRenderEtaGuard(options) {
|
|
|
5641
5749
|
}
|
|
5642
5750
|
|
|
5643
5751
|
// ../producer/src/services/render/captureCost.ts
|
|
5644
|
-
import { join as
|
|
5752
|
+
import { join as join10 } from "path";
|
|
5645
5753
|
var CAPTURE_CALIBRATION_TARGET_MS = 600;
|
|
5646
5754
|
var MAX_MEASURED_CAPTURE_COST_MULTIPLIER = 8;
|
|
5647
5755
|
var CAPTURE_CALIBRATION_PROTOCOL_TIMEOUT_MS = 3e4;
|
|
@@ -5885,7 +5993,7 @@ async function runCaptureCalibration(input) {
|
|
|
5885
5993
|
});
|
|
5886
5994
|
let calibration;
|
|
5887
5995
|
try {
|
|
5888
|
-
calibration = await runOneCalibration(
|
|
5996
|
+
calibration = await runOneCalibration(join10(workDir, "capture-calibration"), calibrationCfg);
|
|
5889
5997
|
} catch (error) {
|
|
5890
5998
|
const shouldFallback = !forceScreenshot && shouldFallbackToScreenshotAfterCalibrationError(error);
|
|
5891
5999
|
if (!shouldFallback) {
|
|
@@ -5919,7 +6027,7 @@ async function runCaptureCalibration(input) {
|
|
|
5919
6027
|
const screenshotCfg = createCaptureCalibrationConfig({ ...cfg, forceScreenshot: true });
|
|
5920
6028
|
try {
|
|
5921
6029
|
calibration = await runOneCalibration(
|
|
5922
|
-
|
|
6030
|
+
join10(workDir, "capture-calibration-screenshot"),
|
|
5923
6031
|
screenshotCfg
|
|
5924
6032
|
);
|
|
5925
6033
|
} catch (fallbackError) {
|
|
@@ -5984,7 +6092,7 @@ function checkPageNeverReady(input) {
|
|
|
5984
6092
|
|
|
5985
6093
|
// ../producer/src/services/render/deferredVideoFrames.ts
|
|
5986
6094
|
import { mkdirSync as mkdirSync4, rmSync as rmSync7 } from "fs";
|
|
5987
|
-
import { dirname as dirname5, join as
|
|
6095
|
+
import { dirname as dirname5, join as join11 } from "path";
|
|
5988
6096
|
function contiguousRuns(sortedIndexes) {
|
|
5989
6097
|
const runs2 = [];
|
|
5990
6098
|
for (const index of sortedIndexes) {
|
|
@@ -6023,7 +6131,7 @@ async function extractDeferredFrames(input) {
|
|
|
6023
6131
|
const shown = shownDeferredFrameIndexes(input, input.frames, input.fps);
|
|
6024
6132
|
return Promise.all(
|
|
6025
6133
|
deferred.map(async (video) => {
|
|
6026
|
-
const outputDir =
|
|
6134
|
+
const outputDir = join11(input.outputRoot, mediaIdPathSegment(video.videoId));
|
|
6027
6135
|
const indexes = [...shown.get(video.videoId) ?? []].sort((a, b) => a - b);
|
|
6028
6136
|
if (indexes.length === 0) {
|
|
6029
6137
|
return { ...video, outputDir, framePaths: /* @__PURE__ */ new Map(), ownedByLookup: false };
|
|
@@ -6166,9 +6274,9 @@ async function measureLocalShownBoxes(page, videos, fps, duration, log) {
|
|
|
6166
6274
|
|
|
6167
6275
|
// ../producer/src/services/render/segmentVideoFrames.ts
|
|
6168
6276
|
import { mkdirSync as mkdirSync5, rmSync as rmSync8 } from "fs";
|
|
6169
|
-
import { join as
|
|
6277
|
+
import { join as join12 } from "path";
|
|
6170
6278
|
function segmentFramesDir(rootDir, index) {
|
|
6171
|
-
return
|
|
6279
|
+
return join12(rootDir, "segment-frames", `segment_${String(index).padStart(5, "0")}`);
|
|
6172
6280
|
}
|
|
6173
6281
|
function createSegmentVideoFrames(input) {
|
|
6174
6282
|
const extractFrames = input.extractFrames ?? extractDeferredFrames;
|
|
@@ -6199,7 +6307,7 @@ function createSegmentVideoFrames(input) {
|
|
|
6199
6307
|
let onDemandCalls = 0;
|
|
6200
6308
|
const onDemandHook = () => Object.assign(
|
|
6201
6309
|
async (page, time, heldVideoTime) => {
|
|
6202
|
-
const dir =
|
|
6310
|
+
const dir = join12(
|
|
6203
6311
|
input.rootDir,
|
|
6204
6312
|
"segment-frames",
|
|
6205
6313
|
`on-demand_${String(onDemandCalls++).padStart(5, "0")}`
|
|
@@ -6216,7 +6324,7 @@ function createSegmentVideoFrames(input) {
|
|
|
6216
6324
|
);
|
|
6217
6325
|
return {
|
|
6218
6326
|
async forFrames(frames, name) {
|
|
6219
|
-
const dir =
|
|
6327
|
+
const dir = join12(input.rootDir, "segment-frames", name);
|
|
6220
6328
|
const release = () => rmSync8(dir, { recursive: true, force: true });
|
|
6221
6329
|
try {
|
|
6222
6330
|
release();
|
|
@@ -6269,7 +6377,7 @@ function createSegmentVideoFrames(input) {
|
|
|
6269
6377
|
|
|
6270
6378
|
// ../producer/src/services/render/videoFrameWindow.ts
|
|
6271
6379
|
import { readdirSync as readdirSync3, statSync as statSync4 } from "fs";
|
|
6272
|
-
import { join as
|
|
6380
|
+
import { join as join13 } from "path";
|
|
6273
6381
|
function shouldWindowVideoFrames(args) {
|
|
6274
6382
|
return args.segmented && args.env.HF_VIDEO_FRAME_WINDOW?.trim().toLowerCase() === "true";
|
|
6275
6383
|
}
|
|
@@ -6282,7 +6390,7 @@ function directoryBytes(path) {
|
|
|
6282
6390
|
return 0;
|
|
6283
6391
|
}
|
|
6284
6392
|
for (const entry of entries) {
|
|
6285
|
-
const child2 =
|
|
6393
|
+
const child2 = join13(path, entry.name);
|
|
6286
6394
|
try {
|
|
6287
6395
|
bytes += entry.isDirectory() ? directoryBytes(child2) : statSync4(child2).size;
|
|
6288
6396
|
} catch {
|
|
@@ -6300,7 +6408,7 @@ function trackSegmentFramePeak(frames, rootDir, onPeak) {
|
|
|
6300
6408
|
...worker,
|
|
6301
6409
|
async prepare(segment) {
|
|
6302
6410
|
await worker.prepare(segment);
|
|
6303
|
-
const held = directoryBytes(
|
|
6411
|
+
const held = directoryBytes(join13(rootDir, "segment-frames"));
|
|
6304
6412
|
if (held > peak) {
|
|
6305
6413
|
peak = held;
|
|
6306
6414
|
onPeak(peak);
|
|
@@ -6313,8 +6421,8 @@ function trackSegmentFramePeak(frames, rootDir, onPeak) {
|
|
|
6313
6421
|
|
|
6314
6422
|
// ../producer/src/services/render/segmentManifest.ts
|
|
6315
6423
|
import { createHash as createHash2 } from "crypto";
|
|
6316
|
-
import { existsSync as
|
|
6317
|
-
import { join as
|
|
6424
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync6, readFileSync as readFileSync4, statSync as statSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
6425
|
+
import { join as join14 } from "path";
|
|
6318
6426
|
var MANIFEST_FILENAME = "segments.json";
|
|
6319
6427
|
function computeSegmentPlanHash(input) {
|
|
6320
6428
|
const ordered = [
|
|
@@ -6341,7 +6449,7 @@ function computeSegmentPlanHash(input) {
|
|
|
6341
6449
|
return createHash2("sha256").update(ordered.join(" ")).digest("hex").slice(0, 16);
|
|
6342
6450
|
}
|
|
6343
6451
|
function segmentDirFor(projectRendersDir, planHash) {
|
|
6344
|
-
return
|
|
6452
|
+
return join14(projectRendersDir, ".hf-segments", planHash);
|
|
6345
6453
|
}
|
|
6346
6454
|
function hasNumber(value, key) {
|
|
6347
6455
|
return key in value && typeof Reflect.get(value, key) === "number";
|
|
@@ -6359,8 +6467,8 @@ function isManifest(value) {
|
|
|
6359
6467
|
return Reflect.get(value, "version") === 1 && hasString(value, "planHash") && hasNumber(value, "totalFrames") && hasNumber(value, "segmentFrames") && Array.isArray(completed) && completed.every(isEntry);
|
|
6360
6468
|
}
|
|
6361
6469
|
function readSegmentManifest(segmentDir) {
|
|
6362
|
-
const path =
|
|
6363
|
-
if (!
|
|
6470
|
+
const path = join14(segmentDir, MANIFEST_FILENAME);
|
|
6471
|
+
if (!existsSync8(path)) return null;
|
|
6364
6472
|
try {
|
|
6365
6473
|
const parsed = JSON.parse(readFileSync4(path, "utf-8"));
|
|
6366
6474
|
return isManifest(parsed) ? parsed : null;
|
|
@@ -6370,9 +6478,9 @@ function readSegmentManifest(segmentDir) {
|
|
|
6370
6478
|
}
|
|
6371
6479
|
function writeSegmentManifest(segmentDir, manifest) {
|
|
6372
6480
|
mkdirSync6(segmentDir, { recursive: true });
|
|
6373
|
-
const tmp =
|
|
6481
|
+
const tmp = join14(segmentDir, `${MANIFEST_FILENAME}.${process.pid}.tmp`);
|
|
6374
6482
|
writeFileSync3(tmp, JSON.stringify(manifest, null, 2), "utf-8");
|
|
6375
|
-
renameWithRetry(tmp,
|
|
6483
|
+
renameWithRetry(tmp, join14(segmentDir, MANIFEST_FILENAME));
|
|
6376
6484
|
}
|
|
6377
6485
|
async function probeSegmentFrameCount(path, probe) {
|
|
6378
6486
|
try {
|
|
@@ -6389,7 +6497,7 @@ async function validateCompletedSegments(manifest, expectedHash, probeFrames) {
|
|
|
6389
6497
|
const ok = /* @__PURE__ */ new Set();
|
|
6390
6498
|
if (manifest.planHash !== expectedHash) return ok;
|
|
6391
6499
|
for (const entry of manifest.completed) {
|
|
6392
|
-
if (!
|
|
6500
|
+
if (!existsSync8(entry.path)) continue;
|
|
6393
6501
|
const size = statSync5(entry.path).size;
|
|
6394
6502
|
if (size <= 0 || size !== entry.bytes) continue;
|
|
6395
6503
|
const frames = await probeFrames(entry.path);
|
|
@@ -6973,8 +7081,8 @@ function requireOutputDimensions(expected, width, height) {
|
|
|
6973
7081
|
}
|
|
6974
7082
|
|
|
6975
7083
|
// ../producer/src/services/render/stages/compileStage.ts
|
|
6976
|
-
import { existsSync as
|
|
6977
|
-
import { join as
|
|
7084
|
+
import { existsSync as existsSync12, writeFileSync as writeFileSync4 } from "fs";
|
|
7085
|
+
import { join as join18, relative as relative4 } from "path";
|
|
6978
7086
|
|
|
6979
7087
|
// ../producer/src/services/compositionSizeLimit.ts
|
|
6980
7088
|
import { statSync as statSync6 } from "fs";
|
|
@@ -7000,6 +7108,8 @@ var fileTooLarge = (file, bytes) => new CompositionTooLargeError(
|
|
|
7000
7108
|
{ bytes, limitBytes: MAX_COMPOSITION_HTML_BYTES }
|
|
7001
7109
|
);
|
|
7002
7110
|
var limitText = `One render generates at most ${megabytes(MAX_EXPANDED_COMPOSITION_BYTES)}`;
|
|
7111
|
+
var REMOTE_SCRIPTS = "remote scripts";
|
|
7112
|
+
var REMOTE_STYLESHEETS = "remote stylesheets";
|
|
7003
7113
|
function generatedTooLarge(file, bytes) {
|
|
7004
7114
|
if (file === "composition variables") {
|
|
7005
7115
|
return `Composition variable styles add up to ${megabytes(bytes)}. ${limitText}. Shorten the variable values or declare them on fewer elements.`;
|
|
@@ -7007,6 +7117,9 @@ function generatedTooLarge(file, bytes) {
|
|
|
7007
7117
|
if (file === "variable media sources") {
|
|
7008
7118
|
return `Variable-bound media sources add up to ${megabytes(bytes)}. ${limitText}. Use shorter URLs or bind fewer elements.`;
|
|
7009
7119
|
}
|
|
7120
|
+
if (file === REMOTE_SCRIPTS || file === REMOTE_STYLESHEETS) {
|
|
7121
|
+
return `Inlined ${file} add up to ${megabytes(bytes)}. ${limitText}. Bundle scripts and fonts with the project, or link each one once.`;
|
|
7122
|
+
}
|
|
7010
7123
|
return `Scripts, styles and rebased asset paths generated for compositions, ending at "${file}", add up to ${megabytes(bytes)}. One render generates at most ${megabytes(MAX_EXPANDED_COMPOSITION_BYTES)} for its mounts. Merge small inline scripts and style rules, keep data-composition-id values short, or mount scenes fewer times.`;
|
|
7011
7124
|
}
|
|
7012
7125
|
var CompositionExpansionBudget = class {
|
|
@@ -7059,18 +7172,18 @@ function assertCompositionFileSize(path, file) {
|
|
|
7059
7172
|
|
|
7060
7173
|
// ../producer/src/services/htmlCompiler.ts
|
|
7061
7174
|
import { createHash as createHash4 } from "crypto";
|
|
7062
|
-
import { createReadStream as createReadStream2, existsSync as
|
|
7063
|
-
import { join as
|
|
7175
|
+
import { createReadStream as createReadStream2, existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync6 } from "fs";
|
|
7176
|
+
import { join as join17, dirname as dirname7, resolve as resolve6, basename as basename5, relative as relative3, sep as sep3 } from "path";
|
|
7064
7177
|
|
|
7065
7178
|
// ../producer/src/services/bundledScripts.ts
|
|
7066
|
-
import { existsSync as
|
|
7067
|
-
import { join as
|
|
7179
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
|
|
7180
|
+
import { join as join15 } from "path";
|
|
7068
7181
|
var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
|
|
7069
7182
|
function bundledScript(url) {
|
|
7070
7183
|
const dir = process.env[GSAP_VENDOR_DIR_ENV];
|
|
7071
7184
|
if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
|
|
7072
|
-
const file =
|
|
7073
|
-
return
|
|
7185
|
+
const file = join15(dir, "gsap.min.js");
|
|
7186
|
+
return existsSync9(file) ? readFileSync5(file) : null;
|
|
7074
7187
|
}
|
|
7075
7188
|
|
|
7076
7189
|
// ../producer/src/services/renderMediaCollector.ts
|
|
@@ -7220,8 +7333,8 @@ function getPositionEditsRenderScript() {
|
|
|
7220
7333
|
}
|
|
7221
7334
|
|
|
7222
7335
|
// ../producer/src/services/assetMediaType.ts
|
|
7223
|
-
import { existsSync as
|
|
7224
|
-
import { dirname as dirname6, join as
|
|
7336
|
+
import { existsSync as existsSync10 } from "fs";
|
|
7337
|
+
import { dirname as dirname6, join as join16 } from "path";
|
|
7225
7338
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
7226
7339
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
7227
7340
|
// fallow-ignore-next-line unused-class-member
|
|
@@ -7262,11 +7375,11 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
7262
7375
|
]);
|
|
7263
7376
|
}
|
|
7264
7377
|
function mediaAssetRoots(projectDir, compiledDir) {
|
|
7265
|
-
return [projectDir, compiledDir,
|
|
7378
|
+
return [projectDir, compiledDir, join16(dirname6(compiledDir), "downloads")];
|
|
7266
7379
|
}
|
|
7267
7380
|
function dropMediaOutsideProject(input) {
|
|
7268
7381
|
const { projectDir, workDir, composition, log } = input;
|
|
7269
|
-
const compiledDir =
|
|
7382
|
+
const compiledDir = join16(workDir, "compiled");
|
|
7270
7383
|
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
7271
7384
|
const staysInside = ({ id, src }) => {
|
|
7272
7385
|
if (!src || isHttpUrl(src)) return true;
|
|
@@ -7321,7 +7434,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7321
7434
|
input.projectDir,
|
|
7322
7435
|
input.compiledDir
|
|
7323
7436
|
);
|
|
7324
|
-
if (!
|
|
7437
|
+
if (!existsSync10(resolvedPath)) continue;
|
|
7325
7438
|
byPath.set(resolvedPath, [...byPath.get(resolvedPath) ?? [], reference]);
|
|
7326
7439
|
}
|
|
7327
7440
|
const mismatches = [];
|
|
@@ -7412,7 +7525,7 @@ function normalizeCompositionSrcs(html, projectDir) {
|
|
|
7412
7525
|
if (!value.includes("%") && !/^\.?[\\/]/.test(value)) return whole;
|
|
7413
7526
|
const file = resolveCompositionSrc(projectDir, value);
|
|
7414
7527
|
if (file === null) return whole;
|
|
7415
|
-
return `${name}${quote}${
|
|
7528
|
+
return `${name}${quote}${relative3(projectDir, file).split(sep3).join("/")}${quote}`;
|
|
7416
7529
|
});
|
|
7417
7530
|
}
|
|
7418
7531
|
var COMPOSITION_FILE = /\.html?$/i;
|
|
@@ -7617,8 +7730,8 @@ function detectShaderTransitionUsage(html) {
|
|
|
7617
7730
|
async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
7618
7731
|
let filePath = src;
|
|
7619
7732
|
if (isHttpUrl(src)) {
|
|
7620
|
-
const remoteDir =
|
|
7621
|
-
if (!
|
|
7733
|
+
const remoteDir = join17(downloadDir, REMOTE_MEDIA_SUBDIR);
|
|
7734
|
+
if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
|
|
7622
7735
|
try {
|
|
7623
7736
|
filePath = await downloadToTemp(src, remoteDir, void 0, void 0, void 0, {
|
|
7624
7737
|
onTelemetry: logRemoteDownloadTelemetry
|
|
@@ -7628,7 +7741,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
7628
7741
|
}
|
|
7629
7742
|
} else {
|
|
7630
7743
|
filePath = decodedUrlPath(src);
|
|
7631
|
-
if (!filePath.startsWith("/")) filePath =
|
|
7744
|
+
if (!filePath.startsWith("/")) filePath = join17(baseDir, filePath);
|
|
7632
7745
|
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots(filePath, [projectDir, downloadDir])) {
|
|
7633
7746
|
return { duration: null, resolvedPath: filePath };
|
|
7634
7747
|
}
|
|
@@ -7637,7 +7750,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
7637
7750
|
return { duration: null, resolvedPath: filePath };
|
|
7638
7751
|
}
|
|
7639
7752
|
}
|
|
7640
|
-
if (!isHttpUrl(filePath) && !
|
|
7753
|
+
if (!isHttpUrl(filePath) && !existsSync11(filePath)) {
|
|
7641
7754
|
return { duration: null, resolvedPath: filePath };
|
|
7642
7755
|
}
|
|
7643
7756
|
const withSrcContext = (error) => {
|
|
@@ -8007,7 +8120,7 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
8007
8120
|
parseHostVariables: parseHostVariableValues,
|
|
8008
8121
|
resolveFilePath: (srcPath) => {
|
|
8009
8122
|
const file = resolveCompositionFile(projectDir, srcPath, assetRoot);
|
|
8010
|
-
return file &&
|
|
8123
|
+
return file && relative3(projectDir, file).split(sep3).join("/");
|
|
8011
8124
|
},
|
|
8012
8125
|
resolveHtml: (srcPath) => {
|
|
8013
8126
|
const compHtml = resolveMountHtml(srcPath);
|
|
@@ -8171,7 +8284,8 @@ async function downloadScript(src, mirror) {
|
|
|
8171
8284
|
}
|
|
8172
8285
|
return fetchPublicHttpsBytes(src, { maxBytes: MAX_SCRIPT_BYTES, timeoutMs: 15e3 });
|
|
8173
8286
|
}
|
|
8174
|
-
|
|
8287
|
+
var MAX_CONCURRENT_SCRIPT_FETCHES = 4;
|
|
8288
|
+
async function inlineExternalScripts(html, budget = new CompositionExpansionBudget()) {
|
|
8175
8289
|
const fullHtml = ensureFullDocument(html);
|
|
8176
8290
|
const wrappedFragment = fullHtml !== html;
|
|
8177
8291
|
const { document: document2 } = parseHTML(fullHtml);
|
|
@@ -8185,20 +8299,52 @@ async function inlineExternalScripts(html) {
|
|
|
8185
8299
|
}
|
|
8186
8300
|
if (externalScripts.length === 0) return html;
|
|
8187
8301
|
const mirror = operatorGsapMirror();
|
|
8302
|
+
const limit = createConcurrencyLimit(MAX_CONCURRENT_SCRIPT_FETCHES);
|
|
8303
|
+
const stop = new AbortController();
|
|
8304
|
+
const fail = (error) => {
|
|
8305
|
+
stop.abort(error);
|
|
8306
|
+
throw error;
|
|
8307
|
+
};
|
|
8308
|
+
const charge = (bytes) => {
|
|
8309
|
+
try {
|
|
8310
|
+
budget.chargeGenerated(REMOTE_SCRIPTS, bytes);
|
|
8311
|
+
} catch (error) {
|
|
8312
|
+
fail(error);
|
|
8313
|
+
}
|
|
8314
|
+
};
|
|
8315
|
+
const fetches = /* @__PURE__ */ new Map();
|
|
8316
|
+
const fetchOnce = (src) => {
|
|
8317
|
+
let bytes = fetches.get(src);
|
|
8318
|
+
if (!bytes) {
|
|
8319
|
+
bytes = limit(async () => {
|
|
8320
|
+
if (stop.signal.aborted) throw stop.signal.reason;
|
|
8321
|
+
const downloaded = await downloadScript(src, mirror);
|
|
8322
|
+
charge(downloaded.byteLength);
|
|
8323
|
+
return downloaded;
|
|
8324
|
+
}, stop.signal);
|
|
8325
|
+
fetches.set(src, bytes);
|
|
8326
|
+
}
|
|
8327
|
+
return bytes;
|
|
8328
|
+
};
|
|
8329
|
+
const placed = /* @__PURE__ */ new Set();
|
|
8188
8330
|
const downloads = await Promise.allSettled(
|
|
8189
8331
|
externalScripts.map(async ({ el, src }) => {
|
|
8190
8332
|
const integrity = el.getAttribute("integrity") || "";
|
|
8191
|
-
|
|
8192
|
-
if (
|
|
8193
|
-
|
|
8194
|
-
}
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8333
|
+
let bytes = bundledScript(src);
|
|
8334
|
+
if (bytes && matchesScriptIntegrity(bytes, integrity)) {
|
|
8335
|
+
charge(bytes.byteLength);
|
|
8336
|
+
} else {
|
|
8337
|
+
bytes = await fetchOnce(src);
|
|
8338
|
+
if (!matchesScriptIntegrity(bytes, integrity)) {
|
|
8339
|
+
fail(new ScriptIntegrityError(`Subresource integrity mismatch for ${src}`));
|
|
8340
|
+
}
|
|
8341
|
+
if (placed.has(src)) charge(bytes.byteLength);
|
|
8342
|
+
placed.add(src);
|
|
8198
8343
|
}
|
|
8199
8344
|
return { src, text: new TextDecoder().decode(bytes) };
|
|
8200
8345
|
})
|
|
8201
8346
|
);
|
|
8347
|
+
if (stop.signal.aborted) throw stop.signal.reason;
|
|
8202
8348
|
for (let i = 0; i < downloads.length; i++) {
|
|
8203
8349
|
const download = downloads[i];
|
|
8204
8350
|
const { el, src } = externalScripts[i];
|
|
@@ -8225,18 +8371,18 @@ ${safeText}
|
|
|
8225
8371
|
return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
|
|
8226
8372
|
}
|
|
8227
8373
|
function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html", policy = {}) {
|
|
8228
|
-
const absProjectDir =
|
|
8374
|
+
const absProjectDir = resolve6(projectDir);
|
|
8229
8375
|
const externalAssets = /* @__PURE__ */ new Map();
|
|
8230
8376
|
const leftOut = /* @__PURE__ */ new Set();
|
|
8231
8377
|
function processPath(rawPath) {
|
|
8232
8378
|
const trimmed = rawPath.trim();
|
|
8233
8379
|
if (isNonRelativeUrl(trimmed)) return null;
|
|
8234
|
-
const absPath =
|
|
8380
|
+
const absPath = resolve6(absProjectDir, trimmed);
|
|
8235
8381
|
if (isPathInside(absPath, absProjectDir)) {
|
|
8236
8382
|
return null;
|
|
8237
8383
|
}
|
|
8238
8384
|
const onShare = namesAnotherNetworkRoot(absProjectDir, absPath);
|
|
8239
|
-
if (!onShare && !
|
|
8385
|
+
if (!onShare && !existsSync11(absPath)) return null;
|
|
8240
8386
|
const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath, policy);
|
|
8241
8387
|
if (refusal) {
|
|
8242
8388
|
if (!leftOut.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
|
|
@@ -8289,7 +8435,7 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
|
|
|
8289
8435
|
var REMOTE_MEDIA_SUBDIR = "_remote_media";
|
|
8290
8436
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
|
|
8291
8437
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
8292
|
-
if (!
|
|
8438
|
+
if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
|
|
8293
8439
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
8294
8440
|
await Promise.all(
|
|
8295
8441
|
[...urlSet].map(async (url) => {
|
|
@@ -8312,7 +8458,7 @@ async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLab
|
|
|
8312
8458
|
const remoteMediaAssets = /* @__PURE__ */ new Map();
|
|
8313
8459
|
const urlToRelPath = /* @__PURE__ */ new Map();
|
|
8314
8460
|
for (const [url, absPath] of urlToLocal) {
|
|
8315
|
-
const relPath = `${REMOTE_MEDIA_SUBDIR}/${
|
|
8461
|
+
const relPath = `${REMOTE_MEDIA_SUBDIR}/${basename5(absPath)}`;
|
|
8316
8462
|
remoteMediaAssets.set(relPath, absPath);
|
|
8317
8463
|
urlToRelPath.set(url, relPath);
|
|
8318
8464
|
}
|
|
@@ -8329,7 +8475,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
8329
8475
|
const localized = await downloadAndRewriteUrls(
|
|
8330
8476
|
urlSet,
|
|
8331
8477
|
html,
|
|
8332
|
-
|
|
8478
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8333
8479
|
"Remote media download failed",
|
|
8334
8480
|
"Localized remote media source(s)"
|
|
8335
8481
|
);
|
|
@@ -8352,7 +8498,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
|
|
|
8352
8498
|
return downloadAndRewriteUrls(
|
|
8353
8499
|
urlSet,
|
|
8354
8500
|
html,
|
|
8355
|
-
|
|
8501
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8356
8502
|
"Remote image download failed",
|
|
8357
8503
|
"Localized remote image source(s)"
|
|
8358
8504
|
);
|
|
@@ -8365,7 +8511,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
|
|
|
8365
8511
|
return downloadAndRewriteUrls(
|
|
8366
8512
|
urlSet,
|
|
8367
8513
|
html,
|
|
8368
|
-
|
|
8514
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8369
8515
|
"Remote background-image download failed",
|
|
8370
8516
|
"Localized remote background-image(s)",
|
|
8371
8517
|
// Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
|
|
@@ -8422,48 +8568,50 @@ function matchingBraces(css) {
|
|
|
8422
8568
|
}
|
|
8423
8569
|
return closes;
|
|
8424
8570
|
}
|
|
8425
|
-
|
|
8426
|
-
const
|
|
8427
|
-
|
|
8571
|
+
function remoteFontStylesheetHref(tag) {
|
|
8572
|
+
const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
|
|
8573
|
+
if (!href || !/^https?:\/\//i.test(href) || isGoogleFontsUrl(href)) return void 0;
|
|
8574
|
+
return href;
|
|
8575
|
+
}
|
|
8576
|
+
async function inlineExternalFontStylesheets(html, budget = new CompositionExpansionBudget()) {
|
|
8577
|
+
const hrefs = /* @__PURE__ */ new Set();
|
|
8428
8578
|
for (const { parts } of stylesheetLinkMatches(html)) {
|
|
8429
|
-
const
|
|
8430
|
-
|
|
8431
|
-
if (!hrefMatch?.[1]) continue;
|
|
8432
|
-
const href = hrefMatch[1];
|
|
8433
|
-
if (!/^https?:\/\//i.test(href)) continue;
|
|
8434
|
-
if (isGoogleFontsUrl(href)) continue;
|
|
8435
|
-
linkMatches.push({ fullMatch: tag, href });
|
|
8436
|
-
}
|
|
8437
|
-
if (linkMatches.length === 0) return html;
|
|
8438
|
-
const MAX_CONCURRENT_STYLESHEET_FETCHES = 4;
|
|
8439
|
-
const fetches = [];
|
|
8440
|
-
for (let i = 0; i < linkMatches.length; i += MAX_CONCURRENT_STYLESHEET_FETCHES) {
|
|
8441
|
-
const batch = linkMatches.slice(i, i + MAX_CONCURRENT_STYLESHEET_FETCHES);
|
|
8442
|
-
const results = await Promise.all(
|
|
8443
|
-
batch.map(async ({ fullMatch, href }) => {
|
|
8444
|
-
const css = await fetchExternalStylesheetCss(href);
|
|
8445
|
-
return { fullMatch, href, css };
|
|
8446
|
-
})
|
|
8447
|
-
);
|
|
8448
|
-
fetches.push(...results);
|
|
8579
|
+
const href = remoteFontStylesheetHref(parts[0]);
|
|
8580
|
+
if (href) hrefs.add(href);
|
|
8449
8581
|
}
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
const
|
|
8456
|
-
const
|
|
8582
|
+
if (hrefs.size === 0) return html;
|
|
8583
|
+
const MAX_CONCURRENT_STYLESHEET_FETCHES = 4;
|
|
8584
|
+
const inlineByHref = /* @__PURE__ */ new Map();
|
|
8585
|
+
const unique = [...hrefs];
|
|
8586
|
+
for (let i = 0; i < unique.length; i += MAX_CONCURRENT_STYLESHEET_FETCHES) {
|
|
8587
|
+
const batch = unique.slice(i, i + MAX_CONCURRENT_STYLESHEET_FETCHES);
|
|
8588
|
+
const sheets = await Promise.all(batch.map(fetchExternalStylesheetCss));
|
|
8589
|
+
batch.forEach((href, index) => {
|
|
8590
|
+
const css = sheets[index];
|
|
8591
|
+
const fontFaceBlocks = css ? extractFontFaceBlocks(css) : [];
|
|
8592
|
+
if (fontFaceBlocks.length === 0) return;
|
|
8593
|
+
const inlineStyle = `<style>/* Inlined external font stylesheet */
|
|
8457
8594
|
${fontFaceBlocks.join("\n")}
|
|
8458
8595
|
</style>`;
|
|
8459
|
-
|
|
8460
|
-
|
|
8461
|
-
|
|
8462
|
-
|
|
8463
|
-
|
|
8596
|
+
budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
8597
|
+
inlineByHref.set(href, inlineStyle);
|
|
8598
|
+
const identity = safeDownloadUrlIdentity(href);
|
|
8599
|
+
defaultLogger.debug("[Compiler] Inlined external @font-face rule(s)", {
|
|
8600
|
+
count: fontFaceBlocks.length,
|
|
8601
|
+
urlFingerprint: identity.urlFingerprint,
|
|
8602
|
+
host: identity.host
|
|
8603
|
+
});
|
|
8464
8604
|
});
|
|
8465
8605
|
}
|
|
8466
|
-
|
|
8606
|
+
const placed = /* @__PURE__ */ new Set();
|
|
8607
|
+
return replaceMatches(html, stylesheetLinkMatches(html), (tag) => {
|
|
8608
|
+
const href = remoteFontStylesheetHref(tag);
|
|
8609
|
+
const inlineStyle = href ? inlineByHref.get(href) : void 0;
|
|
8610
|
+
if (!href || !inlineStyle) return tag;
|
|
8611
|
+
if (placed.has(href)) budget.chargeGenerated(REMOTE_STYLESHEETS, inlineStyle.length);
|
|
8612
|
+
placed.add(href);
|
|
8613
|
+
return inlineStyle;
|
|
8614
|
+
});
|
|
8467
8615
|
}
|
|
8468
8616
|
function projectStylesheetFontFamilies(html, projectDir) {
|
|
8469
8617
|
const families = [];
|
|
@@ -8472,14 +8620,14 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
8472
8620
|
} of stylesheetLinkMatches(html)) {
|
|
8473
8621
|
const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
|
|
8474
8622
|
if (!href || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(href)) continue;
|
|
8475
|
-
const sheet =
|
|
8476
|
-
if (!isPathInside(sheet, projectDir) || !
|
|
8623
|
+
const sheet = resolve6(projectDir, decodedUrlPath(href).replace(/^(?:\.?\/)+/, ""));
|
|
8624
|
+
if (!isPathInside(sheet, projectDir) || !existsSync11(sheet)) continue;
|
|
8477
8625
|
for (const face of extractFontFaceBlocks(readFileSync6(sheet, "utf8"))) {
|
|
8478
8626
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
8479
8627
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
8480
8628
|
const path = decodedUrlPath(url);
|
|
8481
|
-
const file = path.startsWith("/") ?
|
|
8482
|
-
return isPathInside(file, projectDir) &&
|
|
8629
|
+
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(dirname7(sheet), path);
|
|
8630
|
+
return isPathInside(file, projectDir) && existsSync11(file);
|
|
8483
8631
|
});
|
|
8484
8632
|
if (family && shipsFile) families.push(family);
|
|
8485
8633
|
}
|
|
@@ -8519,7 +8667,7 @@ function localizeFontFaceUrls(html, downloadDir) {
|
|
|
8519
8667
|
return downloadAndRewriteUrls(
|
|
8520
8668
|
collectFontFaceUrls(html),
|
|
8521
8669
|
html,
|
|
8522
|
-
|
|
8670
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8523
8671
|
"Remote font download failed",
|
|
8524
8672
|
"Localized remote font face(s)",
|
|
8525
8673
|
(h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
|
|
@@ -8540,7 +8688,7 @@ async function readLocalFont(absPath) {
|
|
|
8540
8688
|
return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
|
|
8541
8689
|
}
|
|
8542
8690
|
async function localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsolutePath, log) {
|
|
8543
|
-
const absPath = localPath.startsWith("/") ? localPath :
|
|
8691
|
+
const absPath = localPath.startsWith("/") ? localPath : resolve6(projectDir, localPath);
|
|
8544
8692
|
if (!isPathInside(absPath, projectDir) || escapesAssetRoot(absPath, assetRoot)) return void 0;
|
|
8545
8693
|
if (refusesOutsideLink(projectDir, absPath, (line) => log.warn(`[Compiler] ${line}`))) {
|
|
8546
8694
|
return void 0;
|
|
@@ -8630,8 +8778,8 @@ function renderGsapDist() {
|
|
|
8630
8778
|
function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
|
|
8631
8779
|
let gsapDist;
|
|
8632
8780
|
const exists = (path) => {
|
|
8633
|
-
const file =
|
|
8634
|
-
return !namesAnotherNetworkRoot(projectDir, file) &&
|
|
8781
|
+
const file = resolve6(projectDir, path);
|
|
8782
|
+
return !namesAnotherNetworkRoot(projectDir, file) && existsSync11(file);
|
|
8635
8783
|
};
|
|
8636
8784
|
return replaceGsapDistScripts(html, (full, prefix, src, file, suffix) => {
|
|
8637
8785
|
if (/^https?:\/\//i.test(src)) return full;
|
|
@@ -8643,7 +8791,7 @@ function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
|
|
|
8643
8791
|
}
|
|
8644
8792
|
function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath, budget) {
|
|
8645
8793
|
if (!isPathInside(htmlPath, projectDir)) return html;
|
|
8646
|
-
const entryPath =
|
|
8794
|
+
const entryPath = relative3(projectDir, htmlPath).replace(/\\/g, "/");
|
|
8647
8795
|
if (!entryPath.includes("/")) return html;
|
|
8648
8796
|
const { document: document2 } = parseHTML(html);
|
|
8649
8797
|
const assetExists = projectAssetExists(projectDir);
|
|
@@ -8703,7 +8851,7 @@ function bindVariableMediaSources(html, variables, budget, log) {
|
|
|
8703
8851
|
}
|
|
8704
8852
|
return changed ? document2.toString() : html;
|
|
8705
8853
|
}
|
|
8706
|
-
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ?
|
|
8854
|
+
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative3(projectDir, htmlPath).split(sep3).join("/") : basename5(htmlPath);
|
|
8707
8855
|
async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
|
|
8708
8856
|
const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
8709
8857
|
const outsideFiles = { includeScripts: options.includeOutsideScripts };
|
|
@@ -8716,7 +8864,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8716
8864
|
if (!COMPOSITION_FILE.test(htmlPath)) {
|
|
8717
8865
|
throw new Error(`Entry file ${htmlPath} is not an .html file, so it is refused`);
|
|
8718
8866
|
}
|
|
8719
|
-
assertCompositionFileSize(htmlPath,
|
|
8867
|
+
assertCompositionFileSize(htmlPath, basename5(htmlPath));
|
|
8720
8868
|
const budget = new CompositionExpansionBudget();
|
|
8721
8869
|
const entryHtml = rebaseDirectEntryAssetPaths(
|
|
8722
8870
|
readTextFile(htmlPath),
|
|
@@ -8768,7 +8916,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8768
8916
|
const usesThreeDTransforms = detectThreeDTransformUsage(sanitizedHtml);
|
|
8769
8917
|
const hasAncestorBackgroundImage = detectAncestorBackgroundImage(sanitizedHtml);
|
|
8770
8918
|
const fontSheetHtml = await inlineExternalFontStylesheets(
|
|
8771
|
-
promoteCssImportsToLinkTags(sanitizedHtml)
|
|
8919
|
+
promoteCssImportsToLinkTags(sanitizedHtml),
|
|
8920
|
+
budget
|
|
8772
8921
|
);
|
|
8773
8922
|
const normalizedFontHtml = normalizeSystemFontPrimaryFamilies(
|
|
8774
8923
|
injectTextRenderingRule(coalesceHeadStylesAndBodyScripts(fontSheetHtml))
|
|
@@ -8780,7 +8929,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8780
8929
|
projectFontFamilies: projectStylesheetFontFamilies(fontSheetHtml, projectDir),
|
|
8781
8930
|
abortSignal: options.abortSignal
|
|
8782
8931
|
});
|
|
8783
|
-
const assembledHtml = await inlineExternalScripts(coalescedHtml);
|
|
8932
|
+
const assembledHtml = await inlineExternalScripts(coalescedHtml, budget);
|
|
8784
8933
|
const HF_POSITION_ATTRS = [
|
|
8785
8934
|
'data-hf-studio-path-offset="true"',
|
|
8786
8935
|
'data-hf-studio-box-size="true"',
|
|
@@ -8872,8 +9021,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8872
9021
|
const advised = /* @__PURE__ */ new Set();
|
|
8873
9022
|
for (const video of videos) {
|
|
8874
9023
|
if (isHttpUrl(video.src)) continue;
|
|
8875
|
-
const videoPath =
|
|
8876
|
-
if (advised.has(videoPath) || namesAnotherNetworkRoot(projectDir, videoPath) || !
|
|
9024
|
+
const videoPath = resolve6(projectDir, video.src);
|
|
9025
|
+
if (advised.has(videoPath) || namesAnotherNetworkRoot(projectDir, videoPath) || !existsSync11(videoPath) || escapesAssetRoot(videoPath, assetRoot) || isPrivateUnderAssetRoots(videoPath, [projectDir, downloadDir]))
|
|
8877
9026
|
continue;
|
|
8878
9027
|
advised.add(videoPath);
|
|
8879
9028
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
@@ -9288,7 +9437,7 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
|
|
|
9288
9437
|
function animatedGifCacheDir(extractCacheDir) {
|
|
9289
9438
|
try {
|
|
9290
9439
|
const root = extractCacheDir && privateCacheRoot(extractCacheDir);
|
|
9291
|
-
return root ?
|
|
9440
|
+
return root ? join18(root, "animated-gif") : void 0;
|
|
9292
9441
|
} catch {
|
|
9293
9442
|
return void 0;
|
|
9294
9443
|
}
|
|
@@ -9310,17 +9459,17 @@ function resolveEntryHtmlPath(input) {
|
|
|
9310
9459
|
const readEntry = (path) => {
|
|
9311
9460
|
if (escapesAssetRoot(path, input.assetRoot)) {
|
|
9312
9461
|
throw new Error(
|
|
9313
|
-
`Entry file "${
|
|
9462
|
+
`Entry file "${relative4(projectDir, path)}" leads outside the project folder`
|
|
9314
9463
|
);
|
|
9315
9464
|
}
|
|
9316
|
-
assertCompositionFileSize(path,
|
|
9465
|
+
assertCompositionFileSize(path, relative4(projectDir, path));
|
|
9317
9466
|
return readTextFile(path);
|
|
9318
9467
|
};
|
|
9319
|
-
const htmlPath =
|
|
9468
|
+
const htmlPath = join18(projectDir, entryFile);
|
|
9320
9469
|
const rawEntry = readEntry(htmlPath);
|
|
9321
9470
|
if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
|
|
9322
|
-
const projectIndexPath =
|
|
9323
|
-
if (!
|
|
9471
|
+
const projectIndexPath = join18(projectDir, "index.html");
|
|
9472
|
+
if (!existsSync12(projectIndexPath)) {
|
|
9324
9473
|
throw new Error(
|
|
9325
9474
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
9326
9475
|
);
|
|
@@ -9335,7 +9484,7 @@ function resolveEntryHtmlPath(input) {
|
|
|
9335
9484
|
`Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
|
|
9336
9485
|
);
|
|
9337
9486
|
}
|
|
9338
|
-
const wrapperPath =
|
|
9487
|
+
const wrapperPath = join18(workDir, "standalone-entry.html");
|
|
9339
9488
|
writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
|
|
9340
9489
|
log.info("Extracted standalone entry from index.html host context", { entryFile });
|
|
9341
9490
|
return wrapperPath;
|
|
@@ -9365,7 +9514,7 @@ async function runCompileStage(input) {
|
|
|
9365
9514
|
const assetRoot = job.config.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
9366
9515
|
const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log, assetRoot });
|
|
9367
9516
|
const compileStart = Date.now();
|
|
9368
|
-
const compiled = await compileForRender(projectDir, htmlPath,
|
|
9517
|
+
const compiled = await compileForRender(projectDir, htmlPath, join18(workDir, "downloads"), {
|
|
9369
9518
|
log,
|
|
9370
9519
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
9371
9520
|
allowSystemFontCapture,
|
|
@@ -9440,7 +9589,7 @@ async function runCompileStage(input) {
|
|
|
9440
9589
|
});
|
|
9441
9590
|
await preflightCompositionAssetMediaTypes({
|
|
9442
9591
|
projectDir,
|
|
9443
|
-
compiledDir:
|
|
9592
|
+
compiledDir: join18(workDir, "compiled"),
|
|
9444
9593
|
composition,
|
|
9445
9594
|
signal: abortSignal
|
|
9446
9595
|
});
|
|
@@ -9488,7 +9637,7 @@ async function runCompileStage(input) {
|
|
|
9488
9637
|
|
|
9489
9638
|
// ../producer/src/services/render/stages/probeStage.ts
|
|
9490
9639
|
import { createHash as createHash5 } from "crypto";
|
|
9491
|
-
import { basename as
|
|
9640
|
+
import { basename as basename6, join as join19 } from "path";
|
|
9492
9641
|
|
|
9493
9642
|
// ../producer/src/services/render/stages/probeFailures.ts
|
|
9494
9643
|
var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
|
|
@@ -9711,7 +9860,7 @@ function probeRequiresBrowser(args) {
|
|
|
9711
9860
|
function reportedLengthSource(source) {
|
|
9712
9861
|
if (!source) return null;
|
|
9713
9862
|
if (source.from !== "media") return { from: source.from };
|
|
9714
|
-
const name =
|
|
9863
|
+
const name = basename6(source.src.split(/[?#]/, 1)[0] ?? "");
|
|
9715
9864
|
const srcHash = createHash5("sha256").update(name).digest("hex").slice(0, 12);
|
|
9716
9865
|
return { from: "media", tag: source.tag, trimmed: source.trimmed, srcHash };
|
|
9717
9866
|
}
|
|
@@ -9777,7 +9926,7 @@ async function runProbeStage(input) {
|
|
|
9777
9926
|
});
|
|
9778
9927
|
fileServer = await createFileServer({
|
|
9779
9928
|
projectDir,
|
|
9780
|
-
compiledDir:
|
|
9929
|
+
compiledDir: join19(workDir, "compiled"),
|
|
9781
9930
|
port: 0,
|
|
9782
9931
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
9783
9932
|
fps: job.config.fps,
|
|
@@ -9814,7 +9963,7 @@ async function runProbeStage(input) {
|
|
|
9814
9963
|
log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
9815
9964
|
probeSession = await createCaptureSession(
|
|
9816
9965
|
fileServer.url,
|
|
9817
|
-
|
|
9966
|
+
join19(workDir, "probe"),
|
|
9818
9967
|
captureOpts,
|
|
9819
9968
|
null,
|
|
9820
9969
|
probeCfg
|
|
@@ -9899,7 +10048,7 @@ async function runProbeStage(input) {
|
|
|
9899
10048
|
});
|
|
9900
10049
|
probeSession = await createCaptureSession(
|
|
9901
10050
|
fileServer.url,
|
|
9902
|
-
|
|
10051
|
+
join19(workDir, "probe-screenshot"),
|
|
9903
10052
|
captureOpts,
|
|
9904
10053
|
null,
|
|
9905
10054
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -9937,7 +10086,7 @@ async function runProbeStage(input) {
|
|
|
9937
10086
|
compiled,
|
|
9938
10087
|
resolutions,
|
|
9939
10088
|
projectDir,
|
|
9940
|
-
|
|
10089
|
+
join19(workDir, "downloads"),
|
|
9941
10090
|
job.config.allowOutsideProjectAssets ? void 0 : projectDir,
|
|
9942
10091
|
{ includeScripts: job.config.includeOutsideScripts }
|
|
9943
10092
|
);
|
|
@@ -10137,7 +10286,7 @@ async function runProbeStage(input) {
|
|
|
10137
10286
|
});
|
|
10138
10287
|
await preflightCompositionAssetMediaTypes({
|
|
10139
10288
|
projectDir,
|
|
10140
|
-
compiledDir:
|
|
10289
|
+
compiledDir: join19(workDir, "compiled"),
|
|
10141
10290
|
composition,
|
|
10142
10291
|
signal: abortSignal
|
|
10143
10292
|
});
|
|
@@ -10295,8 +10444,8 @@ function validateDistributedDuration(input) {
|
|
|
10295
10444
|
}
|
|
10296
10445
|
|
|
10297
10446
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
10298
|
-
import { existsSync as
|
|
10299
|
-
import { join as
|
|
10447
|
+
import { existsSync as existsSync13 } from "fs";
|
|
10448
|
+
import { join as join20 } from "path";
|
|
10300
10449
|
|
|
10301
10450
|
// ../producer/src/services/render/extractionFailureMetadata.ts
|
|
10302
10451
|
function stringOrEmpty(value) {
|
|
@@ -10636,7 +10785,7 @@ async function runExtractVideosStage(input) {
|
|
|
10636
10785
|
// because short boundary counts can differ by one frame.
|
|
10637
10786
|
{
|
|
10638
10787
|
fps: job.config.fps,
|
|
10639
|
-
outputDir:
|
|
10788
|
+
outputDir: join20(compiledDir, "__hyperframes_video_frames"),
|
|
10640
10789
|
format: job.config.videoFrameFormat ?? "auto",
|
|
10641
10790
|
toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
|
|
10642
10791
|
timelineEnd: composition.duration,
|
|
@@ -10644,7 +10793,7 @@ async function runExtractVideosStage(input) {
|
|
|
10644
10793
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
10645
10794
|
deferRangeExtraction,
|
|
10646
10795
|
shownBoxes,
|
|
10647
|
-
contentKeyedDirs: [
|
|
10796
|
+
contentKeyedDirs: [join20(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
10648
10797
|
urlByAbsentLocalPath,
|
|
10649
10798
|
assetRoots,
|
|
10650
10799
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
@@ -10724,7 +10873,7 @@ function isPublicHttpsUrl(url) {
|
|
|
10724
10873
|
}
|
|
10725
10874
|
}
|
|
10726
10875
|
function opensLocally(path, assetRoots) {
|
|
10727
|
-
return
|
|
10876
|
+
return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
|
|
10728
10877
|
}
|
|
10729
10878
|
function localProbeSource(src, input) {
|
|
10730
10879
|
const path = resolveProjectRelativeSrc(src, input.projectDir, input.compiledDir);
|
|
@@ -10736,7 +10885,7 @@ async function remoteProbeSource(video, input) {
|
|
|
10736
10885
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
10737
10886
|
if (!resolveRestrictPageNetwork()) return video.src;
|
|
10738
10887
|
if (!video.hasAudio || video.hidden) return null;
|
|
10739
|
-
const downloadDir = input.downloadDir ??
|
|
10888
|
+
const downloadDir = input.downloadDir ?? join20(input.compiledDir, REMOTE_MEDIA_SUBDIR);
|
|
10740
10889
|
try {
|
|
10741
10890
|
return await downloadToTemp(video.src, downloadDir, void 0, input.signal, void 0, {
|
|
10742
10891
|
onTelemetry: writeUrlDownloadTelemetry
|
|
@@ -10777,7 +10926,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10777
10926
|
}
|
|
10778
10927
|
|
|
10779
10928
|
// ../producer/src/services/render/videoLayerPassthroughPlan.ts
|
|
10780
|
-
import { existsSync as
|
|
10929
|
+
import { existsSync as existsSync14 } from "fs";
|
|
10781
10930
|
var SAMPLES = 9;
|
|
10782
10931
|
function inspectVideoLayout(id, w, h, time) {
|
|
10783
10932
|
window.__hf?.seek?.(time);
|
|
@@ -10839,7 +10988,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10839
10988
|
const { video } = q;
|
|
10840
10989
|
if (isHttpUrl(video.src)) return { reason: "remote_source" };
|
|
10841
10990
|
const path = resolveProjectRelativeSrc(video.src, input.projectDir, input.compiledDir);
|
|
10842
|
-
if (!
|
|
10991
|
+
if (!existsSync14(path)) return { reason: "source_missing" };
|
|
10843
10992
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
10844
10993
|
if ("reason" in layout) return layout;
|
|
10845
10994
|
const layer = await buildVideoLayerInput(
|
|
@@ -10854,16 +11003,16 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10854
11003
|
}
|
|
10855
11004
|
|
|
10856
11005
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
10857
|
-
import { existsSync as
|
|
10858
|
-
import { join as
|
|
11006
|
+
import { existsSync as existsSync16 } from "fs";
|
|
11007
|
+
import { join as join23 } from "path";
|
|
10859
11008
|
|
|
10860
11009
|
// ../producer/src/services/render/audioDeliveryLimit.ts
|
|
10861
|
-
import { existsSync as
|
|
10862
|
-
import { dirname as dirname9, join as
|
|
11010
|
+
import { existsSync as existsSync15 } from "fs";
|
|
11011
|
+
import { dirname as dirname9, join as join22 } from "path";
|
|
10863
11012
|
|
|
10864
11013
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
10865
11014
|
import { spawn } from "child_process";
|
|
10866
|
-
import { dirname as dirname8, join as
|
|
11015
|
+
import { dirname as dirname8, join as join21 } from "path";
|
|
10867
11016
|
|
|
10868
11017
|
// ../producer/src/services/render/audioTruePeak.ts
|
|
10869
11018
|
var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
|
|
@@ -11123,7 +11272,7 @@ async function constrainAacTruePeak(input) {
|
|
|
11123
11272
|
}
|
|
11124
11273
|
async function cutSource(input, scratchDir, attenuationDb) {
|
|
11125
11274
|
if (!input.sourcePath || !input.rewriteSource) return true;
|
|
11126
|
-
const cutPath =
|
|
11275
|
+
const cutPath = join21(scratchDir, "source.wav");
|
|
11127
11276
|
try {
|
|
11128
11277
|
const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
|
|
11129
11278
|
if (!result.success) throw new Error(result.error);
|
|
@@ -11138,7 +11287,7 @@ async function enforceAacTruePeak(input) {
|
|
|
11138
11287
|
let scratchDir;
|
|
11139
11288
|
try {
|
|
11140
11289
|
scratchDir = createStagingDir(dirname8(input.audioPath), ".true-peak-");
|
|
11141
|
-
const correctedPath =
|
|
11290
|
+
const correctedPath = join21(scratchDir, "audio.m4a");
|
|
11142
11291
|
const measurements = [];
|
|
11143
11292
|
let attenuationDb = 0;
|
|
11144
11293
|
let sourcePeakDbfs;
|
|
@@ -11351,14 +11500,14 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
11351
11500
|
applyChain: applyAudioFxChain,
|
|
11352
11501
|
encode: encodeAac,
|
|
11353
11502
|
rename: renameWithRetry,
|
|
11354
|
-
sourceExists:
|
|
11503
|
+
sourceExists: existsSync15
|
|
11355
11504
|
}) {
|
|
11356
11505
|
const { audioPath, sourcePath, signal, timeoutMs } = input;
|
|
11357
11506
|
if (!deps.sourceExists(sourcePath)) return { success: true };
|
|
11358
11507
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
11359
11508
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
11360
11509
|
const alternating = ["a", "b"].map(
|
|
11361
|
-
(k) =>
|
|
11510
|
+
(k) => join22(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
|
|
11362
11511
|
);
|
|
11363
11512
|
let encodedFrom;
|
|
11364
11513
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -11431,7 +11580,7 @@ function runAudioStage(input) {
|
|
|
11431
11580
|
}
|
|
11432
11581
|
async function runAudioStageScoped(input) {
|
|
11433
11582
|
const stageStart = Date.now();
|
|
11434
|
-
const pcmSourcePath =
|
|
11583
|
+
const pcmSourcePath = join23(input.workDir, "audio-source.wav");
|
|
11435
11584
|
const duration = input.totalFrames * input.fps.den / input.fps.num;
|
|
11436
11585
|
let deliverySourcePath;
|
|
11437
11586
|
try {
|
|
@@ -11447,7 +11596,7 @@ async function runAudioStageScoped(input) {
|
|
|
11447
11596
|
);
|
|
11448
11597
|
audioLoweredDb = guard.loweredDb;
|
|
11449
11598
|
input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
|
|
11450
|
-
if (input.keepDeliverySource && !guard.sourceStale &&
|
|
11599
|
+
if (input.keepDeliverySource && !guard.sourceStale && existsSync16(pcmSourcePath)) {
|
|
11451
11600
|
deliverySourcePath = pcmSourcePath;
|
|
11452
11601
|
}
|
|
11453
11602
|
}
|
|
@@ -11496,7 +11645,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11496
11645
|
assertNotAborted,
|
|
11497
11646
|
log
|
|
11498
11647
|
} = input;
|
|
11499
|
-
const audioOutputPath =
|
|
11648
|
+
const audioOutputPath = join23(workDir, MIXED_AUDIO_FILENAME);
|
|
11500
11649
|
let hasAudio = false;
|
|
11501
11650
|
let audioError;
|
|
11502
11651
|
let audioFailures;
|
|
@@ -11576,8 +11725,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11576
11725
|
}
|
|
11577
11726
|
|
|
11578
11727
|
// ../producer/src/services/render/stages/captureStage.ts
|
|
11579
|
-
import { existsSync as
|
|
11580
|
-
import { join as
|
|
11728
|
+
import { existsSync as existsSync17, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
|
|
11729
|
+
import { join as join24 } from "path";
|
|
11581
11730
|
function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
|
|
11582
11731
|
return workerCount > 1;
|
|
11583
11732
|
}
|
|
@@ -11633,16 +11782,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
|
|
|
11633
11782
|
}
|
|
11634
11783
|
function measureCaptureFrameBytes(workDir, framesDir) {
|
|
11635
11784
|
let total = sampleDirectoryBytes(framesDir);
|
|
11636
|
-
if (!
|
|
11785
|
+
if (!existsSync17(workDir)) return total;
|
|
11637
11786
|
for (const attempt of readdirSync4(workDir)) {
|
|
11638
11787
|
if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
|
|
11639
|
-
total += sampleDirectoryBytes(
|
|
11788
|
+
total += sampleDirectoryBytes(join24(workDir, attempt));
|
|
11640
11789
|
continue;
|
|
11641
11790
|
}
|
|
11642
11791
|
if (!/^capture-attempt-\d+$/.test(attempt)) continue;
|
|
11643
|
-
const attemptDir =
|
|
11792
|
+
const attemptDir = join24(workDir, attempt);
|
|
11644
11793
|
for (const name of readdirSync4(attemptDir)) {
|
|
11645
|
-
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(
|
|
11794
|
+
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join24(attemptDir, name));
|
|
11646
11795
|
}
|
|
11647
11796
|
}
|
|
11648
11797
|
return total;
|
|
@@ -11940,8 +12089,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
11940
12089
|
}
|
|
11941
12090
|
|
|
11942
12091
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
11943
|
-
import { existsSync as
|
|
11944
|
-
import { join as
|
|
12092
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
|
|
12093
|
+
import { join as join28 } from "path";
|
|
11945
12094
|
|
|
11946
12095
|
// ../producer/src/services/hdrImageTransferCache.ts
|
|
11947
12096
|
var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
|
|
@@ -12003,7 +12152,7 @@ function createHdrImageTransferCache(options = {}) {
|
|
|
12003
12152
|
}
|
|
12004
12153
|
|
|
12005
12154
|
// ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
|
|
12006
|
-
import { join as
|
|
12155
|
+
import { join as join25 } from "path";
|
|
12007
12156
|
async function runSequentialLayeredFrameLoop(input) {
|
|
12008
12157
|
const {
|
|
12009
12158
|
job,
|
|
@@ -12124,7 +12273,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
12124
12273
|
);
|
|
12125
12274
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
12126
12275
|
writeFileExclusiveSync(
|
|
12127
|
-
|
|
12276
|
+
join25(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
12128
12277
|
normalCanvas
|
|
12129
12278
|
);
|
|
12130
12279
|
}
|
|
@@ -12156,14 +12305,14 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
12156
12305
|
}
|
|
12157
12306
|
|
|
12158
12307
|
// ../producer/src/services/render/stages/captureHdrHybridLoop.ts
|
|
12159
|
-
import { join as
|
|
12308
|
+
import { join as join27 } from "path";
|
|
12160
12309
|
|
|
12161
12310
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
12162
12311
|
import { Worker } from "worker_threads";
|
|
12163
12312
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
|
|
12164
|
-
import { dirname as dirname10, join as
|
|
12313
|
+
import { dirname as dirname10, join as join26 } from "path";
|
|
12165
12314
|
import { createRequire } from "module";
|
|
12166
|
-
import { existsSync as
|
|
12315
|
+
import { existsSync as existsSync18 } from "fs";
|
|
12167
12316
|
function resolveWorkerEntry(explicit) {
|
|
12168
12317
|
if (explicit && explicit.length > 0) {
|
|
12169
12318
|
return { path: explicit, isTs: explicit.endsWith(".ts") };
|
|
@@ -12174,9 +12323,9 @@ function resolveWorkerEntry(explicit) {
|
|
|
12174
12323
|
return { path: override, isTs };
|
|
12175
12324
|
}
|
|
12176
12325
|
const moduleDir = dirname10(fileURLToPath2(import.meta.url));
|
|
12177
|
-
const jsPath =
|
|
12178
|
-
if (
|
|
12179
|
-
const tsPath =
|
|
12326
|
+
const jsPath = join26(moduleDir, "shaderTransitionWorker.js");
|
|
12327
|
+
if (existsSync18(jsPath)) return { path: jsPath, isTs: false };
|
|
12328
|
+
const tsPath = join26(moduleDir, "shaderTransitionWorker.ts");
|
|
12180
12329
|
return { path: tsPath, isTs: true };
|
|
12181
12330
|
}
|
|
12182
12331
|
function buildExecArgv(entryIsTs) {
|
|
@@ -12319,8 +12468,8 @@ async function createShaderTransitionWorkerPool(opts) {
|
|
|
12319
12468
|
if (terminated) {
|
|
12320
12469
|
throw new Error("shader-blend pool already terminated");
|
|
12321
12470
|
}
|
|
12322
|
-
return new Promise((
|
|
12323
|
-
const task = traceEnabled ? { req, resolve:
|
|
12471
|
+
return new Promise((resolve12, reject) => {
|
|
12472
|
+
const task = traceEnabled ? { req, resolve: resolve12, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve12, reject };
|
|
12324
12473
|
const idle = slots.find((s) => !s.busy && !s.dead);
|
|
12325
12474
|
if (idle) {
|
|
12326
12475
|
queue.unshift(task);
|
|
@@ -12544,7 +12693,7 @@ async function runHybridLayeredFrameLoop(input) {
|
|
|
12544
12693
|
);
|
|
12545
12694
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
12546
12695
|
writeFileExclusiveSync(
|
|
12547
|
-
|
|
12696
|
+
join27(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
12548
12697
|
canvas
|
|
12549
12698
|
);
|
|
12550
12699
|
}
|
|
@@ -12740,8 +12889,8 @@ async function runCaptureHdrStage(input) {
|
|
|
12740
12889
|
if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
|
|
12741
12890
|
}
|
|
12742
12891
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
12743
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
12744
|
-
if (debugDumpDir && !
|
|
12892
|
+
const debugDumpDir = debugDumpEnabled ? join28(framesDir, "debug-composite") : null;
|
|
12893
|
+
if (debugDumpDir && !existsSync19(debugDumpDir)) {
|
|
12745
12894
|
mkdirSync8(debugDumpDir, { recursive: true });
|
|
12746
12895
|
}
|
|
12747
12896
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
@@ -12900,7 +13049,7 @@ async function runCaptureHdrStage(input) {
|
|
|
12900
13049
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
12901
13050
|
import {
|
|
12902
13051
|
copyFileSync as copyFileSync2,
|
|
12903
|
-
existsSync as
|
|
13052
|
+
existsSync as existsSync20,
|
|
12904
13053
|
mkdirSync as mkdirSync9,
|
|
12905
13054
|
readdirSync as readdirSync5,
|
|
12906
13055
|
readFileSync as readFileSync7,
|
|
@@ -12909,7 +13058,7 @@ import {
|
|
|
12909
13058
|
writeFileSync as writeFileSync5
|
|
12910
13059
|
} from "fs";
|
|
12911
13060
|
import { readFile as readFile2 } from "fs/promises";
|
|
12912
|
-
import { dirname as dirname11, join as
|
|
13061
|
+
import { dirname as dirname11, join as join29 } from "path";
|
|
12913
13062
|
|
|
12914
13063
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
12915
13064
|
function fpsToFfmpegArg2(fps) {
|
|
@@ -13019,7 +13168,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
13019
13168
|
const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
|
|
13020
13169
|
if (failure) return failure;
|
|
13021
13170
|
}
|
|
13022
|
-
const fileSize =
|
|
13171
|
+
const fileSize = existsSync20(outputPath) ? statSync7(outputPath).size : 0;
|
|
13023
13172
|
return {
|
|
13024
13173
|
success: true,
|
|
13025
13174
|
outputPath,
|
|
@@ -13110,10 +13259,10 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
13110
13259
|
const stream = await encoder;
|
|
13111
13260
|
for (let next = 0; next < totalFrames; next++) {
|
|
13112
13261
|
while (!landed.has(next) && !captureDone && !signal.aborted) {
|
|
13113
|
-
await new Promise((
|
|
13262
|
+
await new Promise((resolve12) => wake = resolve12);
|
|
13114
13263
|
}
|
|
13115
13264
|
if (signal.aborted) return;
|
|
13116
|
-
const mergedPath =
|
|
13265
|
+
const mergedPath = join29(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
13117
13266
|
const frame = await readLandedFrame(landed.get(next), mergedPath);
|
|
13118
13267
|
landed.delete(next);
|
|
13119
13268
|
if (!await stream.writeFrame(frame)) {
|
|
@@ -13188,7 +13337,7 @@ async function runEncodeStage(input) {
|
|
|
13188
13337
|
const stage5Start = Date.now();
|
|
13189
13338
|
if (isPngSequence) {
|
|
13190
13339
|
const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
|
|
13191
|
-
if (!
|
|
13340
|
+
if (!existsSync20(outputPath)) mkdirSync9(outputPath, { recursive: true });
|
|
13192
13341
|
const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
13193
13342
|
if (captured.length === 0) {
|
|
13194
13343
|
throw new Error(
|
|
@@ -13196,11 +13345,11 @@ async function runEncodeStage(input) {
|
|
|
13196
13345
|
);
|
|
13197
13346
|
}
|
|
13198
13347
|
captured.forEach((name, i) => {
|
|
13199
|
-
const dst =
|
|
13200
|
-
copyFileSync2(
|
|
13348
|
+
const dst = join29(outputPath, formatExportFrameName(i, "png"));
|
|
13349
|
+
copyFileSync2(join29(framesDir, name), dst);
|
|
13201
13350
|
});
|
|
13202
|
-
if (hasAudio && audioOutputPath &&
|
|
13203
|
-
copyFileSync2(audioOutputPath,
|
|
13351
|
+
if (hasAudio && audioOutputPath && existsSync20(audioOutputPath)) {
|
|
13352
|
+
copyFileSync2(audioOutputPath, join29(outputPath, MIXED_AUDIO_FILENAME));
|
|
13204
13353
|
log.info(
|
|
13205
13354
|
`[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
|
|
13206
13355
|
);
|
|
@@ -13220,7 +13369,7 @@ async function runEncodeStage(input) {
|
|
|
13220
13369
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
13221
13370
|
fps: job.config.fps,
|
|
13222
13371
|
loop,
|
|
13223
|
-
palettePath:
|
|
13372
|
+
palettePath: join29(dirname11(videoOnlyPath), "gif-palette.png"),
|
|
13224
13373
|
preserveAlpha: needsAlpha,
|
|
13225
13374
|
signal: abortSignal,
|
|
13226
13375
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -13430,7 +13579,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
13430
13579
|
continue;
|
|
13431
13580
|
}
|
|
13432
13581
|
for (const name of entries) {
|
|
13433
|
-
const full =
|
|
13582
|
+
const full = join30(current, name);
|
|
13434
13583
|
try {
|
|
13435
13584
|
const st = statSync8(full);
|
|
13436
13585
|
if (st.isDirectory()) {
|
|
@@ -13466,6 +13615,7 @@ function summarizeExtractionObservability(extractionResult, videoCount, coverage
|
|
|
13466
13615
|
vfrPreflightCount: phaseBreakdown?.vfrPreflightCount,
|
|
13467
13616
|
cacheHits: phaseBreakdown?.cacheHits,
|
|
13468
13617
|
cacheMisses: phaseBreakdown?.cacheMisses,
|
|
13618
|
+
cachePublishFailures: phaseBreakdown?.cachePublishFailures,
|
|
13469
13619
|
transientRetries: phaseBreakdown?.transientRetries,
|
|
13470
13620
|
...coverageGauges,
|
|
13471
13621
|
authoredTimedClipCount
|
|
@@ -13587,8 +13737,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
13587
13737
|
const ranges = [];
|
|
13588
13738
|
let rangeStart = null;
|
|
13589
13739
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
13590
|
-
const framePath =
|
|
13591
|
-
const missing = !
|
|
13740
|
+
const framePath = join30(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
13741
|
+
const missing = !existsSync21(framePath) || statSync8(framePath).size <= 8;
|
|
13592
13742
|
if (missing && rangeStart === null) {
|
|
13593
13743
|
rangeStart = frameIndex;
|
|
13594
13744
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -13604,7 +13754,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
13604
13754
|
function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
|
|
13605
13755
|
const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
|
|
13606
13756
|
const batches = [];
|
|
13607
|
-
const outputDirFor = (batchIndex, workerId) =>
|
|
13757
|
+
const outputDirFor = (batchIndex, workerId) => join30(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
|
|
13608
13758
|
if (stride > 1) {
|
|
13609
13759
|
const spans = /* @__PURE__ */ new Map();
|
|
13610
13760
|
for (const range of ranges) {
|
|
@@ -13663,9 +13813,9 @@ function createCaptureObservabilityUpdater(observability, platform2 = process.pl
|
|
|
13663
13813
|
function getNextRetryWorkerCount(currentWorkers) {
|
|
13664
13814
|
return Math.max(1, Math.floor(currentWorkers / 2));
|
|
13665
13815
|
}
|
|
13666
|
-
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir =
|
|
13667
|
-
if (platform2 === "win32" || platform2 === "darwin") return
|
|
13668
|
-
return
|
|
13816
|
+
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir = tmpdir3()) {
|
|
13817
|
+
if (platform2 === "win32" || platform2 === "darwin") return join30(systemTempDir, "hf-render-");
|
|
13818
|
+
return join30(dirname12(outputPath), `work-${jobId}-`);
|
|
13669
13819
|
}
|
|
13670
13820
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
13671
13821
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -13720,8 +13870,8 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
13720
13870
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
13721
13871
|
let captured = 0;
|
|
13722
13872
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
13723
|
-
const framePath =
|
|
13724
|
-
if (
|
|
13873
|
+
const framePath = join30(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
13874
|
+
if (existsSync21(framePath)) captured++;
|
|
13725
13875
|
}
|
|
13726
13876
|
return captured;
|
|
13727
13877
|
}
|
|
@@ -13746,7 +13896,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
13746
13896
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
13747
13897
|
});
|
|
13748
13898
|
pendingTransientRetry = false;
|
|
13749
|
-
const attemptWorkDir =
|
|
13899
|
+
const attemptWorkDir = join30(options.workDir, `capture-attempt-${attempt}`);
|
|
13750
13900
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
13751
13901
|
missingRanges,
|
|
13752
13902
|
currentWorkers,
|
|
@@ -14393,8 +14543,8 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
14393
14543
|
};
|
|
14394
14544
|
}
|
|
14395
14545
|
function resolveRenderDebugDir() {
|
|
14396
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ?
|
|
14397
|
-
return
|
|
14546
|
+
const producerRoot = process.env.PRODUCER_RENDERS_DIR ? resolve7(process.env.PRODUCER_RENDERS_DIR, "..") : resolve7(dirname12(fileURLToPath3(import.meta.url)), "../..");
|
|
14547
|
+
return join30(producerRoot, ".debug");
|
|
14398
14548
|
}
|
|
14399
14549
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
14400
14550
|
validateHlsRenderConfig(job.config);
|
|
@@ -14402,11 +14552,11 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
14402
14552
|
validateChromaSubsamplingConfig(job.config);
|
|
14403
14553
|
const debugDir = resolveRenderDebugDir();
|
|
14404
14554
|
const outputDir = dirname12(outputPath);
|
|
14405
|
-
if (!
|
|
14406
|
-
const workDir = job.config.debug ?
|
|
14555
|
+
if (!existsSync21(outputDir)) mkdirSync10(outputDir, { recursive: true });
|
|
14556
|
+
const workDir = job.config.debug ? join30(debugDir, job.id) : createRenderWorkDir(resolveRenderWorkDirPrefix(outputPath, job.id), outputDir);
|
|
14407
14557
|
const pipelineStart = Date.now();
|
|
14408
14558
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
14409
|
-
const logPath = job.config.debug ?
|
|
14559
|
+
const logPath = job.config.debug ? join30(workDir, "render.log") : null;
|
|
14410
14560
|
const execution = new RenderExecutionContext({
|
|
14411
14561
|
request: { renderJobId: job.id, projectDir, outputPath },
|
|
14412
14562
|
logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
|
|
@@ -14474,7 +14624,7 @@ async function executeRenderPipeline(input) {
|
|
|
14474
14624
|
imageDecodeFailures: 0
|
|
14475
14625
|
};
|
|
14476
14626
|
let hdrPerf;
|
|
14477
|
-
const perfOutputPath =
|
|
14627
|
+
const perfOutputPath = join30(workDir, "perf-summary.json");
|
|
14478
14628
|
const cfg = { ...job.config.producerConfig ?? resolveConfig() };
|
|
14479
14629
|
const observability = new RenderObservabilityRecorder({
|
|
14480
14630
|
pipelineStartMs: pipelineStart,
|
|
@@ -14550,7 +14700,7 @@ async function executeRenderPipeline(input) {
|
|
|
14550
14700
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
14551
14701
|
assertNotAborted();
|
|
14552
14702
|
assertConfiguredFfmpegBinariesExist();
|
|
14553
|
-
if (!
|
|
14703
|
+
if (!existsSync21(workDir)) mkdirSync10(workDir, { recursive: true });
|
|
14554
14704
|
if (job.config.debug) {
|
|
14555
14705
|
log.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
14556
14706
|
}
|
|
@@ -14579,8 +14729,8 @@ async function executeRenderPipeline(input) {
|
|
|
14579
14729
|
requestedWorkers: job.config.workers ?? "auto"
|
|
14580
14730
|
});
|
|
14581
14731
|
const entryFile = job.config.entryFile || "index.html";
|
|
14582
|
-
const htmlPath =
|
|
14583
|
-
if (!
|
|
14732
|
+
const htmlPath = join30(projectDir, entryFile);
|
|
14733
|
+
if (!existsSync21(htmlPath)) {
|
|
14584
14734
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
14585
14735
|
}
|
|
14586
14736
|
assertNotAborted();
|
|
@@ -14676,7 +14826,7 @@ async function executeRenderPipeline(input) {
|
|
|
14676
14826
|
const largerThanCanvas = await oversizedVideos(
|
|
14677
14827
|
composition.videos,
|
|
14678
14828
|
projectDir,
|
|
14679
|
-
|
|
14829
|
+
join30(workDir, "compiled"),
|
|
14680
14830
|
{ width: outputWidth, height: outputHeight }
|
|
14681
14831
|
);
|
|
14682
14832
|
const probeResult = await observeRenderStage(
|
|
@@ -14773,7 +14923,7 @@ async function executeRenderPipeline(input) {
|
|
|
14773
14923
|
canvas: { width, height },
|
|
14774
14924
|
page: probeSession.page,
|
|
14775
14925
|
projectDir,
|
|
14776
|
-
compiledDir:
|
|
14926
|
+
compiledDir: join30(workDir, "compiled")
|
|
14777
14927
|
});
|
|
14778
14928
|
if (videoLayerPlan.videoId === void 0) {
|
|
14779
14929
|
log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
|
|
@@ -14791,7 +14941,7 @@ async function executeRenderPipeline(input) {
|
|
|
14791
14941
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
|
|
14792
14942
|
code: "extract_video"
|
|
14793
14943
|
});
|
|
14794
|
-
const compiledDir =
|
|
14944
|
+
const compiledDir = join30(workDir, "compiled");
|
|
14795
14945
|
const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
|
|
14796
14946
|
env: process.env,
|
|
14797
14947
|
durationSeconds: probeResult.duration,
|
|
@@ -14927,7 +15077,7 @@ async function executeRenderPipeline(input) {
|
|
|
14927
15077
|
try {
|
|
14928
15078
|
fileServer = await createFileServer({
|
|
14929
15079
|
projectDir,
|
|
14930
|
-
compiledDir:
|
|
15080
|
+
compiledDir: join30(workDir, "compiled"),
|
|
14931
15081
|
port: 0,
|
|
14932
15082
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
14933
15083
|
fps: job.config.fps,
|
|
@@ -14947,8 +15097,8 @@ async function executeRenderPipeline(input) {
|
|
|
14947
15097
|
if (!activeFileServer) {
|
|
14948
15098
|
throw new Error("File server failed to initialize before frame capture");
|
|
14949
15099
|
}
|
|
14950
|
-
const framesDir =
|
|
14951
|
-
if (!
|
|
15100
|
+
const framesDir = join30(workDir, "captured-frames");
|
|
15101
|
+
if (!existsSync21(framesDir)) mkdirSync10(framesDir, { recursive: true });
|
|
14952
15102
|
updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
|
|
14953
15103
|
code: "start_browsers"
|
|
14954
15104
|
});
|
|
@@ -15528,7 +15678,7 @@ async function executeRenderPipeline(input) {
|
|
|
15528
15678
|
hls: ".mp4"
|
|
15529
15679
|
};
|
|
15530
15680
|
const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
|
|
15531
|
-
const videoOnlyPath =
|
|
15681
|
+
const videoOnlyPath = join30(workDir, `video-only${videoExt}`);
|
|
15532
15682
|
let usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
|
|
15533
15683
|
if (usePageSideCompositingForTransitions) {
|
|
15534
15684
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -15845,7 +15995,7 @@ async function executeRenderPipeline(input) {
|
|
|
15845
15995
|
pageMotionBlur: job.config.pageMotionBlur,
|
|
15846
15996
|
captureQuality: captureOptions.quality
|
|
15847
15997
|
});
|
|
15848
|
-
const segmentDir = segmentDirFor(
|
|
15998
|
+
const segmentDir = segmentDirFor(join30(projectDir, "renders"), segmentPlanHash);
|
|
15849
15999
|
let completedSegments = /* @__PURE__ */ new Set();
|
|
15850
16000
|
if (job.config.resumeSegments === true) {
|
|
15851
16001
|
const existing = readSegmentManifest(segmentDir);
|
|
@@ -16389,7 +16539,7 @@ async function executeRenderPipeline(input) {
|
|
|
16389
16539
|
})
|
|
16390
16540
|
);
|
|
16391
16541
|
const totalElapsed = Date.now() - pipelineStart;
|
|
16392
|
-
const tmpPeakBytes =
|
|
16542
|
+
const tmpPeakBytes = existsSync21(workDir) ? sampleDirectoryBytes(workDir) : 0;
|
|
16393
16543
|
recordTransientRetryObservability();
|
|
16394
16544
|
observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
|
|
16395
16545
|
const observabilitySummary = observability.summary({
|
|
@@ -16470,8 +16620,8 @@ async function executeRenderPipeline(input) {
|
|
|
16470
16620
|
}
|
|
16471
16621
|
}
|
|
16472
16622
|
if (job.config.debug) {
|
|
16473
|
-
if (!isPngSequence && !isHls &&
|
|
16474
|
-
const debugOutput =
|
|
16623
|
+
if (!isPngSequence && !isHls && existsSync21(stagedOutputPath)) {
|
|
16624
|
+
const debugOutput = join30(workDir, `output${videoExt}`);
|
|
16475
16625
|
copyFileSync3(stagedOutputPath, debugOutput);
|
|
16476
16626
|
}
|
|
16477
16627
|
}
|
|
@@ -16550,7 +16700,8 @@ async function executeRenderPipeline(input) {
|
|
|
16550
16700
|
perfStages,
|
|
16551
16701
|
hdrDiagnostics,
|
|
16552
16702
|
observability: observabilitySummary,
|
|
16553
|
-
subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs)
|
|
16703
|
+
subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs),
|
|
16704
|
+
missingPath: describeMissingPath(error, { cacheDir: cfg.extractCacheDir, workDir })
|
|
16554
16705
|
});
|
|
16555
16706
|
publishRenderFailure(
|
|
16556
16707
|
job,
|
|
@@ -16585,13 +16736,13 @@ async function executeRenderPipeline(input) {
|
|
|
16585
16736
|
|
|
16586
16737
|
// ../producer/src/services/distributed/renderSpan.ts
|
|
16587
16738
|
import { mkdirSync as mkdirSync18, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync16 } from "fs";
|
|
16588
|
-
import { join as
|
|
16589
|
-
import { tmpdir as
|
|
16739
|
+
import { join as join44 } from "path";
|
|
16740
|
+
import { tmpdir as tmpdir5 } from "os";
|
|
16590
16741
|
|
|
16591
16742
|
// ../producer/src/services/distributed/mp4Stitch.ts
|
|
16592
16743
|
import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync11, rmSync as rmSync11 } from "fs";
|
|
16593
16744
|
import { open } from "fs/promises";
|
|
16594
|
-
import { basename as
|
|
16745
|
+
import { basename as basename7, dirname as dirname13, join as join31 } from "path";
|
|
16595
16746
|
import { finished, pipeline } from "stream/promises";
|
|
16596
16747
|
function boxAt(src, off, at, limit) {
|
|
16597
16748
|
let size = src.readUInt32BE(off);
|
|
@@ -16956,14 +17107,14 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
16956
17107
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
16957
17108
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
16958
17109
|
mkdirSync11(dirname13(outputPath), { recursive: true });
|
|
16959
|
-
const workDir = createStagingDir(dirname13(outputPath), `${
|
|
16960
|
-
const out = createWriteStream(
|
|
17110
|
+
const workDir = createStagingDir(dirname13(outputPath), `${basename7(outputPath)}.stitch-`);
|
|
17111
|
+
const out = createWriteStream(join31(workDir, "out.mp4"));
|
|
16961
17112
|
try {
|
|
16962
17113
|
out.write(header);
|
|
16963
17114
|
for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
|
|
16964
17115
|
out.end();
|
|
16965
17116
|
await finished(out);
|
|
16966
|
-
renameWithRetry(
|
|
17117
|
+
renameWithRetry(join31(workDir, "out.mp4"), outputPath);
|
|
16967
17118
|
} finally {
|
|
16968
17119
|
out.destroy();
|
|
16969
17120
|
rmSync11(workDir, { recursive: true, force: true });
|
|
@@ -16974,25 +17125,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
16974
17125
|
import {
|
|
16975
17126
|
copyFileSync as copyFileSync4,
|
|
16976
17127
|
cpSync as cpSync2,
|
|
16977
|
-
existsSync as
|
|
17128
|
+
existsSync as existsSync26,
|
|
16978
17129
|
linkSync,
|
|
16979
17130
|
mkdirSync as mkdirSync14,
|
|
16980
17131
|
rmSync as rmSync12,
|
|
16981
17132
|
writeFileSync as writeFileSync9
|
|
16982
17133
|
} from "fs";
|
|
16983
|
-
import { extname as extname6, isAbsolute as
|
|
17134
|
+
import { extname as extname6, isAbsolute as isAbsolute3, join as join39, relative as relative7, sep as sep4 } from "path";
|
|
16984
17135
|
|
|
16985
17136
|
// ../producer/src/services/distributed/planFrameCost.ts
|
|
16986
|
-
import { join as
|
|
17137
|
+
import { join as join34 } from "path";
|
|
16987
17138
|
|
|
16988
17139
|
// ../producer/src/services/distributed/chunkFrames.ts
|
|
16989
|
-
import { existsSync as
|
|
16990
|
-
import { extname as extname4, join as
|
|
17140
|
+
import { existsSync as existsSync23, readdirSync as readdirSync7 } from "fs";
|
|
17141
|
+
import { extname as extname4, join as join33 } from "path";
|
|
16991
17142
|
|
|
16992
17143
|
// ../producer/src/services/distributed/shared.ts
|
|
16993
17144
|
import { execFile as execFileCallback } from "child_process";
|
|
16994
|
-
import { dirname as dirname14, join as
|
|
16995
|
-
import { existsSync as
|
|
17145
|
+
import { dirname as dirname14, join as join32 } from "path";
|
|
17146
|
+
import { existsSync as existsSync22, readFileSync as readFileSync8 } from "fs";
|
|
16996
17147
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
16997
17148
|
import { promisify as promisify2 } from "util";
|
|
16998
17149
|
var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
|
|
@@ -17003,8 +17154,8 @@ function isPlanAudioArtifactPath(path) {
|
|
|
17003
17154
|
}
|
|
17004
17155
|
function resolvePlanAudioPath(planDir) {
|
|
17005
17156
|
for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
|
|
17006
|
-
const candidate =
|
|
17007
|
-
if (
|
|
17157
|
+
const candidate = join32(planDir, name);
|
|
17158
|
+
if (existsSync22(candidate)) return candidate;
|
|
17008
17159
|
}
|
|
17009
17160
|
return null;
|
|
17010
17161
|
}
|
|
@@ -17268,8 +17419,8 @@ function readProducerVersion() {
|
|
|
17268
17419
|
const startDir = dirname14(fileURLToPath4(import.meta.url));
|
|
17269
17420
|
let current = startDir;
|
|
17270
17421
|
for (let i = 0; i < 10; i++) {
|
|
17271
|
-
const candidate =
|
|
17272
|
-
if (
|
|
17422
|
+
const candidate = join32(current, "package.json");
|
|
17423
|
+
if (existsSync22(candidate)) {
|
|
17273
17424
|
try {
|
|
17274
17425
|
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
17275
17426
|
if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
|
|
@@ -17323,8 +17474,8 @@ function frameNumberFromFileName(name) {
|
|
|
17323
17474
|
function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
|
|
17324
17475
|
const result = [];
|
|
17325
17476
|
for (const v of videos) {
|
|
17326
|
-
const outputDir =
|
|
17327
|
-
if (!
|
|
17477
|
+
const outputDir = join33(planDir, "video-frames", mediaIdPathSegment(v.videoId));
|
|
17478
|
+
if (!existsSync23(outputDir)) {
|
|
17328
17479
|
throw new Error(
|
|
17329
17480
|
`[renderChunk] planDir missing extracted video frames for ${JSON.stringify(v.videoId)}: ${outputDir} not present. plan() should have written frames here; the planDir is malformed.`
|
|
17330
17481
|
);
|
|
@@ -17342,7 +17493,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
|
|
|
17342
17493
|
if (!frameName) continue;
|
|
17343
17494
|
const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
|
|
17344
17495
|
const frameIndex = frameNumber === null ? i : frameNumber - 1;
|
|
17345
|
-
framePaths.set(frameIndex,
|
|
17496
|
+
framePaths.set(frameIndex, join33(outputDir, frameName));
|
|
17346
17497
|
}
|
|
17347
17498
|
result.push({
|
|
17348
17499
|
videoId: v.videoId,
|
|
@@ -17422,8 +17573,8 @@ async function extractDeferredVideoFramesForChunk(input) {
|
|
|
17422
17573
|
sourceOf: (video) => {
|
|
17423
17574
|
const range = planned.get(video.videoId).deferredRange;
|
|
17424
17575
|
const remoteUrl = remoteSources[range.sourcePath];
|
|
17425
|
-
const sourcePath = remoteUrl ??
|
|
17426
|
-
if (remoteUrl === void 0 && !
|
|
17576
|
+
const sourcePath = remoteUrl ?? join33(input.planDir, ...range.sourcePath.split("/"));
|
|
17577
|
+
if (remoteUrl === void 0 && !existsSync23(sourcePath)) {
|
|
17427
17578
|
throw new RenderChunkValidationError(
|
|
17428
17579
|
MISSING_PLAN_ARTIFACT,
|
|
17429
17580
|
`[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
|
|
@@ -17453,12 +17604,12 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
17453
17604
|
planVideos,
|
|
17454
17605
|
frames: sampled,
|
|
17455
17606
|
fps: fpsRatio,
|
|
17456
|
-
outputRoot:
|
|
17607
|
+
outputRoot: join34(workDir, "frame-cost-video-frames"),
|
|
17457
17608
|
cfg: input.cfg
|
|
17458
17609
|
})
|
|
17459
17610
|
];
|
|
17460
17611
|
const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
|
|
17461
|
-
const compiledDir =
|
|
17612
|
+
const compiledDir = join34(planDir, "compiled");
|
|
17462
17613
|
const fileServer = await createFileServer({
|
|
17463
17614
|
projectDir: compiledDir,
|
|
17464
17615
|
compiledDir,
|
|
@@ -17470,7 +17621,7 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
17470
17621
|
try {
|
|
17471
17622
|
session = await createCaptureSession(
|
|
17472
17623
|
fileServer.url,
|
|
17473
|
-
|
|
17624
|
+
join34(workDir, "frame-cost"),
|
|
17474
17625
|
buildChunkCaptureOptions({
|
|
17475
17626
|
dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
|
|
17476
17627
|
encoder: input,
|
|
@@ -17566,21 +17717,21 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
|
|
|
17566
17717
|
}
|
|
17567
17718
|
|
|
17568
17719
|
// ../producer/src/services/render/planReferenceBackground.ts
|
|
17569
|
-
import { join as
|
|
17720
|
+
import { join as join35 } from "path";
|
|
17570
17721
|
async function readPlanReferenceBackground(input) {
|
|
17571
17722
|
let server;
|
|
17572
17723
|
let session;
|
|
17573
17724
|
try {
|
|
17574
17725
|
server = await createFileServer({
|
|
17575
17726
|
projectDir: input.projectDir,
|
|
17576
|
-
compiledDir:
|
|
17727
|
+
compiledDir: join35(input.workDir, "compiled"),
|
|
17577
17728
|
port: 0,
|
|
17578
17729
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
17579
17730
|
fps: input.options.fps
|
|
17580
17731
|
});
|
|
17581
17732
|
session = await createCaptureSession(
|
|
17582
17733
|
server.url,
|
|
17583
|
-
|
|
17734
|
+
join35(input.workDir, "reference"),
|
|
17584
17735
|
{
|
|
17585
17736
|
...input.options,
|
|
17586
17737
|
requiresWebGpu: false
|
|
@@ -17616,8 +17767,8 @@ async function readPlanReferenceBackground(input) {
|
|
|
17616
17767
|
}
|
|
17617
17768
|
|
|
17618
17769
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
17619
|
-
import { existsSync as
|
|
17620
|
-
import { join as
|
|
17770
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync12, readFileSync as readFileSync9, readdirSync as readdirSync8, writeFileSync as writeFileSync7 } from "fs";
|
|
17771
|
+
import { join as join36, relative as relative5, resolve as resolve8 } from "path";
|
|
17621
17772
|
|
|
17622
17773
|
// ../producer/src/services/distributed/planProtocol.ts
|
|
17623
17774
|
var PLAN_SCHEMA_VERSION = 1;
|
|
@@ -17806,7 +17957,7 @@ function planFileSha256(absolutePath, digests) {
|
|
|
17806
17957
|
return sha256;
|
|
17807
17958
|
}
|
|
17808
17959
|
async function prehashPlanFiles(dir, digests) {
|
|
17809
|
-
if (!
|
|
17960
|
+
if (!existsSync24(dir)) return;
|
|
17810
17961
|
for (const { absolutePath } of listPlanFiles(dir)) {
|
|
17811
17962
|
if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
|
|
17812
17963
|
}
|
|
@@ -17827,16 +17978,16 @@ function stripUndefined(value) {
|
|
|
17827
17978
|
}
|
|
17828
17979
|
function listPlanFiles(planDir) {
|
|
17829
17980
|
const results = [];
|
|
17830
|
-
const rootResolved =
|
|
17981
|
+
const rootResolved = resolve8(planDir);
|
|
17831
17982
|
function walk(dir) {
|
|
17832
17983
|
const entries = readdirSync8(dir, { withFileTypes: true });
|
|
17833
17984
|
for (const entry of entries) {
|
|
17834
|
-
const full =
|
|
17985
|
+
const full = join36(dir, entry.name);
|
|
17835
17986
|
if (entry.isDirectory()) {
|
|
17836
17987
|
walk(full);
|
|
17837
17988
|
} else if (entry.isFile()) {
|
|
17838
17989
|
results.push({
|
|
17839
|
-
planRelativePath:
|
|
17990
|
+
planRelativePath: relative5(rootResolved, full).split(/[\\/]+/).join("/"),
|
|
17840
17991
|
absolutePath: full
|
|
17841
17992
|
});
|
|
17842
17993
|
}
|
|
@@ -17872,19 +18023,19 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
|
|
|
17872
18023
|
function writePlanRemoteFiles(planDir, files) {
|
|
17873
18024
|
if (files.length === 0) return;
|
|
17874
18025
|
const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
17875
|
-
writeFileSync7(
|
|
18026
|
+
writeFileSync7(join36(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
|
|
17876
18027
|
}
|
|
17877
18028
|
function readPlanRemoteFiles(planDir) {
|
|
17878
|
-
const path =
|
|
17879
|
-
return
|
|
18029
|
+
const path = join36(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
|
|
18030
|
+
return existsSync24(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
|
|
17880
18031
|
}
|
|
17881
18032
|
function recomputePlanHashFromPlanDir(planDir, digests) {
|
|
17882
|
-
const planJsonPath =
|
|
17883
|
-
const encoderJsonPath =
|
|
17884
|
-
if (!
|
|
18033
|
+
const planJsonPath = join36(planDir, "plan.json");
|
|
18034
|
+
const encoderJsonPath = join36(planDir, "meta", "encoder.json");
|
|
18035
|
+
if (!existsSync24(planJsonPath)) {
|
|
17885
18036
|
throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
|
|
17886
18037
|
}
|
|
17887
|
-
if (!
|
|
18038
|
+
if (!existsSync24(encoderJsonPath)) {
|
|
17888
18039
|
throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
|
|
17889
18040
|
}
|
|
17890
18041
|
const planJson = JSON.parse(readFileSync9(planJsonPath, "utf-8"));
|
|
@@ -17914,21 +18065,21 @@ async function freezePlan(input) {
|
|
|
17914
18065
|
hasAudio,
|
|
17915
18066
|
digests
|
|
17916
18067
|
} = input;
|
|
17917
|
-
if (!
|
|
18068
|
+
if (!existsSync24(planDir)) {
|
|
17918
18069
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
17919
18070
|
}
|
|
17920
|
-
const metaDir =
|
|
17921
|
-
if (!
|
|
18071
|
+
const metaDir = join36(planDir, "meta");
|
|
18072
|
+
if (!existsSync24(metaDir)) mkdirSync12(metaDir, { recursive: true });
|
|
17922
18073
|
writeFileSync7(
|
|
17923
|
-
|
|
18074
|
+
join36(metaDir, "composition.json"),
|
|
17924
18075
|
`${JSON.stringify(composition, null, 2)}
|
|
17925
18076
|
`,
|
|
17926
18077
|
"utf-8"
|
|
17927
18078
|
);
|
|
17928
18079
|
const encoderForCanonical = stripUndefined(encoder);
|
|
17929
18080
|
const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
|
|
17930
|
-
writeFileSync7(
|
|
17931
|
-
writeFileSync7(
|
|
18081
|
+
writeFileSync7(join36(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
|
|
18082
|
+
writeFileSync7(join36(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
|
|
17932
18083
|
`, "utf-8");
|
|
17933
18084
|
const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
|
|
17934
18085
|
const planHash = computePlanHash({
|
|
@@ -17953,7 +18104,7 @@ async function freezePlan(input) {
|
|
|
17953
18104
|
duration: durationSeconds,
|
|
17954
18105
|
hasAudio
|
|
17955
18106
|
};
|
|
17956
|
-
const planJsonPath =
|
|
18107
|
+
const planJsonPath = join36(planDir, "plan.json");
|
|
17957
18108
|
writeFileSync7(planJsonPath, `${JSON.stringify(planJson, null, 2)}
|
|
17958
18109
|
`, "utf-8");
|
|
17959
18110
|
return { planJsonPath, planHash };
|
|
@@ -17995,9 +18146,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
|
|
|
17995
18146
|
}
|
|
17996
18147
|
|
|
17997
18148
|
// ../producer/src/services/distributed/chunkAudio.ts
|
|
17998
|
-
import { closeSync as closeSync5, existsSync as
|
|
18149
|
+
import { closeSync as closeSync5, existsSync as existsSync25, ftruncateSync, mkdirSync as mkdirSync13, openSync as openSync5, readFileSync as readFileSync10 } from "fs";
|
|
17999
18150
|
import { writeFileSync as writeFileSync8, writeSync } from "fs";
|
|
18000
|
-
import { join as
|
|
18151
|
+
import { join as join37 } from "path";
|
|
18001
18152
|
function audioCutForChunk(grid, chunks, index, fps) {
|
|
18002
18153
|
const firstPacketAt = (frame) => Math.min(
|
|
18003
18154
|
grid.packetCount,
|
|
@@ -18084,7 +18235,7 @@ async function writeChunkAudioSlices(input) {
|
|
|
18084
18235
|
});
|
|
18085
18236
|
const bytes = readFileSync10(input.audioPath);
|
|
18086
18237
|
const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
|
|
18087
|
-
mkdirSync13(
|
|
18238
|
+
mkdirSync13(join37(input.planDir, SLICE_DIR), { recursive: true });
|
|
18088
18239
|
input.chunks.forEach((_, index) => {
|
|
18089
18240
|
const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
|
|
18090
18241
|
if (!cut) return;
|
|
@@ -18092,17 +18243,17 @@ async function writeChunkAudioSlices(input) {
|
|
|
18092
18243
|
const start = offsets[cut.firstPacket];
|
|
18093
18244
|
layout.partStarts[index] = start;
|
|
18094
18245
|
const end = offsets[last] + track.sizes[last];
|
|
18095
|
-
writeFileSync8(
|
|
18246
|
+
writeFileSync8(join37(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
|
|
18096
18247
|
});
|
|
18097
18248
|
const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
|
|
18098
|
-
writeFileSync8(
|
|
18099
|
-
writeFileSync8(
|
|
18249
|
+
writeFileSync8(join37(input.planDir, SLICE_FRAME), Buffer.concat(frame));
|
|
18250
|
+
writeFileSync8(join37(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
|
|
18100
18251
|
}
|
|
18101
18252
|
function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
18102
|
-
const layoutPath =
|
|
18103
|
-
if (!
|
|
18253
|
+
const layoutPath = join37(planDir, SLICE_LAYOUT);
|
|
18254
|
+
if (!existsSync25(layoutPath)) return resolvePlanAudioPath(planDir);
|
|
18104
18255
|
const layout = JSON.parse(readFileSync10(layoutPath, "utf-8"));
|
|
18105
|
-
const frame = readFileSync10(
|
|
18256
|
+
const frame = readFileSync10(join37(planDir, SLICE_FRAME));
|
|
18106
18257
|
const fd = openSync5(scratchPath, "w");
|
|
18107
18258
|
try {
|
|
18108
18259
|
writeSync(fd, frame, 0, layout.payloadStart, 0);
|
|
@@ -18115,7 +18266,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
|
18115
18266
|
);
|
|
18116
18267
|
const start = layout.partStarts[chunkIndex];
|
|
18117
18268
|
if (start !== void 0) {
|
|
18118
|
-
const part = readFileSync10(
|
|
18269
|
+
const part = readFileSync10(join37(planDir, chunkAudioSlicePath(chunkIndex)));
|
|
18119
18270
|
writeSync(fd, part, 0, part.length, start);
|
|
18120
18271
|
}
|
|
18121
18272
|
ftruncateSync(fd, layout.sizeBytes);
|
|
@@ -18170,8 +18321,8 @@ async function muxChunkWithAudio(input) {
|
|
|
18170
18321
|
|
|
18171
18322
|
// ../producer/src/services/distributed/planSize.ts
|
|
18172
18323
|
import { createHash as createHash7 } from "crypto";
|
|
18173
|
-
import { lstatSync as
|
|
18174
|
-
import { extname as extname5, join as
|
|
18324
|
+
import { lstatSync as lstatSync3, readdirSync as readdirSync9 } from "fs";
|
|
18325
|
+
import { extname as extname5, join as join38, relative as relative6 } from "path";
|
|
18175
18326
|
var MAX_TOP_COMPONENTS = 10;
|
|
18176
18327
|
var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
18177
18328
|
".aac",
|
|
@@ -18254,13 +18405,13 @@ function addCategoryBytes(result, category, filePath, sizeBytes) {
|
|
|
18254
18405
|
function recordFile(result, components, rootDir, rootKind, filePath) {
|
|
18255
18406
|
let sizeBytes;
|
|
18256
18407
|
try {
|
|
18257
|
-
const stat =
|
|
18408
|
+
const stat = lstatSync3(filePath);
|
|
18258
18409
|
if (!stat.isFile()) return;
|
|
18259
18410
|
sizeBytes = stat.size;
|
|
18260
18411
|
} catch {
|
|
18261
18412
|
return;
|
|
18262
18413
|
}
|
|
18263
|
-
const rel =
|
|
18414
|
+
const rel = relative6(rootDir, filePath);
|
|
18264
18415
|
const segments = rel.split(/[\\/]+/).filter(Boolean);
|
|
18265
18416
|
const classified = classifyFile(segments, rootKind);
|
|
18266
18417
|
result.totalBytes += sizeBytes;
|
|
@@ -18283,7 +18434,7 @@ function walkRegularFiles(dir, visit) {
|
|
|
18283
18434
|
return;
|
|
18284
18435
|
}
|
|
18285
18436
|
for (const entry of entries) {
|
|
18286
|
-
const full =
|
|
18437
|
+
const full = join38(dir, entry.name);
|
|
18287
18438
|
if (entry.isDirectory()) {
|
|
18288
18439
|
walkRegularFiles(full, visit);
|
|
18289
18440
|
} else if (entry.isFile()) {
|
|
@@ -18499,13 +18650,13 @@ function assertPositiveInteger2(name, value) {
|
|
|
18499
18650
|
}
|
|
18500
18651
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
18501
18652
|
"plan.json",
|
|
18502
|
-
|
|
18503
|
-
|
|
18504
|
-
|
|
18653
|
+
join39("meta", "composition.json"),
|
|
18654
|
+
join39("meta", "encoder.json"),
|
|
18655
|
+
join39("meta", "chunks.json")
|
|
18505
18656
|
];
|
|
18506
18657
|
function removeFreezeOwnedPlanFiles(planDir) {
|
|
18507
18658
|
for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
|
|
18508
|
-
rmSync12(
|
|
18659
|
+
rmSync12(join39(planDir, relativePath), { force: true });
|
|
18509
18660
|
}
|
|
18510
18661
|
}
|
|
18511
18662
|
function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
|
|
@@ -18644,16 +18795,16 @@ function resolveDistributedEngineConfig(config) {
|
|
|
18644
18795
|
};
|
|
18645
18796
|
}
|
|
18646
18797
|
function leavesRoot(rel) {
|
|
18647
|
-
return rel === ".." || rel.startsWith(`..${
|
|
18798
|
+
return rel === ".." || rel.startsWith(`..${sep4}`) || isAbsolute3(rel);
|
|
18648
18799
|
}
|
|
18649
18800
|
function pathInside(root, path) {
|
|
18650
|
-
const rel =
|
|
18801
|
+
const rel = relative7(root, path);
|
|
18651
18802
|
return rel === "" || leavesRoot(rel) ? null : rel;
|
|
18652
18803
|
}
|
|
18653
18804
|
function stableSourcePath(roots, srcPath) {
|
|
18654
18805
|
for (const [root, prefix] of roots) {
|
|
18655
18806
|
const rel = pathInside(root, srcPath);
|
|
18656
|
-
if (rel !== null) return [prefix, ...rel.split(
|
|
18807
|
+
if (rel !== null) return [prefix, ...rel.split(sep4)].filter(Boolean).join("/");
|
|
18657
18808
|
}
|
|
18658
18809
|
return srcPath;
|
|
18659
18810
|
}
|
|
@@ -18663,19 +18814,19 @@ function createVideoSourceShipper(input) {
|
|
|
18663
18814
|
const known = shipped.get(srcPath);
|
|
18664
18815
|
if (known) return known;
|
|
18665
18816
|
const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
|
|
18666
|
-
const current = stagedRel === null ? srcPath :
|
|
18817
|
+
const current = stagedRel === null ? srcPath : join39(input.planDir, "video-frames", stagedRel);
|
|
18667
18818
|
let result = null;
|
|
18668
18819
|
for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
|
|
18669
18820
|
const rel = pathInside(root, srcPath);
|
|
18670
|
-
if (rel !== null && (
|
|
18671
|
-
result = ["compiled", ...rel.split(
|
|
18821
|
+
if (rel !== null && (existsSync26(join39(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
|
|
18822
|
+
result = ["compiled", ...rel.split(sep4)].join("/");
|
|
18672
18823
|
break;
|
|
18673
18824
|
}
|
|
18674
18825
|
}
|
|
18675
18826
|
if (result === null) {
|
|
18676
18827
|
result = `video-sources/${shipped.size}${extname6(current)}`;
|
|
18677
|
-
const destination =
|
|
18678
|
-
mkdirSync14(
|
|
18828
|
+
const destination = join39(input.planDir, ...result.split("/"));
|
|
18829
|
+
mkdirSync14(join39(input.planDir, "video-sources"), { recursive: true });
|
|
18679
18830
|
try {
|
|
18680
18831
|
linkSync(current, destination);
|
|
18681
18832
|
} catch {
|
|
@@ -18695,7 +18846,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18695
18846
|
useGpu: false,
|
|
18696
18847
|
browserGpuMode: "software"
|
|
18697
18848
|
});
|
|
18698
|
-
if (!
|
|
18849
|
+
if (!existsSync26(planDir)) mkdirSync14(planDir, { recursive: true });
|
|
18699
18850
|
const log = config.logger ?? defaultLogger;
|
|
18700
18851
|
const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
|
|
18701
18852
|
const abortSignal = config.abortSignal;
|
|
@@ -18729,21 +18880,21 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18729
18880
|
includeOutsideScripts: options.includeOutsideScripts === true
|
|
18730
18881
|
});
|
|
18731
18882
|
const entryFile = config.entryFile ?? "index.html";
|
|
18732
|
-
const htmlPath =
|
|
18733
|
-
if (!
|
|
18883
|
+
const htmlPath = join39(projectDir, entryFile);
|
|
18884
|
+
if (!existsSync26(htmlPath)) {
|
|
18734
18885
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
18735
18886
|
}
|
|
18736
|
-
const workDir =
|
|
18887
|
+
const workDir = join39(planDir, ".plan-work");
|
|
18737
18888
|
rmSync12(workDir, { recursive: true, force: true });
|
|
18738
18889
|
mkdirSync14(workDir, { recursive: true });
|
|
18739
|
-
const compiledDir =
|
|
18890
|
+
const compiledDir = join39(workDir, "compiled");
|
|
18740
18891
|
mkdirSync14(compiledDir, { recursive: true });
|
|
18741
18892
|
let stageStarted = Date.now();
|
|
18742
18893
|
cpSync2(projectDir, compiledDir, {
|
|
18743
18894
|
recursive: true,
|
|
18744
18895
|
dereference: true,
|
|
18745
18896
|
filter: (src) => {
|
|
18746
|
-
const rel =
|
|
18897
|
+
const rel = relative7(projectDir, src);
|
|
18747
18898
|
if (rel === "") return true;
|
|
18748
18899
|
if (leavesRoot(rel)) return false;
|
|
18749
18900
|
if (job.config.allowOutsideProjectAssets) {
|
|
@@ -18751,15 +18902,15 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18751
18902
|
const policy = { includeScripts: job.config.includeOutsideScripts };
|
|
18752
18903
|
if (refusesOutsideLink(projectDir, src, warn, policy)) return false;
|
|
18753
18904
|
} else if (!isSafePath(projectDir, src)) return false;
|
|
18754
|
-
const firstSegment = rel.split(
|
|
18905
|
+
const firstSegment = rel.split(sep4, 1)[0];
|
|
18755
18906
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
18756
18907
|
}
|
|
18757
18908
|
});
|
|
18758
18909
|
logPlanStage(log, "copy", stageStarted);
|
|
18759
|
-
const finalCompiledDir =
|
|
18910
|
+
const finalCompiledDir = join39(planDir, "compiled");
|
|
18760
18911
|
const needsAlpha = outputNeedsAlpha(config.format);
|
|
18761
18912
|
const remoteFiles = Object.entries(options.remoteFiles ?? {});
|
|
18762
|
-
const remoteLocalPath = (rel) =>
|
|
18913
|
+
const remoteLocalPath = (rel) => join39(projectDir, ...rel.split("/"));
|
|
18763
18914
|
for (const [, file] of remoteFiles) {
|
|
18764
18915
|
declareContentAddressedUrl(file.url, file.sha256);
|
|
18765
18916
|
if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
|
|
@@ -18856,7 +19007,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18856
19007
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
18857
19008
|
if (probeResult.probeSession) {
|
|
18858
19009
|
try {
|
|
18859
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
19010
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-COKNEXLI.js");
|
|
18860
19011
|
await closeCaptureSession2(probeResult.probeSession);
|
|
18861
19012
|
} catch (err) {
|
|
18862
19013
|
log.warn("[plan] probe session close failed", {
|
|
@@ -18964,17 +19115,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
18964
19115
|
let stageStarted = Date.now();
|
|
18965
19116
|
const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
|
|
18966
19117
|
logPlanStage(log, "extract", stageStarted);
|
|
18967
|
-
const stagedVideoFrames =
|
|
18968
|
-
const videoFramesDst =
|
|
18969
|
-
if (
|
|
18970
|
-
const videoSourcesDir =
|
|
19118
|
+
const stagedVideoFrames = join39(compiledDir, "__hyperframes_video_frames");
|
|
19119
|
+
const videoFramesDst = join39(planDir, "video-frames");
|
|
19120
|
+
if (existsSync26(videoFramesDst)) rmSync12(videoFramesDst, { recursive: true, force: true });
|
|
19121
|
+
const videoSourcesDir = join39(planDir, "video-sources");
|
|
18971
19122
|
rmSync12(videoSourcesDir, { recursive: true, force: true });
|
|
18972
|
-
if (
|
|
19123
|
+
if (existsSync26(stagedVideoFrames)) {
|
|
18973
19124
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
18974
19125
|
} else {
|
|
18975
19126
|
mkdirSync14(videoFramesDst, { recursive: true });
|
|
18976
19127
|
}
|
|
18977
|
-
if (
|
|
19128
|
+
if (existsSync26(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
|
|
18978
19129
|
renameWithRetry(compiledDir, finalCompiledDir);
|
|
18979
19130
|
const shipVideoSource = createVideoSourceShipper({
|
|
18980
19131
|
planDir,
|
|
@@ -19004,7 +19155,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
19004
19155
|
};
|
|
19005
19156
|
})
|
|
19006
19157
|
});
|
|
19007
|
-
mkdirSync14(
|
|
19158
|
+
mkdirSync14(join39(planDir, "meta"), { recursive: true });
|
|
19008
19159
|
writePlanRemoteFiles(
|
|
19009
19160
|
planDir,
|
|
19010
19161
|
remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
|
|
@@ -19014,7 +19165,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
19014
19165
|
}))
|
|
19015
19166
|
);
|
|
19016
19167
|
writeFileSync9(
|
|
19017
|
-
|
|
19168
|
+
join39(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
19018
19169
|
JSON.stringify(planVideosJson, null, 2),
|
|
19019
19170
|
"utf-8"
|
|
19020
19171
|
);
|
|
@@ -19094,11 +19245,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
19094
19245
|
if (audioResult?.audioError) {
|
|
19095
19246
|
applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
|
|
19096
19247
|
}
|
|
19097
|
-
const planAudioPath =
|
|
19098
|
-
if (audioResult?.hasAudio &&
|
|
19248
|
+
const planAudioPath = join39(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
19249
|
+
if (audioResult?.hasAudio && existsSync26(audioResult.audioOutputPath)) {
|
|
19099
19250
|
renameWithRetry(audioResult.audioOutputPath, planAudioPath);
|
|
19100
19251
|
}
|
|
19101
|
-
if (chunksCarryAudio &&
|
|
19252
|
+
if (chunksCarryAudio && existsSync26(planAudioPath)) {
|
|
19102
19253
|
if (options.sliceChunkAudio) {
|
|
19103
19254
|
stageStarted = Date.now();
|
|
19104
19255
|
await writeChunkAudioSlices({
|
|
@@ -19220,14 +19371,14 @@ async function plan(projectDir, config, planDir, options = {}) {
|
|
|
19220
19371
|
|
|
19221
19372
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
19222
19373
|
import { randomBytes } from "crypto";
|
|
19223
|
-
import { existsSync as
|
|
19224
|
-
import { join as
|
|
19374
|
+
import { existsSync as existsSync29, mkdirSync as mkdirSync17, readFileSync as readFileSync12, readdirSync as readdirSync11, rmSync as rmSync15, writeFileSync as writeFileSync12 } from "fs";
|
|
19375
|
+
import { join as join43 } from "path";
|
|
19225
19376
|
|
|
19226
19377
|
// ../producer/src/services/distributed/planV2.ts
|
|
19227
19378
|
import {
|
|
19228
19379
|
copyFileSync as copyFileSync6,
|
|
19229
|
-
existsSync as
|
|
19230
|
-
lstatSync as
|
|
19380
|
+
existsSync as existsSync28,
|
|
19381
|
+
lstatSync as lstatSync4,
|
|
19231
19382
|
mkdirSync as mkdirSync16,
|
|
19232
19383
|
readFileSync as readFileSync11,
|
|
19233
19384
|
readdirSync as readdirSync10,
|
|
@@ -19235,20 +19386,20 @@ import {
|
|
|
19235
19386
|
statSync as statSync10,
|
|
19236
19387
|
writeFileSync as writeFileSync11
|
|
19237
19388
|
} from "fs";
|
|
19238
|
-
import { tmpdir as
|
|
19239
|
-
import { dirname as dirname16, isAbsolute as
|
|
19389
|
+
import { tmpdir as tmpdir4 } from "os";
|
|
19390
|
+
import { dirname as dirname16, isAbsolute as isAbsolute4, join as join42, relative as relative8, resolve as resolve9, sep as sep5 } from "path";
|
|
19240
19391
|
|
|
19241
19392
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
19242
19393
|
import {
|
|
19243
19394
|
copyFileSync as copyFileSync5,
|
|
19244
|
-
existsSync as
|
|
19395
|
+
existsSync as existsSync27,
|
|
19245
19396
|
linkSync as linkSync2,
|
|
19246
19397
|
mkdirSync as mkdirSync15,
|
|
19247
19398
|
rmSync as rmSync13,
|
|
19248
19399
|
statSync as statSync9,
|
|
19249
19400
|
writeFileSync as writeFileSync10
|
|
19250
19401
|
} from "fs";
|
|
19251
|
-
import { dirname as dirname15, join as
|
|
19402
|
+
import { dirname as dirname15, join as join41 } from "path";
|
|
19252
19403
|
|
|
19253
19404
|
// ../producer/src/services/distributed/planV2Errors.ts
|
|
19254
19405
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -19263,7 +19414,7 @@ var PlanV2IntegrityError = class extends Error {
|
|
|
19263
19414
|
};
|
|
19264
19415
|
|
|
19265
19416
|
// ../producer/src/services/distributed/planV2Layout.ts
|
|
19266
|
-
import { join as
|
|
19417
|
+
import { join as join40 } from "path";
|
|
19267
19418
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
19268
19419
|
function assertPlanV2Sha256(value, field) {
|
|
19269
19420
|
if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
|
|
@@ -19273,7 +19424,7 @@ function assertPlanV2Sha256(value, field) {
|
|
|
19273
19424
|
}
|
|
19274
19425
|
function planV2BlobPath(root, sha256) {
|
|
19275
19426
|
const digest = assertPlanV2Sha256(sha256, "artifact sha256");
|
|
19276
|
-
return
|
|
19427
|
+
return join40(root, "artifacts", "sha256", digest.slice(0, 2), digest);
|
|
19277
19428
|
}
|
|
19278
19429
|
|
|
19279
19430
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
@@ -19303,7 +19454,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19303
19454
|
#linkFile;
|
|
19304
19455
|
#committed = false;
|
|
19305
19456
|
constructor(destinationDir, options = {}) {
|
|
19306
|
-
if (
|
|
19457
|
+
if (existsSync27(destinationDir)) {
|
|
19307
19458
|
throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
|
|
19308
19459
|
}
|
|
19309
19460
|
this.destinationDir = destinationDir;
|
|
@@ -19320,10 +19471,10 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19320
19471
|
);
|
|
19321
19472
|
}
|
|
19322
19473
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
19323
|
-
if (
|
|
19474
|
+
if (existsSync27(destinationPath)) return;
|
|
19324
19475
|
mkdirSync15(dirname15(destinationPath), { recursive: true });
|
|
19325
19476
|
const stagingDir = createStagingDir(dirname15(destinationPath), ".plan-v2-blob-");
|
|
19326
|
-
const temporaryPath =
|
|
19477
|
+
const temporaryPath = join41(stagingDir, "blob");
|
|
19327
19478
|
try {
|
|
19328
19479
|
try {
|
|
19329
19480
|
this.#linkFile(blob.sourcePath, temporaryPath);
|
|
@@ -19338,13 +19489,13 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19338
19489
|
}
|
|
19339
19490
|
async commitManifest(manifestBytes) {
|
|
19340
19491
|
for (const digest of new Set(manifestDigests(manifestBytes))) {
|
|
19341
|
-
if (!
|
|
19492
|
+
if (!existsSync27(planV2BlobPath(this.temporaryDir, digest))) {
|
|
19342
19493
|
throw new PlanV2IntegrityError(
|
|
19343
19494
|
`cannot commit manifest before referenced blob is durable: ${digest}`
|
|
19344
19495
|
);
|
|
19345
19496
|
}
|
|
19346
19497
|
}
|
|
19347
|
-
writeFileSync10(
|
|
19498
|
+
writeFileSync10(join41(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
19348
19499
|
renameWithRetry(this.temporaryDir, this.destinationDir);
|
|
19349
19500
|
this.#committed = true;
|
|
19350
19501
|
}
|
|
@@ -19380,21 +19531,21 @@ function readJsonFile(path, label) {
|
|
|
19380
19531
|
}
|
|
19381
19532
|
function assertSafeRelativePath(path) {
|
|
19382
19533
|
const normalized = path.split(/[\\/]+/);
|
|
19383
|
-
if (path.length === 0 ||
|
|
19534
|
+
if (path.length === 0 || isAbsolute4(path) || normalized.some((part) => part === "" || part === "." || part === "..")) {
|
|
19384
19535
|
throw new PlanV2IntegrityError(`unsafe artifact path: ${JSON.stringify(path)}`);
|
|
19385
19536
|
}
|
|
19386
19537
|
}
|
|
19387
19538
|
function listFiles(root) {
|
|
19388
19539
|
const files = [];
|
|
19389
|
-
const rootResolved =
|
|
19540
|
+
const rootResolved = resolve9(root);
|
|
19390
19541
|
function walk(dir) {
|
|
19391
19542
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
19392
|
-
const absolutePath =
|
|
19543
|
+
const absolutePath = join42(dir, entry.name);
|
|
19393
19544
|
if (entry.isDirectory()) {
|
|
19394
19545
|
walk(absolutePath);
|
|
19395
19546
|
} else if (entry.isFile()) {
|
|
19396
19547
|
files.push({
|
|
19397
|
-
path:
|
|
19548
|
+
path: relative8(rootResolved, absolutePath).split(sep5).join("/"),
|
|
19398
19549
|
absolutePath
|
|
19399
19550
|
});
|
|
19400
19551
|
} else {
|
|
@@ -19408,7 +19559,7 @@ function listFiles(root) {
|
|
|
19408
19559
|
return files.sort((a, b) => a.path.localeCompare(b.path));
|
|
19409
19560
|
}
|
|
19410
19561
|
function assertValidExtractionCacheCompleteSentinel(path) {
|
|
19411
|
-
const sentinel =
|
|
19562
|
+
const sentinel = lstatSync4(path);
|
|
19412
19563
|
if (!sentinel.isFile() || sentinel.size !== 0) {
|
|
19413
19564
|
throw new PlanV2IntegrityError(
|
|
19414
19565
|
`${EXTRACTION_CACHE_COMPLETE_SENTINEL} must be a zero-byte regular file`
|
|
@@ -19416,13 +19567,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
|
|
|
19416
19567
|
}
|
|
19417
19568
|
}
|
|
19418
19569
|
function validateExtractionCacheCompleteSentinels(executionPlanDir) {
|
|
19419
|
-
const videoRoot =
|
|
19420
|
-
if (!
|
|
19570
|
+
const videoRoot = join42(executionPlanDir, "video-frames");
|
|
19571
|
+
if (!existsSync28(videoRoot)) return;
|
|
19421
19572
|
for (const videoEntry of readdirSync10(videoRoot, { withFileTypes: true })) {
|
|
19422
19573
|
if (!videoEntry.isDirectory()) continue;
|
|
19423
|
-
const videoDir =
|
|
19574
|
+
const videoDir = join42(videoRoot, videoEntry.name);
|
|
19424
19575
|
if (readdirSync10(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
|
|
19425
|
-
const sentinelPath =
|
|
19576
|
+
const sentinelPath = join42(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
|
|
19426
19577
|
assertValidExtractionCacheCompleteSentinel(sentinelPath);
|
|
19427
19578
|
}
|
|
19428
19579
|
}
|
|
@@ -19432,9 +19583,9 @@ function isExtractionCacheCompleteSentinelPath(path) {
|
|
|
19432
19583
|
return segments.length === 3 && segments[0] === "video-frames" && segments[1] !== "" && segments[2] === EXTRACTION_CACHE_COMPLETE_SENTINEL;
|
|
19433
19584
|
}
|
|
19434
19585
|
function resolveExtractedVideoOutputDir(planDir, videoId) {
|
|
19435
|
-
const videoRoot =
|
|
19436
|
-
const outputDir =
|
|
19437
|
-
if (outputDir === videoRoot || !outputDir.startsWith(`${videoRoot}${
|
|
19586
|
+
const videoRoot = resolve9(planDir, "video-frames");
|
|
19587
|
+
const outputDir = resolve9(videoRoot, mediaIdPathSegment(videoId));
|
|
19588
|
+
if (outputDir === videoRoot || !outputDir.startsWith(`${videoRoot}${sep5}`)) {
|
|
19438
19589
|
throw new PlanV2IntegrityError(`unsafe extracted video id: ${JSON.stringify(videoId)}`);
|
|
19439
19590
|
}
|
|
19440
19591
|
return outputDir;
|
|
@@ -19469,7 +19620,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19469
19620
|
if (video.deferredRange) {
|
|
19470
19621
|
const framePaths2 = /* @__PURE__ */ new Map();
|
|
19471
19622
|
for (let index = 0; index < video.totalFrames; index++) {
|
|
19472
|
-
framePaths2.set(index,
|
|
19623
|
+
framePaths2.set(index, join42(outputDir, String(index)));
|
|
19473
19624
|
}
|
|
19474
19625
|
return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
|
|
19475
19626
|
}
|
|
@@ -19477,7 +19628,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19477
19628
|
const framePaths = /* @__PURE__ */ new Map();
|
|
19478
19629
|
for (const frameName of frameNames) {
|
|
19479
19630
|
if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
|
|
19480
|
-
assertValidExtractionCacheCompleteSentinel(
|
|
19631
|
+
assertValidExtractionCacheCompleteSentinel(join42(outputDir, frameName));
|
|
19481
19632
|
continue;
|
|
19482
19633
|
}
|
|
19483
19634
|
const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
|
|
@@ -19496,7 +19647,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19496
19647
|
`duplicate extracted frame index ${frameIndex} in ${outputDir}`
|
|
19497
19648
|
);
|
|
19498
19649
|
}
|
|
19499
|
-
framePaths.set(frameIndex,
|
|
19650
|
+
framePaths.set(frameIndex, join42(outputDir, frameName));
|
|
19500
19651
|
}
|
|
19501
19652
|
return {
|
|
19502
19653
|
...video,
|
|
@@ -19517,8 +19668,8 @@ function parsePlanVideosJson2(value) {
|
|
|
19517
19668
|
}
|
|
19518
19669
|
}
|
|
19519
19670
|
function materializeExtractedVideoDirectories(planDir) {
|
|
19520
|
-
const videosPath =
|
|
19521
|
-
if (!
|
|
19671
|
+
const videosPath = join42(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
19672
|
+
if (!existsSync28(videosPath)) return;
|
|
19522
19673
|
const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
|
|
19523
19674
|
for (const video of videos.extracted) {
|
|
19524
19675
|
mkdirSync16(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
|
|
@@ -19551,13 +19702,13 @@ function parseChunkSlices(value) {
|
|
|
19551
19702
|
});
|
|
19552
19703
|
}
|
|
19553
19704
|
function buildVideoChunkDependencies(executionPlanDir, dimensions) {
|
|
19554
|
-
const videoRoot =
|
|
19555
|
-
const hasExtractedFrames =
|
|
19556
|
-
const videosPath =
|
|
19557
|
-
if (!
|
|
19705
|
+
const videoRoot = join42(executionPlanDir, "video-frames");
|
|
19706
|
+
const hasExtractedFrames = existsSync28(videoRoot) && listFiles(videoRoot).length > 0;
|
|
19707
|
+
const videosPath = join42(executionPlanDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
19708
|
+
if (!existsSync28(videosPath)) {
|
|
19558
19709
|
return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
|
|
19559
19710
|
}
|
|
19560
|
-
const chunksPath =
|
|
19711
|
+
const chunksPath = join42(executionPlanDir, "meta", "chunks.json");
|
|
19561
19712
|
const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
19562
19713
|
const chunks = readJsonFile(chunksPath, "meta/chunks.json");
|
|
19563
19714
|
const parsedVideos = parsePlanVideosJson2(videos);
|
|
@@ -19594,7 +19745,7 @@ function collectChunkVideoDependencies(input) {
|
|
|
19594
19745
|
for (let frame = chunk.startFrame; frame < chunk.endFrame; frame++) {
|
|
19595
19746
|
const globalTime = frame * input.fpsDen / input.fpsNum;
|
|
19596
19747
|
for (const [videoId, payload] of input.table.getActiveFramePayloads(globalTime)) {
|
|
19597
|
-
const path = input.deferredSources.get(videoId) ??
|
|
19748
|
+
const path = input.deferredSources.get(videoId) ?? relative8(resolve9(input.executionPlanDir), payload.framePath).split(sep5).join("/");
|
|
19598
19749
|
assertSafeRelativePath(path);
|
|
19599
19750
|
const indexes = mutable.get(path) ?? /* @__PURE__ */ new Set();
|
|
19600
19751
|
indexes.add(chunk.index);
|
|
@@ -19611,10 +19762,10 @@ function computeManifestHash(manifest) {
|
|
|
19611
19762
|
return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
|
|
19612
19763
|
}
|
|
19613
19764
|
function writeBlob(sourcePath, destinationPath) {
|
|
19614
|
-
if (
|
|
19765
|
+
if (existsSync28(destinationPath)) return;
|
|
19615
19766
|
mkdirSync16(dirname16(destinationPath), { recursive: true });
|
|
19616
19767
|
const temporaryDir = createStagingDir(dirname16(destinationPath), ".plan-v2-blob-");
|
|
19617
|
-
const temporaryPath =
|
|
19768
|
+
const temporaryPath = join42(temporaryDir, "blob");
|
|
19618
19769
|
try {
|
|
19619
19770
|
copyFileSync6(sourcePath, temporaryPath);
|
|
19620
19771
|
renameWithRetry(temporaryPath, destinationPath);
|
|
@@ -19650,8 +19801,8 @@ async function putTasks(tasks) {
|
|
|
19650
19801
|
if (failure) throw failure.reason;
|
|
19651
19802
|
}
|
|
19652
19803
|
function buildPlanV2Publication(executionPlanDir, digests) {
|
|
19653
|
-
const executionPlanPath =
|
|
19654
|
-
if (!
|
|
19804
|
+
const executionPlanPath = join42(executionPlanDir, "plan.json");
|
|
19805
|
+
if (!existsSync28(executionPlanPath)) {
|
|
19655
19806
|
throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
|
|
19656
19807
|
}
|
|
19657
19808
|
const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
|
|
@@ -19678,7 +19829,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
19678
19829
|
}
|
|
19679
19830
|
validateExtractionCacheCompleteSentinels(executionPlanDir);
|
|
19680
19831
|
const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
|
|
19681
|
-
const encoder = readJsonFile(
|
|
19832
|
+
const encoder = readJsonFile(join42(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
|
|
19682
19833
|
const files = listFiles(executionPlanDir);
|
|
19683
19834
|
const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
|
|
19684
19835
|
for (const file of files) {
|
|
@@ -19731,7 +19882,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
19731
19882
|
};
|
|
19732
19883
|
}
|
|
19733
19884
|
function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
19734
|
-
if (
|
|
19885
|
+
if (existsSync28(planV2Dir)) {
|
|
19735
19886
|
throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
|
|
19736
19887
|
}
|
|
19737
19888
|
const publication = buildPlanV2Publication(executionPlanDir);
|
|
@@ -19745,7 +19896,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
19745
19896
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
19746
19897
|
}
|
|
19747
19898
|
writeFileSync11(
|
|
19748
|
-
|
|
19899
|
+
join42(tempDir, "plan.json"),
|
|
19749
19900
|
canonicalJsonStringify(publication.manifest),
|
|
19750
19901
|
"utf-8"
|
|
19751
19902
|
);
|
|
@@ -19786,7 +19937,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
|
|
|
19786
19937
|
}
|
|
19787
19938
|
}
|
|
19788
19939
|
async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
|
|
19789
|
-
const stagingRoot = createStagingDir(options.stagingParentDir ??
|
|
19940
|
+
const stagingRoot = createStagingDir(options.stagingParentDir ?? tmpdir4(), ".execution-plan-");
|
|
19790
19941
|
const digests = /* @__PURE__ */ new Map();
|
|
19791
19942
|
try {
|
|
19792
19943
|
const planned = await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
@@ -19797,7 +19948,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19797
19948
|
// artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
|
|
19798
19949
|
whileAudioMixes: () => putBlobs(
|
|
19799
19950
|
publisher,
|
|
19800
|
-
listFiles(
|
|
19951
|
+
listFiles(join42(stagingRoot, "compiled")).map(
|
|
19801
19952
|
(file) => publishBlobFor(file.absolutePath, digests)
|
|
19802
19953
|
)
|
|
19803
19954
|
),
|
|
@@ -19821,7 +19972,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19821
19972
|
}
|
|
19822
19973
|
}
|
|
19823
19974
|
async function planV2(projectDir, config, planV2Dir) {
|
|
19824
|
-
if (
|
|
19975
|
+
if (existsSync28(planV2Dir)) {
|
|
19825
19976
|
throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
|
|
19826
19977
|
}
|
|
19827
19978
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
@@ -19838,7 +19989,7 @@ function resultFromManifest(planV2Dir, manifest) {
|
|
|
19838
19989
|
isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
|
|
19839
19990
|
),
|
|
19840
19991
|
planDir: planV2Dir,
|
|
19841
|
-
manifestPath:
|
|
19992
|
+
manifestPath: join42(planV2Dir, "plan.json"),
|
|
19842
19993
|
planProtocol: PLAN_PROTOCOL_V2,
|
|
19843
19994
|
planHash: manifest.planHash,
|
|
19844
19995
|
sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
|
|
@@ -19974,8 +20125,8 @@ function parsePlanV2Manifest(value) {
|
|
|
19974
20125
|
return parsed;
|
|
19975
20126
|
}
|
|
19976
20127
|
function readPlanV2Manifest(planV2Dir) {
|
|
19977
|
-
const manifestPath =
|
|
19978
|
-
if (!
|
|
20128
|
+
const manifestPath = join42(planV2Dir, "plan.json");
|
|
20129
|
+
if (!existsSync28(manifestPath)) {
|
|
19979
20130
|
throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
|
|
19980
20131
|
}
|
|
19981
20132
|
const value = readJsonFile(manifestPath, "v2 manifest");
|
|
@@ -19994,7 +20145,7 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
|
|
|
19994
20145
|
}
|
|
19995
20146
|
function verifyBlob(planV2Dir, artifact) {
|
|
19996
20147
|
const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
|
|
19997
|
-
if (!
|
|
20148
|
+
if (!existsSync28(sourcePath)) {
|
|
19998
20149
|
throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
|
|
19999
20150
|
}
|
|
20000
20151
|
const stats = statSync10(sourcePath);
|
|
@@ -20007,7 +20158,7 @@ function verifyBlob(planV2Dir, artifact) {
|
|
|
20007
20158
|
return sourcePath;
|
|
20008
20159
|
}
|
|
20009
20160
|
function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
|
|
20010
|
-
if (
|
|
20161
|
+
if (existsSync28(destinationDir)) {
|
|
20011
20162
|
throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
|
|
20012
20163
|
}
|
|
20013
20164
|
const manifest = readPlanV2Manifest(planV2Dir);
|
|
@@ -20023,13 +20174,13 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
20023
20174
|
const tempDir = createStagingDir(dirname16(destinationDir), ".plan-v2-materialize-");
|
|
20024
20175
|
try {
|
|
20025
20176
|
for (const { artifact, sourcePath } of verified) {
|
|
20026
|
-
const destinationPath =
|
|
20177
|
+
const destinationPath = join42(tempDir, ...artifact.path.split("/"));
|
|
20027
20178
|
mkdirSync16(dirname16(destinationPath), { recursive: true });
|
|
20028
20179
|
copyFileSync6(sourcePath, destinationPath);
|
|
20029
20180
|
}
|
|
20030
20181
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
20031
20182
|
writeFileSync11(
|
|
20032
|
-
|
|
20183
|
+
join42(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
|
|
20033
20184
|
canonicalJsonStringify({
|
|
20034
20185
|
manifest,
|
|
20035
20186
|
target,
|
|
@@ -20052,7 +20203,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
20052
20203
|
// Join the artifact's OWN name, not the current constant: a plan written
|
|
20053
20204
|
// before the container change carries the legacy name, and materializing it
|
|
20054
20205
|
// under the new one would point at a file that was never written.
|
|
20055
|
-
audioPath: target.role === "assembler" ? audioArtifact ?
|
|
20206
|
+
audioPath: target.role === "assembler" ? audioArtifact ? join42(destinationDir, audioArtifact.path) : null : null
|
|
20056
20207
|
};
|
|
20057
20208
|
}
|
|
20058
20209
|
function assertRemoteSources(remoteSources, artifacts) {
|
|
@@ -20071,8 +20222,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
|
|
|
20071
20222
|
return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
|
|
20072
20223
|
}
|
|
20073
20224
|
function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
20074
|
-
const markerPath =
|
|
20075
|
-
if (!
|
|
20225
|
+
const markerPath = join42(planDir, PLAN_V2_MATERIALIZATION_MARKER);
|
|
20226
|
+
if (!existsSync28(markerPath)) return null;
|
|
20076
20227
|
const marker = readJsonFile(markerPath, "materialization marker");
|
|
20077
20228
|
if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
|
|
20078
20229
|
throw new PlanV2IntegrityError("malformed materialization marker");
|
|
@@ -20089,8 +20240,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
20089
20240
|
assertRemoteSources(remoteSources, required);
|
|
20090
20241
|
for (const artifact of required) {
|
|
20091
20242
|
if (Object.hasOwn(remoteSources, artifact.path)) continue;
|
|
20092
|
-
const path =
|
|
20093
|
-
if (!
|
|
20243
|
+
const path = join42(planDir, ...artifact.path.split("/"));
|
|
20244
|
+
if (!existsSync28(path) || statSync10(path).size !== artifact.sizeBytes) {
|
|
20094
20245
|
throw new PlanV2IntegrityError(
|
|
20095
20246
|
`materialized artifact missing or truncated: ${artifact.path}`
|
|
20096
20247
|
);
|
|
@@ -20220,7 +20371,7 @@ function hashChunkOutput(outputPath, kind) {
|
|
|
20220
20371
|
if (kind === "file") return sha256Hex(readFileSync12(outputPath));
|
|
20221
20372
|
const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
20222
20373
|
const lines = entries.map(
|
|
20223
|
-
(name) => `${name}\0${sha256Hex(readFileSync12(
|
|
20374
|
+
(name) => `${name}\0${sha256Hex(readFileSync12(join43(outputPath, name)))}`
|
|
20224
20375
|
);
|
|
20225
20376
|
return sha256Hex(lines.join("\0"));
|
|
20226
20377
|
}
|
|
@@ -20237,10 +20388,10 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
|
|
|
20237
20388
|
async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
20238
20389
|
const start = Date.now();
|
|
20239
20390
|
const log = defaultLogger;
|
|
20240
|
-
const planJsonPath =
|
|
20241
|
-
const encoderJsonPath =
|
|
20242
|
-
const chunksJsonPath =
|
|
20243
|
-
if (!
|
|
20391
|
+
const planJsonPath = join43(planDir, "plan.json");
|
|
20392
|
+
const encoderJsonPath = join43(planDir, "meta", "encoder.json");
|
|
20393
|
+
const chunksJsonPath = join43(planDir, "meta", "chunks.json");
|
|
20394
|
+
if (!existsSync29(planJsonPath)) {
|
|
20244
20395
|
throw new RenderChunkValidationError(
|
|
20245
20396
|
MISSING_PLAN_ARTIFACT,
|
|
20246
20397
|
`[renderChunk] planDir is missing required artifact: ${planJsonPath}`
|
|
@@ -20256,7 +20407,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20256
20407
|
const v2Manifest = v2Materialization?.manifest ?? null;
|
|
20257
20408
|
const remoteSources = v2Materialization?.remoteSources ?? {};
|
|
20258
20409
|
for (const required of [encoderJsonPath, chunksJsonPath]) {
|
|
20259
|
-
if (!
|
|
20410
|
+
if (!existsSync29(required)) {
|
|
20260
20411
|
throw new RenderChunkValidationError(
|
|
20261
20412
|
MISSING_PLAN_ARTIFACT,
|
|
20262
20413
|
`[renderChunk] planDir is missing required artifact: ${required}`
|
|
@@ -20265,9 +20416,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20265
20416
|
}
|
|
20266
20417
|
const encoder = JSON.parse(readFileSync12(encoderJsonPath, "utf-8"));
|
|
20267
20418
|
const chunks = JSON.parse(readFileSync12(chunksJsonPath, "utf-8"));
|
|
20268
|
-
const videosJsonPath =
|
|
20419
|
+
const videosJsonPath = join43(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
20269
20420
|
let planVideos = null;
|
|
20270
|
-
if (
|
|
20421
|
+
if (existsSync29(videosJsonPath)) {
|
|
20271
20422
|
try {
|
|
20272
20423
|
planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync12(videosJsonPath, "utf-8")));
|
|
20273
20424
|
} catch (err) {
|
|
@@ -20297,8 +20448,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20297
20448
|
}
|
|
20298
20449
|
const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
|
|
20299
20450
|
const framesInChunk = range.endFrame - range.startFrame;
|
|
20300
|
-
const compiledDir =
|
|
20301
|
-
if (!
|
|
20451
|
+
const compiledDir = join43(planDir, "compiled");
|
|
20452
|
+
if (!existsSync29(compiledDir)) {
|
|
20302
20453
|
throw new RenderChunkValidationError(
|
|
20303
20454
|
MISSING_PLAN_ARTIFACT,
|
|
20304
20455
|
`[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
|
|
@@ -20356,7 +20507,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20356
20507
|
};
|
|
20357
20508
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
20358
20509
|
mkdirSync17(workDir, { recursive: true });
|
|
20359
|
-
const framesDir =
|
|
20510
|
+
const framesDir = join43(workDir, "captured-frames");
|
|
20360
20511
|
mkdirSync17(framesDir, { recursive: true });
|
|
20361
20512
|
const videoFramesDir = `${workDir}.video-frames`;
|
|
20362
20513
|
const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
|
|
@@ -20381,7 +20532,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20381
20532
|
dimensions: plan2.dimensions,
|
|
20382
20533
|
encoder,
|
|
20383
20534
|
videoCount: planVideos?.videos.length ?? 0,
|
|
20384
|
-
html: readFileSync12(
|
|
20535
|
+
html: readFileSync12(join43(compiledDir, "index.html"), "utf-8"),
|
|
20385
20536
|
// The plan ships a deferred source only to chunks that show it; don't wait on the rest.
|
|
20386
20537
|
skipReadinessVideoIds: deferredVideos.filter(
|
|
20387
20538
|
(video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
|
|
@@ -20415,8 +20566,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20415
20566
|
const verifyInWorker = chunkWorkerCount > 1 && !forceScreenshotForChunk;
|
|
20416
20567
|
let boxesMeasured;
|
|
20417
20568
|
let boxesFailed;
|
|
20418
|
-
const boxesReady = new Promise((
|
|
20419
|
-
boxesMeasured =
|
|
20569
|
+
const boxesReady = new Promise((resolve12, reject) => {
|
|
20570
|
+
boxesMeasured = resolve12;
|
|
20420
20571
|
boxesFailed = reject;
|
|
20421
20572
|
});
|
|
20422
20573
|
boxesReady.catch(() => {
|
|
@@ -20550,10 +20701,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20550
20701
|
const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
|
|
20551
20702
|
const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
|
|
20552
20703
|
if (isPngSequence) {
|
|
20553
|
-
if (!
|
|
20704
|
+
if (!existsSync29(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
|
|
20554
20705
|
} else {
|
|
20555
|
-
const outDir =
|
|
20556
|
-
if (!
|
|
20706
|
+
const outDir = join43(outputChunkPath, "..");
|
|
20707
|
+
if (!existsSync29(outDir)) mkdirSync17(outDir, { recursive: true });
|
|
20557
20708
|
}
|
|
20558
20709
|
const encodeInput = {
|
|
20559
20710
|
job,
|
|
@@ -20829,10 +20980,10 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20829
20980
|
if (config.cfr === true) {
|
|
20830
20981
|
throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
|
|
20831
20982
|
}
|
|
20832
|
-
const workDir = mkdtempSync(
|
|
20983
|
+
const workDir = mkdtempSync(join44(tmpdir5(), "hf-render-span-"));
|
|
20833
20984
|
try {
|
|
20834
|
-
const planDir =
|
|
20835
|
-
const partsDir =
|
|
20985
|
+
const planDir = join44(workDir, "plan");
|
|
20986
|
+
const partsDir = join44(workDir, "parts");
|
|
20836
20987
|
mkdirSync18(partsDir, { recursive: true });
|
|
20837
20988
|
const planned = await plan(
|
|
20838
20989
|
projectDir,
|
|
@@ -20851,7 +21002,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20851
21002
|
planned.totalFrames
|
|
20852
21003
|
);
|
|
20853
21004
|
const slices = JSON.parse(
|
|
20854
|
-
readFileSync13(
|
|
21005
|
+
readFileSync13(join44(planDir, "meta", "chunks.json"), "utf-8")
|
|
20855
21006
|
);
|
|
20856
21007
|
const parts = [];
|
|
20857
21008
|
for (const slice of slices) {
|
|
@@ -20861,7 +21012,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20861
21012
|
};
|
|
20862
21013
|
if (range.endFrame <= range.startFrame) continue;
|
|
20863
21014
|
throwIfAborted(config.abortSignal);
|
|
20864
|
-
const part =
|
|
21015
|
+
const part = join44(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
|
|
20865
21016
|
await renderChunk(planDir, slice.index, part, { frameRange: range });
|
|
20866
21017
|
parts.push(part);
|
|
20867
21018
|
}
|
|
@@ -21476,7 +21627,7 @@ function renderRequestFromDistributedConfig(input) {
|
|
|
21476
21627
|
|
|
21477
21628
|
// ../producer/src/server.ts
|
|
21478
21629
|
import {
|
|
21479
|
-
existsSync as
|
|
21630
|
+
existsSync as existsSync32,
|
|
21480
21631
|
mkdirSync as mkdirSync19,
|
|
21481
21632
|
statSync as statSync12,
|
|
21482
21633
|
mkdtempSync as mkdtempSync2,
|
|
@@ -21484,8 +21635,8 @@ import {
|
|
|
21484
21635
|
rmSync as rmSync17,
|
|
21485
21636
|
createReadStream as createReadStream5
|
|
21486
21637
|
} from "fs";
|
|
21487
|
-
import { resolve as
|
|
21488
|
-
import { tmpdir as
|
|
21638
|
+
import { resolve as resolve11, dirname as dirname19, join as join47 } from "path";
|
|
21639
|
+
import { tmpdir as tmpdir6 } from "os";
|
|
21489
21640
|
import { parseArgs } from "util";
|
|
21490
21641
|
import { isIP } from "net";
|
|
21491
21642
|
import crypto from "crypto";
|
|
@@ -21495,7 +21646,7 @@ import { serve as serve2 } from "@hono/node-server";
|
|
|
21495
21646
|
|
|
21496
21647
|
// ../producer/src/services/hyperframeLint.ts
|
|
21497
21648
|
import {
|
|
21498
|
-
existsSync as
|
|
21649
|
+
existsSync as existsSync30,
|
|
21499
21650
|
readFileSync as readFileSync14,
|
|
21500
21651
|
statSync as statSync11,
|
|
21501
21652
|
openSync as openSync6,
|
|
@@ -21503,7 +21654,7 @@ import {
|
|
|
21503
21654
|
closeSync as closeSync6,
|
|
21504
21655
|
constants as constants3
|
|
21505
21656
|
} from "fs";
|
|
21506
|
-
import { resolve as
|
|
21657
|
+
import { resolve as resolve10, join as join45, relative as relative9, isAbsolute as isAbsolute5, sep as sep6, dirname as dirname17 } from "path";
|
|
21507
21658
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
21508
21659
|
import { Worker as Worker2 } from "worker_threads";
|
|
21509
21660
|
function isStringRecord(value) {
|
|
@@ -21549,19 +21700,19 @@ function readEntryHtml(filePath) {
|
|
|
21549
21700
|
}
|
|
21550
21701
|
}
|
|
21551
21702
|
function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
21552
|
-
const entryRelativePath =
|
|
21553
|
-
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${
|
|
21703
|
+
const entryRelativePath = relative9(absProjectDir, absoluteEntryPath);
|
|
21704
|
+
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep6}`) || isAbsolute5(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
|
|
21554
21705
|
}
|
|
21555
21706
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
21556
|
-
const absProjectDir =
|
|
21557
|
-
if (!
|
|
21707
|
+
const absProjectDir = resolve10(projectDir);
|
|
21708
|
+
if (!existsSync30(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
21558
21709
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
21559
21710
|
}
|
|
21560
21711
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
21561
21712
|
(value) => typeof value === "string" && value.trim().length > 0
|
|
21562
21713
|
);
|
|
21563
21714
|
for (const entryFile of entryCandidates) {
|
|
21564
|
-
const absoluteEntryPath =
|
|
21715
|
+
const absoluteEntryPath = resolve10(absProjectDir, entryFile);
|
|
21565
21716
|
if (leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry)) {
|
|
21566
21717
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
21567
21718
|
}
|
|
@@ -21575,7 +21726,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
|
21575
21726
|
}
|
|
21576
21727
|
}
|
|
21577
21728
|
return {
|
|
21578
|
-
error: `No HTML entry file found in project directory: ${
|
|
21729
|
+
error: `No HTML entry file found in project directory: ${join45(absProjectDir, preferredEntryFile || "index.html")}`
|
|
21579
21730
|
};
|
|
21580
21731
|
}
|
|
21581
21732
|
function prepareHyperframeLintBody(body, isAllowedEntry) {
|
|
@@ -21621,16 +21772,16 @@ function takeLintSlot(limit, waitMs) {
|
|
|
21621
21772
|
running++;
|
|
21622
21773
|
return Promise.resolve(true);
|
|
21623
21774
|
}
|
|
21624
|
-
return new Promise((
|
|
21775
|
+
return new Promise((resolve12) => {
|
|
21625
21776
|
const entry = () => {
|
|
21626
21777
|
clearTimeout(timer);
|
|
21627
21778
|
running++;
|
|
21628
|
-
|
|
21779
|
+
resolve12(true);
|
|
21629
21780
|
};
|
|
21630
21781
|
const timer = setTimeout(
|
|
21631
21782
|
() => {
|
|
21632
21783
|
waiting.splice(waiting.indexOf(entry), 1);
|
|
21633
|
-
|
|
21784
|
+
resolve12(false);
|
|
21634
21785
|
},
|
|
21635
21786
|
Math.max(0, waitMs)
|
|
21636
21787
|
);
|
|
@@ -21644,8 +21795,8 @@ function freeLintSlot() {
|
|
|
21644
21795
|
function resolveLintWorkerEntry() {
|
|
21645
21796
|
const here = dirname17(fileURLToPath5(import.meta.url));
|
|
21646
21797
|
for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
|
|
21647
|
-
const candidate =
|
|
21648
|
-
if (
|
|
21798
|
+
const candidate = join45(here, name);
|
|
21799
|
+
if (existsSync30(candidate)) return candidate;
|
|
21649
21800
|
}
|
|
21650
21801
|
return void 0;
|
|
21651
21802
|
}
|
|
@@ -21715,8 +21866,8 @@ async function runHyperframeLint(prepared, options = {}) {
|
|
|
21715
21866
|
// ../producer/src/services/healthWorker.ts
|
|
21716
21867
|
import { Worker as Worker3 } from "worker_threads";
|
|
21717
21868
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
21718
|
-
import { dirname as dirname18, join as
|
|
21719
|
-
import { existsSync as
|
|
21869
|
+
import { dirname as dirname18, join as join46 } from "path";
|
|
21870
|
+
import { existsSync as existsSync31 } from "fs";
|
|
21720
21871
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
21721
21872
|
async function startHealthWorker(options = {}) {
|
|
21722
21873
|
const log = options.logger ?? defaultLogger2();
|
|
@@ -21734,12 +21885,12 @@ async function startHealthWorker(options = {}) {
|
|
|
21734
21885
|
stdout: false,
|
|
21735
21886
|
stderr: false
|
|
21736
21887
|
});
|
|
21737
|
-
await new Promise((
|
|
21888
|
+
await new Promise((resolve12, reject) => {
|
|
21738
21889
|
const onMessage = (msg) => {
|
|
21739
21890
|
if (msg?.type === "listening") {
|
|
21740
21891
|
worker.off("error", onError);
|
|
21741
21892
|
worker.off("message", onMessage);
|
|
21742
|
-
|
|
21893
|
+
resolve12();
|
|
21743
21894
|
} else if (msg?.type === "listen-error") {
|
|
21744
21895
|
worker.off("error", onError);
|
|
21745
21896
|
worker.off("message", onMessage);
|
|
@@ -21791,9 +21942,9 @@ function defaultLogger2() {
|
|
|
21791
21942
|
}
|
|
21792
21943
|
function resolveWorkerEntry2() {
|
|
21793
21944
|
const here = dirname18(fileURLToPath6(import.meta.url));
|
|
21794
|
-
const candidates = [
|
|
21945
|
+
const candidates = [join46(here, "healthWorkerThread.js"), join46(here, "healthWorkerThread.ts")];
|
|
21795
21946
|
for (const candidate of candidates) {
|
|
21796
|
-
if (
|
|
21947
|
+
if (existsSync31(candidate)) return candidate;
|
|
21797
21948
|
}
|
|
21798
21949
|
return void 0;
|
|
21799
21950
|
}
|
|
@@ -21957,7 +22108,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
21957
22108
|
}
|
|
21958
22109
|
}
|
|
21959
22110
|
const outputDir = dirname19(absoluteOutputPath);
|
|
21960
|
-
if (!
|
|
22111
|
+
if (!existsSync32(outputDir)) mkdirSync19(outputDir, { recursive: true });
|
|
21961
22112
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
21962
22113
|
}
|
|
21963
22114
|
function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
|
|
@@ -22018,7 +22169,7 @@ function validateOutputResolutionOverride(body) {
|
|
|
22018
22169
|
var MAX_PREVIEW_HTML_BYTES = 20 * 1024 * 1024;
|
|
22019
22170
|
function resolveRenderRequestPolicy(options) {
|
|
22020
22171
|
return {
|
|
22021
|
-
projectsDir:
|
|
22172
|
+
projectsDir: resolve11(
|
|
22022
22173
|
options.projectsDir ?? (process.env.PRODUCER_PROJECTS_DIR || process.cwd())
|
|
22023
22174
|
),
|
|
22024
22175
|
allowDebug: options.allowDebug ?? process.env.PRODUCER_ALLOW_DEBUG === "1"
|
|
@@ -22033,14 +22184,14 @@ function isAllowedEntryPath(policy, projectDir, path) {
|
|
|
22033
22184
|
function prepareProjectDirectory(projectDir, options, policy) {
|
|
22034
22185
|
const candidate = nonEmptyString(projectDir);
|
|
22035
22186
|
if (!candidate) return null;
|
|
22036
|
-
const absProjectDir = policy ?
|
|
22187
|
+
const absProjectDir = policy ? resolve11(policy.projectsDir, candidate) : resolve11(candidate);
|
|
22037
22188
|
const shown = policy ? candidate : absProjectDir;
|
|
22038
|
-
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !
|
|
22189
|
+
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync32(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
22039
22190
|
return { error: `Project directory not found: ${shown}` };
|
|
22040
22191
|
}
|
|
22041
22192
|
const entry = options.entryFile || "index.html";
|
|
22042
|
-
const entryPath =
|
|
22043
|
-
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !
|
|
22193
|
+
const entryPath = resolve11(absProjectDir, entry);
|
|
22194
|
+
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync32(entryPath)) {
|
|
22044
22195
|
return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
|
|
22045
22196
|
}
|
|
22046
22197
|
return { prepared: { input: { projectDir: absProjectDir, ...options } } };
|
|
@@ -22060,9 +22211,9 @@ async function resolveInlineRenderHtml(body) {
|
|
|
22060
22211
|
}
|
|
22061
22212
|
}
|
|
22062
22213
|
function materializeInlineProject(html, options) {
|
|
22063
|
-
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR ||
|
|
22064
|
-
const tempProjectDir = mkdtempSync2(
|
|
22065
|
-
writeFileSync13(
|
|
22214
|
+
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR || tmpdir6();
|
|
22215
|
+
const tempProjectDir = mkdtempSync2(join47(tempRoot, "producer-project-"));
|
|
22216
|
+
writeFileSync13(join47(tempProjectDir, "index.html"), html, "utf-8");
|
|
22066
22217
|
return {
|
|
22067
22218
|
prepared: {
|
|
22068
22219
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -22090,7 +22241,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log) {
|
|
|
22090
22241
|
try {
|
|
22091
22242
|
return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
|
|
22092
22243
|
} catch (error) {
|
|
22093
|
-
const fallbackPath =
|
|
22244
|
+
const fallbackPath = resolve11(rendersDir, `producer-fallback-${Date.now()}.mp4`);
|
|
22094
22245
|
log.warn("Failed to resolve output path, using fallback", {
|
|
22095
22246
|
fallback: fallbackPath,
|
|
22096
22247
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -22138,7 +22289,7 @@ function publicPerfSummary(job) {
|
|
|
22138
22289
|
return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
|
|
22139
22290
|
}
|
|
22140
22291
|
function outputFileSize(path) {
|
|
22141
|
-
return
|
|
22292
|
+
return existsSync32(path) ? statSync12(path).size : 0;
|
|
22142
22293
|
}
|
|
22143
22294
|
function createBlockingProgressReporter(log, requestId) {
|
|
22144
22295
|
let lastLoggedPct = -10;
|
|
@@ -22258,7 +22409,7 @@ function createRenderHandlers(options = {}) {
|
|
|
22258
22409
|
const lintProjectDir = nonEmptyString(body.projectDir);
|
|
22259
22410
|
let isAllowedEntry;
|
|
22260
22411
|
if (policy && lintProjectDir) {
|
|
22261
|
-
const absProjectDir =
|
|
22412
|
+
const absProjectDir = resolve11(policy.projectsDir, lintProjectDir);
|
|
22262
22413
|
if (!isAllowedProjectPath(policy.projectsDir, absProjectDir)) {
|
|
22263
22414
|
const error = `Project directory not found: ${lintProjectDir}`;
|
|
22264
22415
|
return c.json({ success: false, requestId, error }, 400);
|
|
@@ -22465,7 +22616,7 @@ function createRenderHandlers(options = {}) {
|
|
|
22465
22616
|
if (!artifact) {
|
|
22466
22617
|
return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
|
|
22467
22618
|
}
|
|
22468
|
-
if (!
|
|
22619
|
+
if (!existsSync32(artifact.path)) {
|
|
22469
22620
|
store.delete(token);
|
|
22470
22621
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
22471
22622
|
}
|
|
@@ -22606,7 +22757,7 @@ function startServer(options = {}) {
|
|
|
22606
22757
|
});
|
|
22607
22758
|
async function shutdown(signal) {
|
|
22608
22759
|
log.info(`Received ${signal}, shutting down`);
|
|
22609
|
-
const { drainBrowserPool } = await import("./src-
|
|
22760
|
+
const { drainBrowserPool } = await import("./src-COKNEXLI.js");
|
|
22610
22761
|
await drainBrowserPool().catch(() => {
|
|
22611
22762
|
});
|
|
22612
22763
|
const handle = await Promise.race([
|
|
@@ -22630,7 +22781,7 @@ function startServer(options = {}) {
|
|
|
22630
22781
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
22631
22782
|
return server;
|
|
22632
22783
|
}
|
|
22633
|
-
var entryScript = process.argv[1] ?
|
|
22784
|
+
var entryScript = process.argv[1] ? resolve11(process.argv[1]) : "";
|
|
22634
22785
|
var isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
|
|
22635
22786
|
if (isPublicServerEntry) {
|
|
22636
22787
|
const { values } = parseArgs({
|
|
@@ -22643,13 +22794,13 @@ if (isPublicServerEntry) {
|
|
|
22643
22794
|
|
|
22644
22795
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
22645
22796
|
import { mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
|
|
22646
|
-
import { tmpdir as
|
|
22647
|
-
import { join as
|
|
22797
|
+
import { tmpdir as tmpdir7 } from "os";
|
|
22798
|
+
import { join as join49 } from "path";
|
|
22648
22799
|
|
|
22649
22800
|
// ../producer/src/services/distributed/assemble.ts
|
|
22650
22801
|
import {
|
|
22651
22802
|
cpSync as cpSync3,
|
|
22652
|
-
existsSync as
|
|
22803
|
+
existsSync as existsSync33,
|
|
22653
22804
|
mkdirSync as mkdirSync20,
|
|
22654
22805
|
readFileSync as readFileSync15,
|
|
22655
22806
|
readdirSync as readdirSync12,
|
|
@@ -22657,7 +22808,7 @@ import {
|
|
|
22657
22808
|
statSync as statSync13,
|
|
22658
22809
|
writeFileSync as writeFileSync14
|
|
22659
22810
|
} from "fs";
|
|
22660
|
-
import { basename as
|
|
22811
|
+
import { basename as basename8, dirname as dirname20, join as join48 } from "path";
|
|
22661
22812
|
function cfrRateControlArgs(locked) {
|
|
22662
22813
|
const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
|
|
22663
22814
|
if (locked.crf == null && locked.bitrate) {
|
|
@@ -22690,10 +22841,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22690
22841
|
}
|
|
22691
22842
|
const format = plan2.dimensions.format;
|
|
22692
22843
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
22693
|
-
if (!
|
|
22844
|
+
if (!existsSync33(dirname20(outputPath))) {
|
|
22694
22845
|
mkdirSync20(dirname20(outputPath), { recursive: true });
|
|
22695
22846
|
}
|
|
22696
|
-
const workDir = createStagingDir(dirname20(outputPath), `${
|
|
22847
|
+
const workDir = createStagingDir(dirname20(outputPath), `${basename8(outputPath)}.assemble-work-`);
|
|
22697
22848
|
const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
22698
22849
|
const stageMs = {};
|
|
22699
22850
|
const ctx = {
|
|
@@ -22713,8 +22864,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22713
22864
|
};
|
|
22714
22865
|
try {
|
|
22715
22866
|
const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
|
|
22716
|
-
const finalPath =
|
|
22717
|
-
const audio = audioPath !== null &&
|
|
22867
|
+
const finalPath = join48(workDir, `output.${format}`);
|
|
22868
|
+
const audio = audioPath !== null && existsSync33(audioPath) ? audioPath : null;
|
|
22718
22869
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
22719
22870
|
renameWithRetry(finalPath, outputPath);
|
|
22720
22871
|
log.info("[assemble] stage timings", {
|
|
@@ -22732,7 +22883,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22732
22883
|
});
|
|
22733
22884
|
}
|
|
22734
22885
|
}
|
|
22735
|
-
const fileSize =
|
|
22886
|
+
const fileSize = existsSync33(outputPath) ? statSync13(outputPath).size : 0;
|
|
22736
22887
|
return {
|
|
22737
22888
|
...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
|
|
22738
22889
|
outputPath,
|
|
@@ -22742,15 +22893,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22742
22893
|
};
|
|
22743
22894
|
}
|
|
22744
22895
|
function readAssemblePlan(planDir, chunkPaths) {
|
|
22745
|
-
const planJsonPath =
|
|
22746
|
-
const chunksJsonPath =
|
|
22747
|
-
if (!
|
|
22896
|
+
const planJsonPath = join48(planDir, "plan.json");
|
|
22897
|
+
const chunksJsonPath = join48(planDir, "meta", "chunks.json");
|
|
22898
|
+
if (!existsSync33(planJsonPath)) {
|
|
22748
22899
|
throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
|
|
22749
22900
|
}
|
|
22750
22901
|
const plan2 = JSON.parse(readFileSync15(planJsonPath, "utf-8"));
|
|
22751
22902
|
readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
|
|
22752
22903
|
validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
|
|
22753
|
-
if (!
|
|
22904
|
+
if (!existsSync33(chunksJsonPath)) {
|
|
22754
22905
|
throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
|
|
22755
22906
|
}
|
|
22756
22907
|
const chunks = JSON.parse(readFileSync15(chunksJsonPath, "utf-8"));
|
|
@@ -22765,7 +22916,7 @@ function readAssemblePlan(planDir, chunkPaths) {
|
|
|
22765
22916
|
}
|
|
22766
22917
|
}
|
|
22767
22918
|
for (const path of chunkPaths.flat()) {
|
|
22768
|
-
if (!
|
|
22919
|
+
if (!existsSync33(path)) {
|
|
22769
22920
|
throw new Error(`[assemble] chunk path does not exist: ${path}`);
|
|
22770
22921
|
}
|
|
22771
22922
|
}
|
|
@@ -22794,7 +22945,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
22794
22945
|
return args;
|
|
22795
22946
|
}
|
|
22796
22947
|
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
22797
|
-
const cfrOutputPath =
|
|
22948
|
+
const cfrOutputPath = join48(ctx.workDir, `cfr.${ctx.format}`);
|
|
22798
22949
|
const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
|
|
22799
22950
|
appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
|
|
22800
22951
|
cfrArgs.push("-y", cfrOutputPath);
|
|
@@ -22821,7 +22972,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
22821
22972
|
);
|
|
22822
22973
|
return;
|
|
22823
22974
|
}
|
|
22824
|
-
const paddedAudioPath =
|
|
22975
|
+
const paddedAudioPath = join48(ctx.workDir, "audio-padded.m4a");
|
|
22825
22976
|
const padTrimResult = await ctx.timed(
|
|
22826
22977
|
"audioMs",
|
|
22827
22978
|
() => padOrTrimAudioToVideoFrameCount({
|
|
@@ -22861,7 +23012,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
22861
23012
|
}
|
|
22862
23013
|
}
|
|
22863
23014
|
function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
|
|
22864
|
-
const listPath =
|
|
23015
|
+
const listPath = join48(workDir, "concat-list.txt");
|
|
22865
23016
|
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
22866
23017
|
writeFileSync14(listPath, `${body}
|
|
22867
23018
|
`, "utf-8");
|
|
@@ -22899,12 +23050,12 @@ function stitchesSeparateAudio(planDir) {
|
|
|
22899
23050
|
return lockedAudio(planDir).separateAudio === true;
|
|
22900
23051
|
}
|
|
22901
23052
|
function planFormat(planDir) {
|
|
22902
|
-
const plan2 = JSON.parse(readFileSync15(
|
|
23053
|
+
const plan2 = JSON.parse(readFileSync15(join48(planDir, "plan.json"), "utf-8"));
|
|
22903
23054
|
return plan2.dimensions.format;
|
|
22904
23055
|
}
|
|
22905
23056
|
function lockedAudio(planDir) {
|
|
22906
|
-
const encoderJsonPath =
|
|
22907
|
-
if (!
|
|
23057
|
+
const encoderJsonPath = join48(planDir, "meta", "encoder.json");
|
|
23058
|
+
if (!existsSync33(encoderJsonPath)) return {};
|
|
22908
23059
|
return JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
|
|
22909
23060
|
}
|
|
22910
23061
|
function readCfrEncoder(planDir, format) {
|
|
@@ -22913,8 +23064,8 @@ function readCfrEncoder(planDir, format) {
|
|
|
22913
23064
|
`[assemble] cfr=true is only supported for format="mp4" (got "${format}"). Stream-copy paths for webm and mov already produce exact avg_frame_rate; cfr re-encode is not needed.`
|
|
22914
23065
|
);
|
|
22915
23066
|
}
|
|
22916
|
-
const encoderJsonPath =
|
|
22917
|
-
if (!
|
|
23067
|
+
const encoderJsonPath = join48(planDir, "meta", "encoder.json");
|
|
23068
|
+
if (!existsSync33(encoderJsonPath)) {
|
|
22918
23069
|
throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
|
|
22919
23070
|
}
|
|
22920
23071
|
const encoderJson = JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
|
|
@@ -22926,7 +23077,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
22926
23077
|
return encoderJson;
|
|
22927
23078
|
}
|
|
22928
23079
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
22929
|
-
if (
|
|
23080
|
+
if (existsSync33(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
|
|
22930
23081
|
mkdirSync20(outputPath, { recursive: true });
|
|
22931
23082
|
let globalIdx = 0;
|
|
22932
23083
|
for (const chunkDir of chunkPaths) {
|
|
@@ -22940,8 +23091,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22940
23091
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
22941
23092
|
}
|
|
22942
23093
|
for (const frame of frames) {
|
|
22943
|
-
const dst =
|
|
22944
|
-
cpSync3(
|
|
23094
|
+
const dst = join48(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
23095
|
+
cpSync3(join48(chunkDir, frame), dst);
|
|
22945
23096
|
globalIdx += 1;
|
|
22946
23097
|
}
|
|
22947
23098
|
}
|
|
@@ -22950,14 +23101,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22950
23101
|
`[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
|
|
22951
23102
|
);
|
|
22952
23103
|
}
|
|
22953
|
-
if (audioPath !== null &&
|
|
22954
|
-
const sidecar =
|
|
23104
|
+
if (audioPath !== null && existsSync33(audioPath)) {
|
|
23105
|
+
const sidecar = join48(outputPath, MIXED_AUDIO_FILENAME);
|
|
22955
23106
|
cpSync3(audioPath, sidecar);
|
|
22956
23107
|
}
|
|
22957
23108
|
let fileSize = 0;
|
|
22958
23109
|
for (const name of readdirSync12(outputPath)) {
|
|
22959
23110
|
try {
|
|
22960
|
-
fileSize += statSync13(
|
|
23111
|
+
fileSize += statSync13(join48(outputPath, name)).size;
|
|
22961
23112
|
} catch {
|
|
22962
23113
|
}
|
|
22963
23114
|
}
|
|
@@ -22971,8 +23122,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22971
23122
|
|
|
22972
23123
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
22973
23124
|
async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
22974
|
-
const workRoot = mkdtempSync3(
|
|
22975
|
-
const materializedPlanDir =
|
|
23125
|
+
const workRoot = mkdtempSync3(join49(tmpdir7(), "hf-plan-v2-chunk-"));
|
|
23126
|
+
const materializedPlanDir = join49(workRoot, "plan");
|
|
22976
23127
|
try {
|
|
22977
23128
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
22978
23129
|
return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
|
|
@@ -22981,8 +23132,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
|
22981
23132
|
}
|
|
22982
23133
|
}
|
|
22983
23134
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
22984
|
-
const workRoot = mkdtempSync3(
|
|
22985
|
-
const materializedPlanDir =
|
|
23135
|
+
const workRoot = mkdtempSync3(join49(tmpdir7(), "hf-plan-v2-assembler-"));
|
|
23136
|
+
const materializedPlanDir = join49(workRoot, "plan");
|
|
22986
23137
|
try {
|
|
22987
23138
|
const materialized = materializePlanV2Target(
|
|
22988
23139
|
planV2Dir,
|
|
@@ -23004,7 +23155,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
|
23004
23155
|
// ../producer/src/services/distributed/projectHash.ts
|
|
23005
23156
|
import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync14 } from "fs";
|
|
23006
23157
|
import { createHash as createHash8 } from "crypto";
|
|
23007
|
-
import { join as
|
|
23158
|
+
import { join as join50, sep as sep7 } from "path";
|
|
23008
23159
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
23009
23160
|
|
|
23010
23161
|
// ../producer/src/services/distributed/audioSidecar.ts
|
|
@@ -23020,6 +23171,7 @@ export {
|
|
|
23020
23171
|
defaultLogger,
|
|
23021
23172
|
createFileServer,
|
|
23022
23173
|
normalizeErrorMessage,
|
|
23174
|
+
missingPathOf,
|
|
23023
23175
|
RENDER_JOB_DIR,
|
|
23024
23176
|
createOwnedRenderDir,
|
|
23025
23177
|
listAbandonedRenderDirs,
|