hyperframes 0.9.65 → 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-FFPEN3PI.js → add-2FYFE3ZX.js} +22 -21
- package/dist/{agentPromptGenerator-3XDVEOI4.js → agentPromptGenerator-5YFPYST7.js} +14 -13
- package/dist/{animatedGifPrep-FF5MNK4G.js → animatedGifPrep-SIL3ADIS.js} +15 -14
- package/dist/api.js +51 -49
- package/dist/{appHistory-VNIOZU2X.js → appHistory-EWII7S5X.js} +4 -4
- package/dist/{asset-CL3LGWHN.js → asset-D5BXLEK4.js} +10 -9
- package/dist/{assetCataloger-EJWPZR2U.js → assetCataloger-7UREFLWJ.js} +15 -14
- package/dist/{audio-YXOB2W6Y.js → audio-NGQW5Z7O.js} +30 -28
- package/dist/{auth-M7A4TSPO.js → auth-L2MGMG62.js} +4 -4
- package/dist/{autoUpdate-6YQYHQGW.js → autoUpdate-FKWV43U5.js} +24 -10
- package/dist/{avatars-77IWARZP.js → avatars-SM7BUIVL.js} +23 -21
- package/dist/{backgroundChecks-M4NIDGIA.js → backgroundChecks-XGOO6ETM.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-YSKM7TNL.js → batchRender-LK46EDAZ.js} +13 -10
- package/dist/{beats-LRU6EJRT.js → beats-FPJEEBO2.js} +14 -13
- package/dist/{benchmark-CHHCVFKH.js → benchmark-BMM3E56O.js} +25 -22
- package/dist/{billing-LLO6AH2P.js → billing-S37OJE6G.js} +22 -20
- package/dist/{browser-QCBYOBPV.js → browser-ACTTU67A.js} +12 -11
- package/dist/{bundleWithLocalizedFonts-QKUGP6QU.js → bundleWithLocalizedFonts-H2UJUDSF.js} +1 -1
- package/dist/{capture-7CIWJP57.js → capture-N24KHG3V.js} +26 -25
- package/dist/{capture-22DC6YXT.js → capture-V4ATIGRR.js} +10 -9
- package/dist/{captureCompositionFrame-QKU2OEUO.js → captureCompositionFrame-Y2GGNU43.js} +21 -20
- package/dist/{captureFile-FNCMGYYJ.js → captureFile-GYZI5Y56.js} +3 -3
- package/dist/{catalog-KM43JIX6.js → catalog-4FAP2CFF.js} +22 -21
- package/dist/{catch-up-QSCE5EWT.js → catch-up-6RCTMCTI.js} +14 -13
- package/dist/{check-OHWGWJX6.js → check-P6XW2CX7.js} +55 -54
- package/dist/{checkAudio-7LMFGTYQ.js → checkAudio-R7ZSNHPD.js} +17 -16
- package/dist/{checkBrowser-EEH265TZ.js → checkBrowser-ZTEBVQMM.js} +47 -46
- package/dist/{chunk-IOYTXBFK.js → chunk-244FN6TG.js} +1 -1
- package/dist/{chunk-XIVI6GYV.js → chunk-2F2HLVI5.js} +7 -7
- package/dist/{chunk-3JVTHNDH.js → chunk-2FEZFXKE.js} +1 -1
- package/dist/{chunk-AOSTTTSS.js → chunk-2FKIIF2W.js} +129 -42
- package/dist/{chunk-UFCIA6WF.js → chunk-2SE62YIX.js} +5 -5
- package/dist/{chunk-GB5RKTLO.js → chunk-2U6Z7QH5.js} +5 -5
- package/dist/{chunk-2WXCQT4F.js → chunk-35BZXE5L.js} +1 -1
- package/dist/{chunk-YZO2JM2G.js → chunk-3DENR37V.js} +5 -5
- package/dist/{chunk-BA2MCRMP.js → chunk-3F7MJNGG.js} +1 -1
- package/dist/{chunk-4NNGVO2D.js → chunk-3NPAQ5FV.js} +28 -23
- package/dist/{chunk-AB4FVMV4.js → chunk-3RUFJGIT.js} +1 -1
- package/dist/{chunk-TIB6KUSP.js → chunk-3XS35R5E.js} +16 -16
- package/dist/{chunk-6AKYBHGV.js → chunk-4E3AKTSD.js} +54 -17
- package/dist/{chunk-OCBC4P6O.js → chunk-4IIPERO4.js} +1 -1
- package/dist/{chunk-UCWQU7EY.js → chunk-4MJCBHXI.js} +2 -2
- package/dist/{chunk-PUZN3BFQ.js → chunk-4SBR3ZP7.js} +2 -2
- package/dist/{chunk-FHIOPTN4.js → chunk-4SY34UA2.js} +1 -1
- package/dist/{chunk-7R7OCEHI.js → chunk-4WUTXBRK.js} +6 -6
- package/dist/{chunk-RC2DDVX5.js → chunk-5E46EQ3U.js} +2 -2
- package/dist/{chunk-EUXQMNUT.js → chunk-5U4QTHAS.js} +2 -2
- package/dist/{chunk-UL2EO5VU.js → chunk-5WZSXP6R.js} +1 -1
- package/dist/{chunk-X63QVLMJ.js → chunk-64O3DG3E.js} +1 -1
- package/dist/{chunk-C6J6TZSW.js → chunk-6ACARSAZ.js} +1 -1
- package/dist/{chunk-VSDYSL4J.js → chunk-6QKW4E7D.js} +13 -13
- package/dist/chunk-6SYJN2KD.js +15 -0
- package/dist/{chunk-IZ5GH7TX.js → chunk-6U5JJJFB.js} +3 -3
- package/dist/{chunk-777GBBTE.js → chunk-6VNN3SYK.js} +1 -1
- package/dist/{chunk-X2BESDNL.js → chunk-77SURLKL.js} +3 -3
- package/dist/{chunk-VCTPYHOD.js → chunk-7QNCNGN6.js} +2 -2
- package/dist/{chunk-WNU7WC46.js → chunk-A4AMJI7L.js} +3 -3
- package/dist/{chunk-QVVQJKBZ.js → chunk-A4USKCUY.js} +2 -2
- package/dist/{chunk-7S6FWEJH.js → chunk-A5ZULLJX.js} +1 -1
- package/dist/{chunk-6KVZKKQL.js → chunk-AEBDHKTJ.js} +1 -1
- package/dist/{chunk-STH72R3G.js → chunk-AH4QO6YC.js} +1 -1
- package/dist/{chunk-3W4FG7IG.js → chunk-AJPSKAQ6.js} +12 -12
- package/dist/{chunk-Z2B2CQO3.js → chunk-AMQBBQCF.js} +11 -11
- package/dist/{chunk-ZJQ23DJQ.js → chunk-AQBWVIT7.js} +1 -1
- package/dist/{chunk-NMYYW6QM.js → chunk-AQNI4TCF.js} +23 -15
- package/dist/{chunk-GJ52L66E.js → chunk-AQYZW46G.js} +9 -9
- package/dist/{chunk-F4CVSUA4.js → chunk-AWP277ZO.js} +2 -2
- package/dist/{chunk-MJWUDOBB.js → chunk-B3HZTUCD.js} +5 -5
- package/dist/{chunk-PW4U3IUR.js → chunk-BAL7FD4W.js} +3 -3
- package/dist/{chunk-FZKN2NC4.js → chunk-BANMRXAN.js} +2 -2
- package/dist/{chunk-EQSVVKKE.js → chunk-BC24UT7V.js} +4 -4
- package/dist/{chunk-IJ4CZKOB.js → chunk-BHOQKOW3.js} +5 -5
- package/dist/{chunk-MEDWEFKT.js → chunk-BLPMKSO7.js} +4 -3
- package/dist/{chunk-ALTOXXDI.js → chunk-BO2FQEM4.js} +10 -5
- package/dist/{chunk-JP7BQ4WS.js → chunk-CANVWJB4.js} +13 -11
- package/dist/{chunk-FDI4X3EC.js → chunk-CGHKK2BY.js} +3 -3
- package/dist/{chunk-HYO4DIYT.js → chunk-CPQTWPMM.js} +1 -1
- package/dist/{chunk-BBAEXPIU.js → chunk-D7W642TJ.js} +2 -2
- package/dist/{chunk-QZML6RDQ.js → chunk-DKEP2QM5.js} +7 -7
- package/dist/{chunk-3FHYTUFQ.js → chunk-DNBMLRSA.js} +1 -1
- package/dist/{chunk-6BLW2BST.js → chunk-EMUKI7UB.js} +1 -1
- package/dist/{chunk-Z67SXGRJ.js → chunk-EYFZRI6U.js} +1 -1
- package/dist/{chunk-2QIRDNBU.js → chunk-FHSBI5MM.js} +2 -2
- package/dist/{chunk-XDVHQFEQ.js → chunk-FOALZ4MW.js} +1 -1
- package/dist/{chunk-KJ5YLRMQ.js → chunk-FXQRMULT.js} +5 -3
- package/dist/{chunk-CNCE57K2.js → chunk-FZT7QWVE.js} +2 -2
- package/dist/{chunk-GDKNEQ4E.js → chunk-GGY5M6BU.js} +1 -1
- package/dist/{chunk-3U2W7LJU.js → chunk-GHPPUALY.js} +6 -6
- package/dist/{chunk-NDXUDTLF.js → chunk-GXKCFOMR.js} +2 -2
- package/dist/{chunk-R3FNJABL.js → chunk-H3AH7NDI.js} +9 -9
- package/dist/{chunk-6N3S6L56.js → chunk-HPENBBIH.js} +6 -6
- package/dist/{chunk-XHW57QCG.js → chunk-HUUPDIBE.js} +3 -3
- package/dist/{chunk-A6AH56HN.js → chunk-HYQ6S7R6.js} +2 -2
- package/dist/{chunk-AE36GVZT.js → chunk-IFC533NZ.js} +3 -3
- package/dist/{chunk-F2GQH6G4.js → chunk-IRW7AWIC.js} +4 -4
- package/dist/{chunk-JBKVY4PY.js → chunk-ITBQLYIV.js} +4 -4
- package/dist/{chunk-TNTXAGHK.js → chunk-IUUEMVZV.js} +2 -2
- package/dist/{chunk-EMIOIMHN.js → chunk-IXSCGQS5.js} +1 -1
- package/dist/{chunk-DQD5KQXM.js → chunk-JB7OF43L.js} +1 -1
- package/dist/{chunk-OHY27IY2.js → chunk-JK2WTAKR.js} +6 -2
- package/dist/{chunk-YGO6PEYX.js → chunk-JK7JON6R.js} +1 -1
- package/dist/{chunk-A63XME5P.js → chunk-JOW7SA7F.js} +4 -4
- package/dist/{chunk-E3OFFWRD.js → chunk-JXUDMAKX.js} +2 -2
- package/dist/{chunk-BSGHUXHX.js → chunk-JYFQXM2E.js} +1 -1
- package/dist/{chunk-AYTEZDHI.js → chunk-K7VV4XSD.js} +9 -4
- package/dist/{chunk-3WUKMGJN.js → chunk-KNRZBLQH.js} +7 -7
- package/dist/{chunk-F4V523HB.js → chunk-KRRKEWWI.js} +2 -2
- package/dist/{chunk-IH2C53YV.js → chunk-KZ5PV5TL.js} +11 -9
- package/dist/{chunk-5JB52EL2.js → chunk-L7YERJVL.js} +804 -582
- package/dist/{chunk-VIA6UCV5.js → chunk-LHCQ4TMY.js} +37 -3
- package/dist/{chunk-FXMKHHPO.js → chunk-LIHELBPB.js} +0 -61
- package/dist/{chunk-YWUE4CRU.js → chunk-LWX5PI73.js} +7 -7
- package/dist/{chunk-VVSPUYPA.js → chunk-MDFQC4J2.js} +1 -1
- package/dist/{chunk-S7YTRWJD.js → chunk-MDWOXUEU.js} +4 -4
- package/dist/{chunk-UKFPGKEC.js → chunk-MIPRIUWU.js} +7 -7
- package/dist/{chunk-K6ARLNKJ.js → chunk-NIEOUHVQ.js} +1 -1
- package/dist/{chunk-DZNWYUBA.js → chunk-NNKKJ2MI.js} +3 -3
- package/dist/{chunk-4NCKEOKP.js → chunk-NYJ4OV4H.js} +2 -2
- package/dist/{chunk-U3OHPF2K.js → chunk-O3ENZQHQ.js} +3 -3
- package/dist/{chunk-U2FL2MTE.js → chunk-OGL5VQGT.js} +4 -2
- package/dist/{chunk-U2X5CSJV.js → chunk-OMLJTCNR.js} +4 -4
- package/dist/{chunk-BYCOI5AI.js → chunk-P6WWZ4ZZ.js} +2 -2
- package/dist/{chunk-AQFA2WPD.js → chunk-PAKYOFVJ.js} +1 -1
- package/dist/{chunk-7CCETF2U.js → chunk-PEXUCK6Y.js} +3 -3
- package/dist/{chunk-GEEATBFF.js → chunk-PHBS5KEY.js} +3 -3
- package/dist/{chunk-GVGUOYNC.js → chunk-PI6ZYIGK.js} +1 -1
- package/dist/{chunk-PH3MZM27.js → chunk-PS26KCCH.js} +4 -4
- package/dist/chunk-PWRUMN7B.js +71 -0
- package/dist/{chunk-HXUZGW3A.js → chunk-Q3OZGUZ4.js} +10 -10
- package/dist/{chunk-XP6BVUGU.js → chunk-QOIEPOKY.js} +2 -2
- package/dist/{chunk-LLLOUHO6.js → chunk-QTLKOGK4.js} +7 -6
- package/dist/{chunk-IM7OBJ2Z.js → chunk-RD3DE4ZP.js} +2 -2
- package/dist/{chunk-QBPQNKSP.js → chunk-RRGRETJ4.js} +2 -2
- package/dist/{chunk-FZRFTW5X.js → chunk-RVQQUHIT.js} +2 -2
- package/dist/{chunk-JA2EGQEE.js → chunk-S36C2TEK.js} +3 -3
- package/dist/chunk-S3IQW75Q.js +5146 -0
- package/dist/{chunk-QZZZNXAK.js → chunk-SIVDQSNV.js} +41 -34
- package/dist/{chunk-Z66KCWZC.js → chunk-STUDSWGR.js} +2 -2
- package/dist/{chunk-Y273NNG5.js → chunk-SW4TVGUR.js} +2 -2
- package/dist/{chunk-4W4QOYPI.js → chunk-T73BVHZ5.js} +8 -8
- package/dist/{chunk-RCP2VEJJ.js → chunk-TNO5EVXS.js} +6 -6
- package/dist/{chunk-C2O5XIFN.js → chunk-TTG6TSI6.js} +2 -2
- package/dist/{chunk-FBMBSPEZ.js → chunk-U4BP54JI.js} +1 -1
- package/dist/{chunk-W2CXA2CN.js → chunk-U55SJQPA.js} +1 -1
- package/dist/{chunk-TFAKFI3R.js → chunk-U6ZR7GBQ.js} +3 -3
- package/dist/{chunk-G6CEI6PO.js → chunk-ULR3HM3L.js} +25 -7
- package/dist/{chunk-2TEG3AY6.js → chunk-UN5SNMRS.js} +12 -12
- package/dist/{chunk-S35RUNXJ.js → chunk-UVW5ZDAP.js} +4 -2
- package/dist/{chunk-KFR67U7E.js → chunk-VBLKGDVI.js} +1 -1
- package/dist/{chunk-OCGUBNKH.js → chunk-VQ72HDX3.js} +9 -9
- package/dist/{chunk-6XUAMVHS.js → chunk-VW733NCS.js} +16 -16
- package/dist/{chunk-4PEGA4QR.js → chunk-W3AUR4EP.js} +1 -1
- package/dist/{chunk-AR3R2DZI.js → chunk-W742C6SA.js} +1 -1
- package/dist/{chunk-MWQQOFGN.js → chunk-W7MKF4I2.js} +4 -4
- package/dist/{chunk-ERYYOWWF.js → chunk-WMUBDXHG.js} +9 -8
- package/dist/{chunk-AXZ2NMKP.js → chunk-WU3JL3BC.js} +3 -3
- package/dist/{chunk-3UL2TYIS.js → chunk-X2VXJFX2.js} +1 -1
- package/dist/{chunk-OYFDQ5QW.js → chunk-XEP7ER4Z.js} +1 -1
- package/dist/{chunk-QRDITHEZ.js → chunk-XNBVJAL4.js} +68 -76
- package/dist/chunk-XO4BTSA5.js +38 -0
- package/dist/{chunk-5VERYJGC.js → chunk-XOXWJAWW.js} +5 -5
- package/dist/{chunk-EH46IYY2.js → chunk-YU4OCNWW.js} +10 -10
- package/dist/{chunk-YWD5PVKA.js → chunk-ZHNHAA6O.js} +3 -3
- package/dist/{chunk-ANX6FWHI.js → chunk-ZS2ROUIG.js} +1 -1
- package/dist/{chunk-LBDQJRCK.js → chunk-ZTD6VXAE.js} +1 -1
- package/dist/{clean-ZR7HNI3V.js → clean-NP652D74.js} +28 -27
- package/dist/cli.js +72 -71
- package/dist/{cloud-B24T67AA.js → cloud-EBVLMT6V.js} +4 -4
- package/dist/{cloud-5JYPYMDJ.js → cloud-TNWRELD4.js} +14 -12
- package/dist/{cloudrun-7U6GFP2S.js → cloudrun-NAQ26OGP.js} +9 -8
- package/dist/{compare-NRXMK72Y.js → compare-NPK5WR6F.js} +49 -48
- package/dist/{compiler-FQB6LVTK.js → compiler-TYKIETZY.js} +9 -6
- package/dist/{component-TJX5NP44.js → component-YTC25I6A.js} +11 -10
- package/dist/{compositions-UPIST4QX.js → compositions-A3WYG7XA.js} +22 -19
- package/dist/{contactSheet-JFEV75W2.js → contactSheet-G42BMJXO.js} +4 -4
- package/dist/{curve-P3KZZFD5.js → curve-HULZZNO2.js} +18 -17
- package/dist/{cuts-PTZUTT45.js → cuts-EEN2AJLR.js} +19 -18
- package/dist/{delete-GHEUVYRE.js → delete-QBPY4DUZ.js} +21 -17
- package/dist/{deploy-IBHOLWU3.js → deploy-ZOTTUJKO.js} +9 -16
- package/dist/{describeProject-VCX52S5P.js → describeProject-AT42RQAC.js} +15 -14
- package/dist/{destroy-ISDB5HUK.js → destroy-72TCFGIU.js} +6 -6
- package/dist/{deterministicFonts-XCYIRDQZ.js → deterministicFonts-645ILNLP.js} +3 -3
- package/dist/{diff-4YBUQ4YN.js → diff-L76A3S3I.js} +45 -43
- package/dist/{dist-3YCMP3OA.js → dist-56QKGCNA.js} +18 -17
- package/dist/{dist-5BBLH53Z.js → dist-FU3Y3LDE.js} +11 -9
- package/dist/{dist-VPMEUGIV.js → dist-XRESUN6B.js} +3 -3
- package/dist/docker/Dockerfile.render +1 -1
- package/dist/{doctor-MOKBELVX.js → doctor-MTSMQTIP.js} +18 -17
- package/dist/{dotEnv-JBK54RQJ.js → dotEnv-NMTSGEYW.js} +7 -6
- package/dist/{energy-W77GZ4AU.js → energy-Y7UZSF5R.js} +19 -18
- package/dist/{events-6MUF5QM3.js → events-5IZJ6IG4.js} +4 -3
- package/dist/{events-ZMVV7YHQ.js → events-NLBWWYJR.js} +21 -20
- package/dist/{events-6AAHOZOP.js → events-RY7F26WJ.js} +9 -8
- package/dist/{execute-ZXIJROJ3.js → execute-X6GOJYI7.js} +42 -41
- package/dist/{extract-XPYMBV3C.js → extract-PO4ERZG7.js} +20 -19
- package/dist/{face-CFU3RPCE.js → face-GS7FT77Y.js} +17 -16
- package/dist/{face-DPGVFMNK.js → face-O7W6DN3E.js} +20 -19
- package/dist/{feedback-QCILWFND.js → feedback-OLPHMAVY.js} +26 -24
- package/dist/{ffmpeg-53IYIQK6.js → ffmpeg-6R5HYRLA.js} +13 -12
- package/dist/{figma-MWLNH4FP.js → figma-3WLCHH7N.js} +3 -3
- package/dist/fontLocalizeCli.js +19 -18
- package/dist/{frames-XMHFYD43.js → frames-RELC7P5I.js} +21 -20
- package/dist/{generate-VC7GNQN7.js → generate-KDKHARPX.js} +35 -33
- package/dist/{get-SBNYVI3T.js → get-Y4JVREKO.js} +21 -17
- package/dist/{gpuPolicy-5BUTYWST.js → gpuPolicy-IJE7MB5Y.js} +13 -12
- package/dist/{grade-compare-BIGPVPVY.js → grade-compare-T25JDQLV.js} +43 -42
- package/dist/{hands-6VOHNDTY.js → hands-WXGO4FOI.js} +22 -21
- package/dist/{heifImagePrep-HPGUKE5Y.js → heifImagePrep-5X36VXGL.js} +16 -15
- package/dist/{help-7FCGRM47.js → help-N66Y52S7.js} +1 -1
- package/dist/{history-FJPXD3BK.js → history-F7C2MXWT.js} +18 -17
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +72 -71
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{index-gen-3DWPA4FO.js → index-gen-TXP67YUY.js} +13 -1
- package/dist/{info-6P6MXHTD.js → info-IHOMN6HZ.js} +21 -20
- package/dist/{init-VL2J3BPK.js → init-S2SZ3YJW.js} +37 -36
- package/dist/{ink-JXO2ECYZ.js → ink-DMKCUCA4.js} +19 -18
- package/dist/{inspect-LDJ4MZZB.js → inspect-ILBSFULF.js} +48 -47
- package/dist/{installer-CY5PMR3I.js → installer-5ZPAYISO.js} +10 -9
- package/dist/{keyframes-GZMGSHWN.js → keyframes-U4XFMXJ3.js} +23 -22
- package/dist/{lambda-EX6MIUFB.js → lambda-DYOGW62Q.js} +22 -21
- package/dist/{launch-Z3ZYBEOZ.js → launch-D5BGD7YR.js} +14 -13
- package/dist/{layout-LJAXOS6D.js → layout-F7SIJYUI.js} +48 -47
- package/dist/{lint-IZ5LAKZ2.js → lint-3HQJQBVK.js} +16 -15
- package/dist/{lintProject-XEWYQ2YP.js → lintProject-55U44GOP.js} +3 -3
- package/dist/{list-M5NCDKZK.js → list-JUPBF73K.js} +27 -21
- package/dist/{live-WWPFZQ74.js → live-ZSDUN6U2.js} +1 -1
- package/dist/{localPage-RPRX4QWI.js → localPage-SI4COAH7.js} +14 -13
- package/dist/{login-QTAVYFVF.js → login-H6EP7A3D.js} +15 -13
- package/dist/{logout-ADLJGWD3.js → logout-S5JLGTKW.js} +11 -9
- package/dist/{look-WHPFOAD5.js → look-X5LTWUIV.js} +19 -18
- package/dist/{manager-R6S2BFJI.js → manager-GGOPVDOZ.js} +14 -13
- package/dist/{manager-ISZYNIK2.js → manager-PXRZQDDT.js} +2 -2
- package/dist/{measure-22AU7TYR.js → measure-XUHMK2AU.js} +12 -12
- package/dist/{media-TS5AB73F.js → media-YXE5MDL4.js} +17 -14
- package/dist/{media-treatment-437SK3IP.js → media-treatment-SJXT2VQM.js} +22 -21
- package/dist/{media-use-WIZLFHGZ.js → media-use-VK62B4E2.js} +13 -11
- package/dist/{models-55KT2FOE.js → models-GBAKNMXA.js} +19 -18
- package/dist/{motionShot-GR2XK7MG.js → motionShot-6DNYNDSA.js} +25 -24
- package/dist/{normalize-KYVBGCEM.js → normalize-AH7CCULG.js} +3 -3
- package/dist/{normalize-audio-7H5EXI7L.js → normalize-audio-RWERSIGD.js} +16 -15
- package/dist/{oauth-E5QBYYTX.js → oauth-RETRT7QD.js} +2 -1
- package/dist/{open-EEUJNVW4.js → open-3YMOWNPY.js} +31 -25
- package/dist/{parakeetRunner-CNF4YXTV.js → parakeetRunner-TVDHLBTI.js} +21 -20
- package/dist/{pipeline-Q2RJZQ4E.js → pipeline-WCH5HSYI.js} +16 -15
- package/dist/{plan-6RCNL7RA.js → plan-HVP3IH7H.js} +29 -28
- package/dist/{play-USR5S4WS.js → play-CQQ7HHSQ.js} +75 -61
- package/dist/{preflight-N5T57D6Q.js → preflight-6B6A46GT.js} +15 -14
- package/dist/{present-H36KTF2O.js → present-UB6UPVOL.js} +46 -37
- package/dist/{preview-CTXJ3D57.js → preview-BVSDP4Z7.js} +65 -63
- package/dist/{privateProjectFile-V5OO6UFK.js → privateProjectFile-NBXWYT2G.js} +14 -11
- package/dist/{probe-642YQRRC.js → probe-BOCLZXCU.js} +19 -18
- package/dist/{producer-MYTLLTMI.js → producer-HKFKQO2J.js} +1 -1
- package/dist/{progress-6MLINWFK.js → progress-WLBIHCZM.js} +4 -4
- package/dist/{projectConfig-PLXPNXPK.js → projectConfig-S7ZS2Q7T.js} +13 -12
- package/dist/{publication-2ZKN62ZD.js → publication-A6ZCUXEK.js} +8 -7
- package/dist/{publish-HU2M6QDD.js → publish-UA5UUDMQ.js} +38 -33
- package/dist/{receivedRecordFollow-3ITTF3YV.js → receivedRecordFollow-Y7JQ2W2O.js} +16 -15
- package/dist/{refresh-TS65XP6Q.js → refresh-T3APLU23.js} +11 -9
- package/dist/{remove-background-U6BRLHPJ.js → remove-background-YZ4FAKSD.js} +17 -16
- package/dist/{render-4VGHRQHU.js → render-CTU3KQWD.js} +63 -75
- package/dist/{render-ZRUNNKX2.js → render-HZFDCEBU.js} +55 -50
- package/dist/{render-SWLLJJUD.js → render-POJSNMDW.js} +13 -12
- package/dist/{render-batch-ADHAEQA7.js → render-batch-XUPWNAEB.js} +13 -12
- package/dist/renderSetupWorker.js +5 -5
- package/dist/{resolver-QQYGQNPZ.js → resolver-XFJ2W7CE.js} +10 -9
- package/dist/{reverse-XBPVILTU.js → reverse-DP3LTE2X.js} +1 -1
- package/dist/{run-VTUQ4O2Q.js → run-7YFWJGQA.js} +14 -12
- package/dist/{screenshotCapture-V7LXLF4P.js → screenshotCapture-XDIKLRCX.js} +16 -15
- package/dist/{service-B5XDMOX2.js → service-BMH3KCG2.js} +22 -20
- package/dist/{share-HTU2KE7G.js → share-GNE5S6JA.js} +26 -24
- package/dist/{sherpa-2NXXLF6T.js → sherpa-2NMBO7EI.js} +20 -19
- package/dist/sherpaWorker.js +3 -3
- package/dist/{sites-ZK652FTA.js → sites-2IEQMGTW.js} +4 -4
- package/dist/skills/hyperframes/references/plugin-installation.md +5 -1
- package/dist/skills/hyperframes/references/skill-lifecycle.md +2 -2
- package/dist/skills/hyperframes/scripts/plugin-cli.mjs +9 -4
- package/dist/skills/media-use/scripts/lib/cube-validate.mjs +2 -1
- package/dist/skills/media-use/scripts/lib/index-gen.mjs +4 -2
- package/dist/skills/media-use/scripts/lib/received-env.mjs +98 -17
- package/dist/skills/media-use/scripts/resolve.mjs +26 -12
- package/dist/{skills-AWPGNGNO.js → skills-SB465LBL.js} +12 -11
- package/dist/{skillsUpdateCheck-ZAZIJIA5.js → skillsUpdateCheck-OO3QYY7I.js} +3 -3
- package/dist/{snapshot-5H4FR6WF.js → snapshot-YYE5X4D6.js} +59 -58
- package/dist/{snapshotHeldVideos-AATHSYN4.js → snapshotHeldVideos-WKU5Q4NL.js} +14 -13
- package/dist/{src-ZPDXVFIW.js → src-COKNEXLI.js} +14 -11
- package/dist/{src-ZNVC4RPI.js → src-UEZXRPFJ.js} +18 -17
- package/dist/{start-B6XPI43A.js → start-RXKU3NS3.js} +33 -31
- package/dist/{state-G4YJMBU5.js → state-O6CCLWF6.js} +4 -4
- package/dist/{staticProjectServer-VFWEQZO4.js → staticProjectServer-PYOO5BKL.js} +29 -28
- package/dist/{status-5QNG3TNV.js → status-OO7JXNVG.js} +23 -21
- package/dist/studio/assets/hyperframes-player-DHYu0XuV.js +573 -0
- package/dist/studio/assets/{index-tvLrzMBv.js → index-BBKHfua5.js} +180 -180
- package/dist/studio/assets/{index-CAjz3b83.js → index-DqND4rHq.js} +1 -1
- package/dist/studio/assets/{pausedVideoDecoder-xC5IGkfB.js → pausedVideoDecoder-B1FNXBMe.js} +1 -1
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-SL7AIQYK.js → studio-api-3QHWJQ5S.js} +18 -17
- package/dist/{studioServer-S5MQI2JC.js → studioServer-DDL676LA.js} +80 -78
- package/dist/subCompositionWorker.js +10 -9
- package/dist/{sync-KGQNR7TY.js → sync-JOQ6E5IN.js} +19 -18
- package/dist/{synthesize-EIZ3XR5O.js → synthesize-JECKYUGO.js} +3 -3
- package/dist/{telemetry-WJSJUVUT.js → telemetry-PEPGYBEH.js} +9 -8
- package/dist/{templates-5NF42ZOM.js → templates-U3LTK3E6.js} +23 -21
- package/dist/{textOverFace-DAVKJPMO.js → textOverFace-665L5B6Q.js} +3 -3
- package/dist/{timeline-GM7EILYN.js → timeline-5H5XHN2E.js} +28 -27
- package/dist/{tokens-PR2VAUXH.js → tokens-ZT2YAOJ2.js} +13 -10
- package/dist/{transcribe-E6EJYLUY.js → transcribe-62GITMY3.js} +17 -16
- package/dist/{transcribe-ZD3MEPS2.js → transcribe-DVXDCZX7.js} +40 -38
- package/dist/{tts-XE4BPI5G.js → tts-V36EOYBQ.js} +8 -7
- package/dist/{update-QYZNK7US.js → update-QVKPG5CA.js} +17 -14
- package/dist/{updateCheck-AYR63UOT.js → updateCheck-X36OZADC.js} +2 -2
- package/dist/{upgrade-4EFXDQBF.js → upgrade-YE57GX33.js} +5 -5
- package/dist/{urlDownloader-KAT2IPSU.js → urlDownloader-UJ5T4WGL.js} +12 -11
- package/dist/{validate-GVX3ACWN.js → validate-IXPYD4ZO.js} +35 -34
- package/dist/{video-N2WHXSIC.js → video-OX3ZLXXC.js} +15 -14
- package/dist/{voices-46E3JGAU.js → voices-ND6HWM5H.js} +33 -31
- package/dist/warmCheck.js +55 -54
- package/package.json +1 -1
- package/dist/chunk-SEUEBRRL.js +0 -5128
- package/dist/studio/assets/hyperframes-player-Dscc6yHD.js +0 -573
|
@@ -11,12 +11,12 @@ import {
|
|
|
11
11
|
iterateFontFamilyDeclarations,
|
|
12
12
|
normalizeSystemFontPrimaryFamilies,
|
|
13
13
|
resolveFontFamilyDeclarationFamilies
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-7QNCNGN6.js";
|
|
15
15
|
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,10 +30,10 @@ 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
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-6ACARSAZ.js";
|
|
37
37
|
import {
|
|
38
38
|
createStudioPositionSeekReapplyScript,
|
|
39
39
|
openRangeEnd,
|
|
@@ -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";
|
|
@@ -246,7 +247,7 @@ import {
|
|
|
246
247
|
createStagingDir,
|
|
247
248
|
removeScratch,
|
|
248
249
|
renameWithRetry
|
|
249
|
-
} from "./chunk-
|
|
250
|
+
} from "./chunk-NIEOUHVQ.js";
|
|
250
251
|
import {
|
|
251
252
|
DISTRIBUTED_FPS,
|
|
252
253
|
HF_VFX_ATTR,
|
|
@@ -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,17 +302,17 @@ 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
|
|
308
|
-
} from "./chunk-
|
|
309
|
+
} from "./chunk-OGL5VQGT.js";
|
|
309
310
|
import {
|
|
310
311
|
chromeMajorCeiling
|
|
311
|
-
} from "./chunk-
|
|
312
|
+
} from "./chunk-LWX5PI73.js";
|
|
312
313
|
import {
|
|
313
314
|
resolveReferencedStart
|
|
314
|
-
} from "./chunk-
|
|
315
|
+
} from "./chunk-GXKCFOMR.js";
|
|
315
316
|
import {
|
|
316
317
|
isUnresolvedAssetPlaceholder,
|
|
317
318
|
namesAnotherNetworkRoot,
|
|
@@ -320,7 +321,7 @@ import {
|
|
|
320
321
|
readTextFile,
|
|
321
322
|
resolveCompositionSrc,
|
|
322
323
|
resolveProjectRelativeSrc
|
|
323
|
-
} from "./chunk-
|
|
324
|
+
} from "./chunk-UVW5ZDAP.js";
|
|
324
325
|
import {
|
|
325
326
|
LOW_MEMORY_TOTAL_MB_THRESHOLD,
|
|
326
327
|
getCgroupMemoryLimitMb,
|
|
@@ -354,7 +355,7 @@ import {
|
|
|
354
355
|
rewriteInlineStyleAssetUrls,
|
|
355
356
|
styleBlockMatches,
|
|
356
357
|
stylesheetLinkMatches
|
|
357
|
-
} from "./chunk-
|
|
358
|
+
} from "./chunk-KZ5PV5TL.js";
|
|
358
359
|
import {
|
|
359
360
|
CANVAS_DIMENSIONS,
|
|
360
361
|
VALID_CANVAS_RESOLUTIONS,
|
|
@@ -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";
|
|
@@ -6999,6 +7107,21 @@ var fileTooLarge = (file, bytes) => new CompositionTooLargeError(
|
|
|
6999
7107
|
`Composition file "${file}" is ${megabytes(bytes)}, over the ${megabytes(MAX_COMPOSITION_HTML_BYTES)} limit for one composition HTML file. Keep large data such as images, fonts and JSON in separate asset files and reference them by path instead of inlining them.`,
|
|
7000
7108
|
{ bytes, limitBytes: MAX_COMPOSITION_HTML_BYTES }
|
|
7001
7109
|
);
|
|
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";
|
|
7113
|
+
function generatedTooLarge(file, bytes) {
|
|
7114
|
+
if (file === "composition variables") {
|
|
7115
|
+
return `Composition variable styles add up to ${megabytes(bytes)}. ${limitText}. Shorten the variable values or declare them on fewer elements.`;
|
|
7116
|
+
}
|
|
7117
|
+
if (file === "variable media sources") {
|
|
7118
|
+
return `Variable-bound media sources add up to ${megabytes(bytes)}. ${limitText}. Use shorter URLs or bind fewer elements.`;
|
|
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
|
+
}
|
|
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.`;
|
|
7124
|
+
}
|
|
7002
7125
|
var CompositionExpansionBudget = class {
|
|
7003
7126
|
bytes = 0;
|
|
7004
7127
|
mounts = 0;
|
|
@@ -7007,10 +7130,16 @@ var CompositionExpansionBudget = class {
|
|
|
7007
7130
|
chargeGenerated(file, bytes) {
|
|
7008
7131
|
this.generated += bytes;
|
|
7009
7132
|
if (this.generated <= MAX_EXPANDED_COMPOSITION_BYTES) return;
|
|
7010
|
-
throw new CompositionTooLargeError(
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7133
|
+
throw new CompositionTooLargeError(generatedTooLarge(file, this.generated), {
|
|
7134
|
+
bytes: this.generated,
|
|
7135
|
+
limitBytes: MAX_EXPANDED_COMPOSITION_BYTES,
|
|
7136
|
+
exceeded: "generated"
|
|
7137
|
+
});
|
|
7138
|
+
}
|
|
7139
|
+
chargeGeneratedIfItFits(bytes) {
|
|
7140
|
+
if (this.generated + bytes > MAX_EXPANDED_COMPOSITION_BYTES) return false;
|
|
7141
|
+
this.generated += bytes;
|
|
7142
|
+
return true;
|
|
7014
7143
|
}
|
|
7015
7144
|
charge(file, bytes) {
|
|
7016
7145
|
this.bytes += bytes;
|
|
@@ -7043,18 +7172,18 @@ function assertCompositionFileSize(path, file) {
|
|
|
7043
7172
|
|
|
7044
7173
|
// ../producer/src/services/htmlCompiler.ts
|
|
7045
7174
|
import { createHash as createHash4 } from "crypto";
|
|
7046
|
-
import { createReadStream as createReadStream2, existsSync as
|
|
7047
|
-
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";
|
|
7048
7177
|
|
|
7049
7178
|
// ../producer/src/services/bundledScripts.ts
|
|
7050
|
-
import { existsSync as
|
|
7051
|
-
import { join as
|
|
7179
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
|
|
7180
|
+
import { join as join15 } from "path";
|
|
7052
7181
|
var GSAP_VENDOR_DIR_ENV = "HYPERFRAMES_GSAP_VENDOR_DIR";
|
|
7053
7182
|
function bundledScript(url) {
|
|
7054
7183
|
const dir = process.env[GSAP_VENDOR_DIR_ENV];
|
|
7055
7184
|
if (!dir || url !== `${gsapCdnDist()}gsap.min.js`) return null;
|
|
7056
|
-
const file =
|
|
7057
|
-
return
|
|
7185
|
+
const file = join15(dir, "gsap.min.js");
|
|
7186
|
+
return existsSync9(file) ? readFileSync5(file) : null;
|
|
7058
7187
|
}
|
|
7059
7188
|
|
|
7060
7189
|
// ../producer/src/services/renderMediaCollector.ts
|
|
@@ -7204,8 +7333,8 @@ function getPositionEditsRenderScript() {
|
|
|
7204
7333
|
}
|
|
7205
7334
|
|
|
7206
7335
|
// ../producer/src/services/assetMediaType.ts
|
|
7207
|
-
import { existsSync as
|
|
7208
|
-
import { dirname as dirname6, join as
|
|
7336
|
+
import { existsSync as existsSync10 } from "fs";
|
|
7337
|
+
import { dirname as dirname6, join as join16 } from "path";
|
|
7209
7338
|
var ASSET_MEDIA_TYPE_MISMATCH = "ASSET_MEDIA_TYPE_MISMATCH";
|
|
7210
7339
|
var AssetMediaTypeMismatchError = class extends Error {
|
|
7211
7340
|
// fallow-ignore-next-line unused-class-member
|
|
@@ -7246,11 +7375,11 @@ function assertAssetMediaTypeProfile(expected, profile, elementIdentity) {
|
|
|
7246
7375
|
]);
|
|
7247
7376
|
}
|
|
7248
7377
|
function mediaAssetRoots(projectDir, compiledDir) {
|
|
7249
|
-
return [projectDir, compiledDir,
|
|
7378
|
+
return [projectDir, compiledDir, join16(dirname6(compiledDir), "downloads")];
|
|
7250
7379
|
}
|
|
7251
7380
|
function dropMediaOutsideProject(input) {
|
|
7252
7381
|
const { projectDir, workDir, composition, log } = input;
|
|
7253
|
-
const compiledDir =
|
|
7382
|
+
const compiledDir = join16(workDir, "compiled");
|
|
7254
7383
|
const roots = mediaAssetRoots(projectDir, compiledDir);
|
|
7255
7384
|
const staysInside = ({ id, src }) => {
|
|
7256
7385
|
if (!src || isHttpUrl(src)) return true;
|
|
@@ -7305,7 +7434,7 @@ async function preflightCompositionAssetMediaTypes(input) {
|
|
|
7305
7434
|
input.projectDir,
|
|
7306
7435
|
input.compiledDir
|
|
7307
7436
|
);
|
|
7308
|
-
if (!
|
|
7437
|
+
if (!existsSync10(resolvedPath)) continue;
|
|
7309
7438
|
byPath.set(resolvedPath, [...byPath.get(resolvedPath) ?? [], reference]);
|
|
7310
7439
|
}
|
|
7311
7440
|
const mismatches = [];
|
|
@@ -7396,7 +7525,7 @@ function normalizeCompositionSrcs(html, projectDir) {
|
|
|
7396
7525
|
if (!value.includes("%") && !/^\.?[\\/]/.test(value)) return whole;
|
|
7397
7526
|
const file = resolveCompositionSrc(projectDir, value);
|
|
7398
7527
|
if (file === null) return whole;
|
|
7399
|
-
return `${name}${quote}${
|
|
7528
|
+
return `${name}${quote}${relative3(projectDir, file).split(sep3).join("/")}${quote}`;
|
|
7400
7529
|
});
|
|
7401
7530
|
}
|
|
7402
7531
|
var COMPOSITION_FILE = /\.html?$/i;
|
|
@@ -7601,8 +7730,8 @@ function detectShaderTransitionUsage(html) {
|
|
|
7601
7730
|
async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, baseDir, downloadDir, tagName, elementIdentity, log, urlByAbsentLocalPath, probes, assetRoot) {
|
|
7602
7731
|
let filePath = src;
|
|
7603
7732
|
if (isHttpUrl(src)) {
|
|
7604
|
-
const remoteDir =
|
|
7605
|
-
if (!
|
|
7733
|
+
const remoteDir = join17(downloadDir, REMOTE_MEDIA_SUBDIR);
|
|
7734
|
+
if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
|
|
7606
7735
|
try {
|
|
7607
7736
|
filePath = await downloadToTemp(src, remoteDir, void 0, void 0, void 0, {
|
|
7608
7737
|
onTelemetry: logRemoteDownloadTelemetry
|
|
@@ -7612,7 +7741,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
7612
7741
|
}
|
|
7613
7742
|
} else {
|
|
7614
7743
|
filePath = decodedUrlPath(src);
|
|
7615
|
-
if (!filePath.startsWith("/")) filePath =
|
|
7744
|
+
if (!filePath.startsWith("/")) filePath = join17(baseDir, filePath);
|
|
7616
7745
|
if (escapesAssetRoot(filePath, assetRoot) || isPrivateUnderAssetRoots(filePath, [projectDir, downloadDir])) {
|
|
7617
7746
|
return { duration: null, resolvedPath: filePath };
|
|
7618
7747
|
}
|
|
@@ -7621,7 +7750,7 @@ async function resolveMediaDuration(src, mediaStart, playbackRate, projectDir, b
|
|
|
7621
7750
|
return { duration: null, resolvedPath: filePath };
|
|
7622
7751
|
}
|
|
7623
7752
|
}
|
|
7624
|
-
if (!isHttpUrl(filePath) && !
|
|
7753
|
+
if (!isHttpUrl(filePath) && !existsSync11(filePath)) {
|
|
7625
7754
|
return { duration: null, resolvedPath: filePath };
|
|
7626
7755
|
}
|
|
7627
7756
|
const withSrcContext = (error) => {
|
|
@@ -7941,7 +8070,7 @@ function coalesceHeadStylesAndBodyScripts(html) {
|
|
|
7941
8070
|
}
|
|
7942
8071
|
return document2.toString();
|
|
7943
8072
|
}
|
|
7944
|
-
function inlineSubCompositions2(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles) {
|
|
8073
|
+
function inlineSubCompositions2(html, subCompositions, projectDir, variableOverrides, assetRoot, outsideFiles, budget) {
|
|
7945
8074
|
const { document: document2 } = parseHTML(html);
|
|
7946
8075
|
const head = document2.querySelector("head");
|
|
7947
8076
|
const body = document2.querySelector("body");
|
|
@@ -7950,11 +8079,11 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
7950
8079
|
const emitted = emitRootCompositionVariableStyles(
|
|
7951
8080
|
document2,
|
|
7952
8081
|
{},
|
|
7953
|
-
variableOverrides
|
|
8082
|
+
variableOverrides,
|
|
8083
|
+
{ chargeBytes: (bytes) => budget.chargeGenerated("composition variables", bytes) }
|
|
7954
8084
|
);
|
|
7955
8085
|
return { html: emitted ? document2.toString() : html, variablesByComp: {} };
|
|
7956
8086
|
}
|
|
7957
|
-
const budget = new CompositionExpansionBudget();
|
|
7958
8087
|
const readOnce = /* @__PURE__ */ new Map();
|
|
7959
8088
|
const readMountHtml = (srcPath) => {
|
|
7960
8089
|
const filePath = resolveCompositionFile(projectDir, srcPath, assetRoot);
|
|
@@ -7989,6 +8118,10 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
7989
8118
|
hostIdentityMap: hostIdentityByElement,
|
|
7990
8119
|
readVariableDefaults: readDeclaredDefaults,
|
|
7991
8120
|
parseHostVariables: parseHostVariableValues,
|
|
8121
|
+
resolveFilePath: (srcPath) => {
|
|
8122
|
+
const file = resolveCompositionFile(projectDir, srcPath, assetRoot);
|
|
8123
|
+
return file && relative3(projectDir, file).split(sep3).join("/");
|
|
8124
|
+
},
|
|
7992
8125
|
resolveHtml: (srcPath) => {
|
|
7993
8126
|
const compHtml = resolveMountHtml(srcPath);
|
|
7994
8127
|
if (compHtml) budget.charge(srcPath, Buffer.byteLength(compHtml));
|
|
@@ -8079,7 +8212,8 @@ function inlineSubCompositions2(html, subCompositions, projectDir, variableOverr
|
|
|
8079
8212
|
emitRootCompositionVariableStyles(
|
|
8080
8213
|
document2,
|
|
8081
8214
|
result.variablesByComp,
|
|
8082
|
-
variableOverrides
|
|
8215
|
+
variableOverrides,
|
|
8216
|
+
{ chargeBytes: (bytes) => budget.chargeGenerated("composition variables", bytes) }
|
|
8083
8217
|
);
|
|
8084
8218
|
assignMediaRenderIds(document2);
|
|
8085
8219
|
return { html: document2.toString(), variablesByComp: result.variablesByComp };
|
|
@@ -8150,7 +8284,8 @@ async function downloadScript(src, mirror) {
|
|
|
8150
8284
|
}
|
|
8151
8285
|
return fetchPublicHttpsBytes(src, { maxBytes: MAX_SCRIPT_BYTES, timeoutMs: 15e3 });
|
|
8152
8286
|
}
|
|
8153
|
-
|
|
8287
|
+
var MAX_CONCURRENT_SCRIPT_FETCHES = 4;
|
|
8288
|
+
async function inlineExternalScripts(html, budget = new CompositionExpansionBudget()) {
|
|
8154
8289
|
const fullHtml = ensureFullDocument(html);
|
|
8155
8290
|
const wrappedFragment = fullHtml !== html;
|
|
8156
8291
|
const { document: document2 } = parseHTML(fullHtml);
|
|
@@ -8164,20 +8299,52 @@ async function inlineExternalScripts(html) {
|
|
|
8164
8299
|
}
|
|
8165
8300
|
if (externalScripts.length === 0) return html;
|
|
8166
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();
|
|
8167
8330
|
const downloads = await Promise.allSettled(
|
|
8168
8331
|
externalScripts.map(async ({ el, src }) => {
|
|
8169
8332
|
const integrity = el.getAttribute("integrity") || "";
|
|
8170
|
-
|
|
8171
|
-
if (
|
|
8172
|
-
|
|
8173
|
-
}
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
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);
|
|
8177
8343
|
}
|
|
8178
8344
|
return { src, text: new TextDecoder().decode(bytes) };
|
|
8179
8345
|
})
|
|
8180
8346
|
);
|
|
8347
|
+
if (stop.signal.aborted) throw stop.signal.reason;
|
|
8181
8348
|
for (let i = 0; i < downloads.length; i++) {
|
|
8182
8349
|
const download = downloads[i];
|
|
8183
8350
|
const { el, src } = externalScripts[i];
|
|
@@ -8204,18 +8371,18 @@ ${safeText}
|
|
|
8204
8371
|
return wrappedFragment ? document2.body.innerHTML || "" : document2.toString();
|
|
8205
8372
|
}
|
|
8206
8373
|
function collectExternalAssets(html, projectDir, log = defaultLogger, file = "index.html", policy = {}) {
|
|
8207
|
-
const absProjectDir =
|
|
8374
|
+
const absProjectDir = resolve6(projectDir);
|
|
8208
8375
|
const externalAssets = /* @__PURE__ */ new Map();
|
|
8209
8376
|
const leftOut = /* @__PURE__ */ new Set();
|
|
8210
8377
|
function processPath(rawPath) {
|
|
8211
8378
|
const trimmed = rawPath.trim();
|
|
8212
8379
|
if (isNonRelativeUrl(trimmed)) return null;
|
|
8213
|
-
const absPath =
|
|
8380
|
+
const absPath = resolve6(absProjectDir, trimmed);
|
|
8214
8381
|
if (isPathInside(absPath, absProjectDir)) {
|
|
8215
8382
|
return null;
|
|
8216
8383
|
}
|
|
8217
8384
|
const onShare = namesAnotherNetworkRoot(absProjectDir, absPath);
|
|
8218
|
-
if (!onShare && !
|
|
8385
|
+
if (!onShare && !existsSync11(absPath)) return null;
|
|
8219
8386
|
const refusal = onShare ? "network_share" : outsideAssetRefusal(absProjectDir, absPath, policy);
|
|
8220
8387
|
if (refusal) {
|
|
8221
8388
|
if (!leftOut.has(trimmed)) log.warn(`[Compiler] ${leftOutOfRender(file, trimmed, refusal)}`);
|
|
@@ -8268,7 +8435,7 @@ function collectExternalAssets(html, projectDir, log = defaultLogger, file = "in
|
|
|
8268
8435
|
var REMOTE_MEDIA_SUBDIR = "_remote_media";
|
|
8269
8436
|
async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLabel, extraRewrite) {
|
|
8270
8437
|
if (urlSet.size === 0) return { html, remoteMediaAssets: /* @__PURE__ */ new Map() };
|
|
8271
|
-
if (!
|
|
8438
|
+
if (!existsSync11(remoteDir)) mkdirSync7(remoteDir, { recursive: true });
|
|
8272
8439
|
const urlToLocal = /* @__PURE__ */ new Map();
|
|
8273
8440
|
await Promise.all(
|
|
8274
8441
|
[...urlSet].map(async (url) => {
|
|
@@ -8291,7 +8458,7 @@ async function downloadAndRewriteUrls(urlSet, html, remoteDir, warnLabel, logLab
|
|
|
8291
8458
|
const remoteMediaAssets = /* @__PURE__ */ new Map();
|
|
8292
8459
|
const urlToRelPath = /* @__PURE__ */ new Map();
|
|
8293
8460
|
for (const [url, absPath] of urlToLocal) {
|
|
8294
|
-
const relPath = `${REMOTE_MEDIA_SUBDIR}/${
|
|
8461
|
+
const relPath = `${REMOTE_MEDIA_SUBDIR}/${basename5(absPath)}`;
|
|
8295
8462
|
remoteMediaAssets.set(relPath, absPath);
|
|
8296
8463
|
urlToRelPath.set(url, relPath);
|
|
8297
8464
|
}
|
|
@@ -8308,7 +8475,7 @@ async function localizeRemoteMediaSources(html, downloadDir) {
|
|
|
8308
8475
|
const localized = await downloadAndRewriteUrls(
|
|
8309
8476
|
urlSet,
|
|
8310
8477
|
html,
|
|
8311
|
-
|
|
8478
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8312
8479
|
"Remote media download failed",
|
|
8313
8480
|
"Localized remote media source(s)"
|
|
8314
8481
|
);
|
|
@@ -8331,7 +8498,7 @@ async function localizeRemoteImageSources(html, downloadDir) {
|
|
|
8331
8498
|
return downloadAndRewriteUrls(
|
|
8332
8499
|
urlSet,
|
|
8333
8500
|
html,
|
|
8334
|
-
|
|
8501
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8335
8502
|
"Remote image download failed",
|
|
8336
8503
|
"Localized remote image source(s)"
|
|
8337
8504
|
);
|
|
@@ -8344,7 +8511,7 @@ async function localizeRemoteBackgroundImages(html, downloadDir) {
|
|
|
8344
8511
|
return downloadAndRewriteUrls(
|
|
8345
8512
|
urlSet,
|
|
8346
8513
|
html,
|
|
8347
|
-
|
|
8514
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8348
8515
|
"Remote background-image download failed",
|
|
8349
8516
|
"Localized remote background-image(s)",
|
|
8350
8517
|
// Quoted url('..')/url("..") are rewritten by downloadAndRewriteUrls' default
|
|
@@ -8401,48 +8568,50 @@ function matchingBraces(css) {
|
|
|
8401
8568
|
}
|
|
8402
8569
|
return closes;
|
|
8403
8570
|
}
|
|
8404
|
-
|
|
8405
|
-
const
|
|
8406
|
-
|
|
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();
|
|
8407
8578
|
for (const { parts } of stylesheetLinkMatches(html)) {
|
|
8408
|
-
const
|
|
8409
|
-
|
|
8410
|
-
if (!hrefMatch?.[1]) continue;
|
|
8411
|
-
const href = hrefMatch[1];
|
|
8412
|
-
if (!/^https?:\/\//i.test(href)) continue;
|
|
8413
|
-
if (isGoogleFontsUrl(href)) continue;
|
|
8414
|
-
linkMatches.push({ fullMatch: tag, href });
|
|
8415
|
-
}
|
|
8416
|
-
if (linkMatches.length === 0) return html;
|
|
8417
|
-
const MAX_CONCURRENT_STYLESHEET_FETCHES = 4;
|
|
8418
|
-
const fetches = [];
|
|
8419
|
-
for (let i = 0; i < linkMatches.length; i += MAX_CONCURRENT_STYLESHEET_FETCHES) {
|
|
8420
|
-
const batch = linkMatches.slice(i, i + MAX_CONCURRENT_STYLESHEET_FETCHES);
|
|
8421
|
-
const results = await Promise.all(
|
|
8422
|
-
batch.map(async ({ fullMatch, href }) => {
|
|
8423
|
-
const css = await fetchExternalStylesheetCss(href);
|
|
8424
|
-
return { fullMatch, href, css };
|
|
8425
|
-
})
|
|
8426
|
-
);
|
|
8427
|
-
fetches.push(...results);
|
|
8579
|
+
const href = remoteFontStylesheetHref(parts[0]);
|
|
8580
|
+
if (href) hrefs.add(href);
|
|
8428
8581
|
}
|
|
8429
|
-
|
|
8430
|
-
|
|
8431
|
-
|
|
8432
|
-
|
|
8433
|
-
|
|
8434
|
-
const
|
|
8435
|
-
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 */
|
|
8436
8594
|
${fontFaceBlocks.join("\n")}
|
|
8437
8595
|
</style>`;
|
|
8438
|
-
|
|
8439
|
-
|
|
8440
|
-
|
|
8441
|
-
|
|
8442
|
-
|
|
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
|
+
});
|
|
8443
8604
|
});
|
|
8444
8605
|
}
|
|
8445
|
-
|
|
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
|
+
});
|
|
8446
8615
|
}
|
|
8447
8616
|
function projectStylesheetFontFamilies(html, projectDir) {
|
|
8448
8617
|
const families = [];
|
|
@@ -8451,14 +8620,14 @@ function projectStylesheetFontFamilies(html, projectDir) {
|
|
|
8451
8620
|
} of stylesheetLinkMatches(html)) {
|
|
8452
8621
|
const href = /\bhref=["']([^"']+)["']/i.exec(tag)?.[1];
|
|
8453
8622
|
if (!href || /^(?:[a-z][a-z\d+.-]*:|\/\/)/i.test(href)) continue;
|
|
8454
|
-
const sheet =
|
|
8455
|
-
if (!isPathInside(sheet, projectDir) || !
|
|
8623
|
+
const sheet = resolve6(projectDir, decodedUrlPath(href).replace(/^(?:\.?\/)+/, ""));
|
|
8624
|
+
if (!isPathInside(sheet, projectDir) || !existsSync11(sheet)) continue;
|
|
8456
8625
|
for (const face of extractFontFaceBlocks(readFileSync6(sheet, "utf8"))) {
|
|
8457
8626
|
const family = /font-family\s*:\s*([^;}]+)/i.exec(face)?.[1]?.trim().replace(/^['"]|['"]$/g, "");
|
|
8458
8627
|
const shipsFile = [...localFontFaceUrlMatches(face)].some(({ parts: [, url = ""] }) => {
|
|
8459
8628
|
const path = decodedUrlPath(url);
|
|
8460
|
-
const file = path.startsWith("/") ?
|
|
8461
|
-
return isPathInside(file, projectDir) &&
|
|
8629
|
+
const file = path.startsWith("/") ? resolve6(projectDir, `.${path}`) : resolve6(dirname7(sheet), path);
|
|
8630
|
+
return isPathInside(file, projectDir) && existsSync11(file);
|
|
8462
8631
|
});
|
|
8463
8632
|
if (family && shipsFile) families.push(family);
|
|
8464
8633
|
}
|
|
@@ -8498,16 +8667,12 @@ function localizeFontFaceUrls(html, downloadDir) {
|
|
|
8498
8667
|
return downloadAndRewriteUrls(
|
|
8499
8668
|
collectFontFaceUrls(html),
|
|
8500
8669
|
html,
|
|
8501
|
-
|
|
8670
|
+
join17(downloadDir, REMOTE_MEDIA_SUBDIR),
|
|
8502
8671
|
"Remote font download failed",
|
|
8503
8672
|
"Localized remote font face(s)",
|
|
8504
8673
|
(h, url, relPath) => h.replaceAll(`url(${url})`, `url("${relPath}")`)
|
|
8505
8674
|
);
|
|
8506
8675
|
}
|
|
8507
|
-
function urlOccurrenceRe(localPath) {
|
|
8508
|
-
const escaped = localPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8509
|
-
return new RegExp(`url\\((["']?)${escaped}\\1\\)`, "g");
|
|
8510
|
-
}
|
|
8511
8676
|
var MAX_LOCAL_FONT_DATA_URI_BYTES = 5 * 1024 * 1024;
|
|
8512
8677
|
async function readLocalFont(absPath) {
|
|
8513
8678
|
const chunks = [];
|
|
@@ -8522,59 +8687,83 @@ async function readLocalFont(absPath) {
|
|
|
8522
8687
|
}
|
|
8523
8688
|
return { kind: "inline", buffer: Buffer.concat(chunks, totalBytes) };
|
|
8524
8689
|
}
|
|
8525
|
-
async function
|
|
8526
|
-
const
|
|
8527
|
-
|
|
8528
|
-
|
|
8690
|
+
async function localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsolutePath, log) {
|
|
8691
|
+
const absPath = localPath.startsWith("/") ? localPath : resolve6(projectDir, localPath);
|
|
8692
|
+
if (!isPathInside(absPath, projectDir) || escapesAssetRoot(absPath, assetRoot)) return void 0;
|
|
8693
|
+
if (refusesOutsideLink(projectDir, absPath, (line) => log.warn(`[Compiler] ${line}`))) {
|
|
8694
|
+
return void 0;
|
|
8695
|
+
}
|
|
8696
|
+
if (isPrivateCompositionFile(projectDir, absPath)) return void 0;
|
|
8697
|
+
if (dataUriByAbsolutePath.has(absPath)) return dataUriByAbsolutePath.get(absPath);
|
|
8698
|
+
const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
|
|
8699
|
+
try {
|
|
8700
|
+
const font = await readLocalFont(absPath);
|
|
8701
|
+
if (font.kind === "file-backed") {
|
|
8702
|
+
dataUriByAbsolutePath.set(absPath, void 0);
|
|
8703
|
+
defaultLogger.debug(
|
|
8704
|
+
`[Compiler] Kept large local font file-backed: ${localPath} (> ${(MAX_LOCAL_FONT_DATA_URI_BYTES / 1024 / 1024).toFixed(1)} MB)`
|
|
8705
|
+
);
|
|
8706
|
+
return void 0;
|
|
8707
|
+
}
|
|
8708
|
+
const { fontToDataUri } = await import("./deterministicFonts-645ILNLP.js");
|
|
8709
|
+
const dataUri = await fontToDataUri(font.buffer, ext, { compressToWoff2: false });
|
|
8710
|
+
dataUriByAbsolutePath.set(absPath, dataUri);
|
|
8711
|
+
defaultLogger.debug(
|
|
8712
|
+
`[Compiler] Embedded local font file: ${localPath} (${(font.buffer.length / 1024).toFixed(0)} KB \u2192 data URI)`
|
|
8713
|
+
);
|
|
8714
|
+
return dataUri;
|
|
8715
|
+
} catch (error) {
|
|
8716
|
+
defaultLogger.warn(
|
|
8717
|
+
`[Compiler] Could not embed local font ${localPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
8718
|
+
);
|
|
8719
|
+
return void 0;
|
|
8720
|
+
}
|
|
8721
|
+
}
|
|
8722
|
+
var replaceInner = (whole, inner, tail, next) => whole.slice(0, whole.length - tail - inner.length) + next + whole.slice(whole.length - tail);
|
|
8723
|
+
async function embedLocalFontFaces(html, projectDir, assetRoot, budget, log = defaultLogger) {
|
|
8724
|
+
const dataUriByPath = /* @__PURE__ */ new Map();
|
|
8529
8725
|
const dataUriByAbsolutePath = /* @__PURE__ */ new Map();
|
|
8530
|
-
const fileBackedAbsolutePaths = /* @__PURE__ */ new Set();
|
|
8531
8726
|
for (const { parts: style } of styleBlockMatches(html)) {
|
|
8532
8727
|
for (const { parts: face } of fontFaceBlockMatches(style[1])) {
|
|
8533
|
-
const
|
|
8534
|
-
for (const { parts } of localFontFaceUrlMatches(block)) {
|
|
8728
|
+
for (const { parts } of localFontFaceUrlMatches(face[1])) {
|
|
8535
8729
|
const localPath = parts[1];
|
|
8536
|
-
if (!localPath ||
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
continue;
|
|
8542
|
-
}
|
|
8543
|
-
if (isPrivateCompositionFile(projectDir, absPath)) continue;
|
|
8544
|
-
const ext = absPath.match(/\.(woff2?|ttf|otf|ttc)$/i)?.[1]?.toLowerCase() ?? "ttf";
|
|
8545
|
-
try {
|
|
8546
|
-
if (fileBackedAbsolutePaths.has(absPath)) {
|
|
8547
|
-
embeddedPaths.add(localPath);
|
|
8548
|
-
continue;
|
|
8549
|
-
}
|
|
8550
|
-
let dataUri = dataUriByAbsolutePath.get(absPath);
|
|
8551
|
-
if (!dataUri) {
|
|
8552
|
-
const font = await readLocalFont(absPath);
|
|
8553
|
-
if (font.kind === "file-backed") {
|
|
8554
|
-
fileBackedAbsolutePaths.add(absPath);
|
|
8555
|
-
defaultLogger.debug(
|
|
8556
|
-
`[Compiler] Kept large local font file-backed: ${localPath} (> ${(MAX_LOCAL_FONT_DATA_URI_BYTES / 1024 / 1024).toFixed(1)} MB)`
|
|
8557
|
-
);
|
|
8558
|
-
embeddedPaths.add(localPath);
|
|
8559
|
-
continue;
|
|
8560
|
-
}
|
|
8561
|
-
dataUri = await toDataUri(font.buffer, ext, { compressToWoff2: false });
|
|
8562
|
-
dataUriByAbsolutePath.set(absPath, dataUri);
|
|
8563
|
-
defaultLogger.debug(
|
|
8564
|
-
`[Compiler] Embedded local font file: ${localPath} (${(font.buffer.length / 1024).toFixed(0)} KB \u2192 data URI)`
|
|
8565
|
-
);
|
|
8566
|
-
}
|
|
8567
|
-
result = result.replace(urlOccurrenceRe(localPath), `url("${dataUri}")`);
|
|
8568
|
-
embeddedPaths.add(localPath);
|
|
8569
|
-
} catch (error) {
|
|
8570
|
-
defaultLogger.warn(
|
|
8571
|
-
`[Compiler] Could not embed local font ${localPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
8572
|
-
);
|
|
8573
|
-
}
|
|
8730
|
+
if (!localPath || dataUriByPath.has(localPath)) continue;
|
|
8731
|
+
dataUriByPath.set(
|
|
8732
|
+
localPath,
|
|
8733
|
+
await localFontDataUri(localPath, projectDir, assetRoot, dataUriByAbsolutePath, log)
|
|
8734
|
+
);
|
|
8574
8735
|
}
|
|
8575
8736
|
}
|
|
8576
8737
|
}
|
|
8577
|
-
return
|
|
8738
|
+
if (![...dataUriByPath.values()].some(Boolean)) return html;
|
|
8739
|
+
let warned = false;
|
|
8740
|
+
const embed = (source, localPath) => {
|
|
8741
|
+
const dataUri = dataUriByPath.get(localPath);
|
|
8742
|
+
if (!dataUri) return source;
|
|
8743
|
+
const inlined = `url("${dataUri}")`;
|
|
8744
|
+
if (budget.chargeGeneratedIfItFits(inlined.length - source.length)) return inlined;
|
|
8745
|
+
if (!warned) {
|
|
8746
|
+
warned = true;
|
|
8747
|
+
log.warn(
|
|
8748
|
+
`[Compiler] Kept local font ${localPath} file-backed: the page reached its inline size limit`
|
|
8749
|
+
);
|
|
8750
|
+
}
|
|
8751
|
+
return source;
|
|
8752
|
+
};
|
|
8753
|
+
return replaceMatches(
|
|
8754
|
+
html,
|
|
8755
|
+
styleBlockMatches(html),
|
|
8756
|
+
(style, css) => replaceInner(
|
|
8757
|
+
style,
|
|
8758
|
+
css,
|
|
8759
|
+
"</style>".length,
|
|
8760
|
+
replaceMatches(
|
|
8761
|
+
css,
|
|
8762
|
+
fontFaceBlockMatches(css),
|
|
8763
|
+
(face, body) => replaceInner(face, body, 1, replaceMatches(body, localFontFaceUrlMatches(body), embed))
|
|
8764
|
+
)
|
|
8765
|
+
)
|
|
8766
|
+
);
|
|
8578
8767
|
}
|
|
8579
8768
|
function renderGsapDist() {
|
|
8580
8769
|
try {
|
|
@@ -8589,8 +8778,8 @@ function renderGsapDist() {
|
|
|
8589
8778
|
function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
|
|
8590
8779
|
let gsapDist;
|
|
8591
8780
|
const exists = (path) => {
|
|
8592
|
-
const file =
|
|
8593
|
-
return !namesAnotherNetworkRoot(projectDir, file) &&
|
|
8781
|
+
const file = resolve6(projectDir, path);
|
|
8782
|
+
return !namesAnotherNetworkRoot(projectDir, file) && existsSync11(file);
|
|
8594
8783
|
};
|
|
8595
8784
|
return replaceGsapDistScripts(html, (full, prefix, src, file, suffix) => {
|
|
8596
8785
|
if (/^https?:\/\//i.test(src)) return full;
|
|
@@ -8600,32 +8789,42 @@ function rewriteUnresolvableGsapToCdn(html, projectDir, compSrcPath) {
|
|
|
8600
8789
|
return `${prefix}${gsapDist}${file}${suffix}`;
|
|
8601
8790
|
});
|
|
8602
8791
|
}
|
|
8603
|
-
function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath) {
|
|
8792
|
+
function rebaseDirectEntryAssetPaths(html, projectDir, htmlPath, budget) {
|
|
8604
8793
|
if (!isPathInside(htmlPath, projectDir)) return html;
|
|
8605
|
-
const entryPath =
|
|
8794
|
+
const entryPath = relative3(projectDir, htmlPath).replace(/\\/g, "/");
|
|
8606
8795
|
if (!entryPath.includes("/")) return html;
|
|
8607
8796
|
const { document: document2 } = parseHTML(html);
|
|
8608
8797
|
const assetExists = projectAssetExists(projectDir);
|
|
8798
|
+
const charge = (bytes) => budget.chargeGenerated(entryPath, bytes);
|
|
8609
8799
|
rewriteAssetPaths(
|
|
8610
8800
|
document2.querySelectorAll("[src], [href], [srcset]"),
|
|
8611
8801
|
entryPath,
|
|
8612
8802
|
(el, attr) => el.getAttribute(attr),
|
|
8613
8803
|
(el, attr, value) => el.setAttribute(attr, value),
|
|
8614
|
-
assetExists
|
|
8804
|
+
assetExists,
|
|
8805
|
+
charge
|
|
8615
8806
|
);
|
|
8616
8807
|
rewriteInlineStyleAssetUrls(
|
|
8617
8808
|
document2.querySelectorAll("[style]"),
|
|
8618
8809
|
entryPath,
|
|
8619
8810
|
(el) => el.getAttribute("style"),
|
|
8620
8811
|
(el, value) => el.setAttribute("style", value),
|
|
8621
|
-
assetExists
|
|
8812
|
+
assetExists,
|
|
8813
|
+
charge
|
|
8622
8814
|
);
|
|
8623
8815
|
for (const style of document2.querySelectorAll("style")) {
|
|
8624
|
-
style.textContent = rewriteCssAssetUrls(
|
|
8816
|
+
style.textContent = rewriteCssAssetUrls(
|
|
8817
|
+
style.textContent || "",
|
|
8818
|
+
entryPath,
|
|
8819
|
+
assetExists,
|
|
8820
|
+
charge
|
|
8821
|
+
);
|
|
8625
8822
|
}
|
|
8626
8823
|
return document2.toString();
|
|
8627
8824
|
}
|
|
8628
|
-
|
|
8825
|
+
var MAX_VARIABLE_MEDIA_SRC_BYTES = 8 * 1024;
|
|
8826
|
+
var MEDIA_SRC_CONTROL_CHARS = /[\u0000-\u001f\u007f]/;
|
|
8827
|
+
function bindVariableMediaSources(html, variables, budget, log) {
|
|
8629
8828
|
if (!html.includes("data-var-src")) return html;
|
|
8630
8829
|
const { document: document2 } = parseHTML(html);
|
|
8631
8830
|
const declared = {};
|
|
@@ -8636,14 +8835,23 @@ function bindVariableMediaSources(html, variables) {
|
|
|
8636
8835
|
let changed = false;
|
|
8637
8836
|
for (const el of document2.querySelectorAll("video[data-var-src], audio[data-var-src]")) {
|
|
8638
8837
|
if (el.closest("[data-variable-values]")) continue;
|
|
8639
|
-
const
|
|
8640
|
-
if (
|
|
8838
|
+
const bound = boundMediaSrc(el, values);
|
|
8839
|
+
if (bound === null) continue;
|
|
8840
|
+
const src = bound.trim();
|
|
8841
|
+
if (src.length > MAX_VARIABLE_MEDIA_SRC_BYTES || MEDIA_SRC_CONTROL_CHARS.test(src)) {
|
|
8842
|
+
log?.warn("[Compiler] Refused a variable media source that cannot be a URL", {
|
|
8843
|
+
length: src.length
|
|
8844
|
+
});
|
|
8845
|
+
continue;
|
|
8846
|
+
}
|
|
8847
|
+
if (el.getAttribute("src") === src) continue;
|
|
8848
|
+
budget.chargeGenerated("variable media sources", src.length);
|
|
8641
8849
|
el.setAttribute("src", src);
|
|
8642
8850
|
changed = true;
|
|
8643
8851
|
}
|
|
8644
8852
|
return changed ? document2.toString() : html;
|
|
8645
8853
|
}
|
|
8646
|
-
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ?
|
|
8854
|
+
var entryFileName = (projectDir, htmlPath) => isPathInside(htmlPath, projectDir) ? relative3(projectDir, htmlPath).split(sep3).join("/") : basename5(htmlPath);
|
|
8647
8855
|
async function compileForRender(projectDir, htmlPath, downloadDir, options = {}) {
|
|
8648
8856
|
const assetRoot = options.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
8649
8857
|
const outsideFiles = { includeScripts: options.includeOutsideScripts };
|
|
@@ -8656,11 +8864,19 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8656
8864
|
if (!COMPOSITION_FILE.test(htmlPath)) {
|
|
8657
8865
|
throw new Error(`Entry file ${htmlPath} is not an .html file, so it is refused`);
|
|
8658
8866
|
}
|
|
8659
|
-
assertCompositionFileSize(htmlPath,
|
|
8660
|
-
const
|
|
8867
|
+
assertCompositionFileSize(htmlPath, basename5(htmlPath));
|
|
8868
|
+
const budget = new CompositionExpansionBudget();
|
|
8869
|
+
const entryHtml = rebaseDirectEntryAssetPaths(
|
|
8870
|
+
readTextFile(htmlPath),
|
|
8871
|
+
projectDir,
|
|
8872
|
+
htmlPath,
|
|
8873
|
+
budget
|
|
8874
|
+
);
|
|
8661
8875
|
const rawHtml = bindVariableMediaSources(
|
|
8662
8876
|
normalizeCompositionSrcs(rewriteUnresolvableGsapToCdn(entryHtml, projectDir), projectDir),
|
|
8663
|
-
options.variables ?? {}
|
|
8877
|
+
options.variables ?? {},
|
|
8878
|
+
budget,
|
|
8879
|
+
options.log
|
|
8664
8880
|
);
|
|
8665
8881
|
assertSubCompositionsUsable(rawHtml, projectDir, assetRoot, outsideFiles);
|
|
8666
8882
|
const probes = /* @__PURE__ */ new Map();
|
|
@@ -8691,7 +8907,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8691
8907
|
projectDir,
|
|
8692
8908
|
options.variables ?? {},
|
|
8693
8909
|
assetRoot,
|
|
8694
|
-
outsideFiles
|
|
8910
|
+
outsideFiles,
|
|
8911
|
+
budget
|
|
8695
8912
|
);
|
|
8696
8913
|
const sanitizedHtml = stripPreloadNone(inlinedHtml);
|
|
8697
8914
|
const renderModeHints = detectRenderModeHints(sanitizedHtml, options.pageMotionBlur);
|
|
@@ -8699,7 +8916,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8699
8916
|
const usesThreeDTransforms = detectThreeDTransformUsage(sanitizedHtml);
|
|
8700
8917
|
const hasAncestorBackgroundImage = detectAncestorBackgroundImage(sanitizedHtml);
|
|
8701
8918
|
const fontSheetHtml = await inlineExternalFontStylesheets(
|
|
8702
|
-
promoteCssImportsToLinkTags(sanitizedHtml)
|
|
8919
|
+
promoteCssImportsToLinkTags(sanitizedHtml),
|
|
8920
|
+
budget
|
|
8703
8921
|
);
|
|
8704
8922
|
const normalizedFontHtml = normalizeSystemFontPrimaryFamilies(
|
|
8705
8923
|
injectTextRenderingRule(coalesceHeadStylesAndBodyScripts(fontSheetHtml))
|
|
@@ -8711,7 +8929,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8711
8929
|
projectFontFamilies: projectStylesheetFontFamilies(fontSheetHtml, projectDir),
|
|
8712
8930
|
abortSignal: options.abortSignal
|
|
8713
8931
|
});
|
|
8714
|
-
const assembledHtml = await inlineExternalScripts(coalescedHtml);
|
|
8932
|
+
const assembledHtml = await inlineExternalScripts(coalescedHtml, budget);
|
|
8715
8933
|
const HF_POSITION_ATTRS = [
|
|
8716
8934
|
'data-hf-studio-path-offset="true"',
|
|
8717
8935
|
'data-hf-studio-box-size="true"',
|
|
@@ -8770,6 +8988,7 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8770
8988
|
htmlWithPreparedGifs,
|
|
8771
8989
|
projectDir,
|
|
8772
8990
|
assetRoot,
|
|
8991
|
+
budget,
|
|
8773
8992
|
options.log
|
|
8774
8993
|
);
|
|
8775
8994
|
const { html, externalAssets } = options.allowOutsideProjectAssets ? collectExternalAssets(
|
|
@@ -8802,8 +9021,8 @@ async function compileForRender(projectDir, htmlPath, downloadDir, options = {})
|
|
|
8802
9021
|
const advised = /* @__PURE__ */ new Set();
|
|
8803
9022
|
for (const video of videos) {
|
|
8804
9023
|
if (isHttpUrl(video.src)) continue;
|
|
8805
|
-
const videoPath =
|
|
8806
|
-
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]))
|
|
8807
9026
|
continue;
|
|
8808
9027
|
advised.add(videoPath);
|
|
8809
9028
|
const reencode = `ffmpeg -i "${video.src}" -c:v libx264 -r 30 -g 30 -keyint_min 30 -movflags +faststart -c:a copy output.mp4`;
|
|
@@ -9218,7 +9437,7 @@ async function recompileWithResolutions(compiled, resolutions, projectDir, downl
|
|
|
9218
9437
|
function animatedGifCacheDir(extractCacheDir) {
|
|
9219
9438
|
try {
|
|
9220
9439
|
const root = extractCacheDir && privateCacheRoot(extractCacheDir);
|
|
9221
|
-
return root ?
|
|
9440
|
+
return root ? join18(root, "animated-gif") : void 0;
|
|
9222
9441
|
} catch {
|
|
9223
9442
|
return void 0;
|
|
9224
9443
|
}
|
|
@@ -9240,17 +9459,17 @@ function resolveEntryHtmlPath(input) {
|
|
|
9240
9459
|
const readEntry = (path) => {
|
|
9241
9460
|
if (escapesAssetRoot(path, input.assetRoot)) {
|
|
9242
9461
|
throw new Error(
|
|
9243
|
-
`Entry file "${
|
|
9462
|
+
`Entry file "${relative4(projectDir, path)}" leads outside the project folder`
|
|
9244
9463
|
);
|
|
9245
9464
|
}
|
|
9246
|
-
assertCompositionFileSize(path,
|
|
9465
|
+
assertCompositionFileSize(path, relative4(projectDir, path));
|
|
9247
9466
|
return readTextFile(path);
|
|
9248
9467
|
};
|
|
9249
|
-
const htmlPath =
|
|
9468
|
+
const htmlPath = join18(projectDir, entryFile);
|
|
9250
9469
|
const rawEntry = readEntry(htmlPath);
|
|
9251
9470
|
if (entryFile === "index.html" || !isTemplateEntry(rawEntry)) return htmlPath;
|
|
9252
|
-
const projectIndexPath =
|
|
9253
|
-
if (!
|
|
9471
|
+
const projectIndexPath = join18(projectDir, "index.html");
|
|
9472
|
+
if (!existsSync12(projectIndexPath)) {
|
|
9254
9473
|
throw new Error(
|
|
9255
9474
|
`Template entry file "${entryFile}" requires a project index.html to extract its render shell.`
|
|
9256
9475
|
);
|
|
@@ -9265,7 +9484,7 @@ function resolveEntryHtmlPath(input) {
|
|
|
9265
9484
|
`Entry file "${entryFile}" is not mounted from index.html via data-composition-src, so it cannot be rendered independently.`
|
|
9266
9485
|
);
|
|
9267
9486
|
}
|
|
9268
|
-
const wrapperPath =
|
|
9487
|
+
const wrapperPath = join18(workDir, "standalone-entry.html");
|
|
9269
9488
|
writeFileSync4(wrapperPath, standaloneHtml, "utf-8");
|
|
9270
9489
|
log.info("Extracted standalone entry from index.html host context", { entryFile });
|
|
9271
9490
|
return wrapperPath;
|
|
@@ -9295,7 +9514,7 @@ async function runCompileStage(input) {
|
|
|
9295
9514
|
const assetRoot = job.config.allowOutsideProjectAssets ? void 0 : projectDir;
|
|
9296
9515
|
const htmlPath = resolveEntryHtmlPath({ projectDir, workDir, entryFile, log, assetRoot });
|
|
9297
9516
|
const compileStart = Date.now();
|
|
9298
|
-
const compiled = await compileForRender(projectDir, htmlPath,
|
|
9517
|
+
const compiled = await compileForRender(projectDir, htmlPath, join18(workDir, "downloads"), {
|
|
9299
9518
|
log,
|
|
9300
9519
|
failClosedFontFetch: failClosedFontFetch === true,
|
|
9301
9520
|
allowSystemFontCapture,
|
|
@@ -9370,7 +9589,7 @@ async function runCompileStage(input) {
|
|
|
9370
9589
|
});
|
|
9371
9590
|
await preflightCompositionAssetMediaTypes({
|
|
9372
9591
|
projectDir,
|
|
9373
|
-
compiledDir:
|
|
9592
|
+
compiledDir: join18(workDir, "compiled"),
|
|
9374
9593
|
composition,
|
|
9375
9594
|
signal: abortSignal
|
|
9376
9595
|
});
|
|
@@ -9418,7 +9637,7 @@ async function runCompileStage(input) {
|
|
|
9418
9637
|
|
|
9419
9638
|
// ../producer/src/services/render/stages/probeStage.ts
|
|
9420
9639
|
import { createHash as createHash5 } from "crypto";
|
|
9421
|
-
import { basename as
|
|
9640
|
+
import { basename as basename6, join as join19 } from "path";
|
|
9422
9641
|
|
|
9423
9642
|
// ../producer/src/services/render/stages/probeFailures.ts
|
|
9424
9643
|
var NETWORK_FAILURE_PATTERN = /404|ERR_NAME_NOT_RESOLVED|ERR_CONNECTION_REFUSED|net::ERR_/i;
|
|
@@ -9641,7 +9860,7 @@ function probeRequiresBrowser(args) {
|
|
|
9641
9860
|
function reportedLengthSource(source) {
|
|
9642
9861
|
if (!source) return null;
|
|
9643
9862
|
if (source.from !== "media") return { from: source.from };
|
|
9644
|
-
const name =
|
|
9863
|
+
const name = basename6(source.src.split(/[?#]/, 1)[0] ?? "");
|
|
9645
9864
|
const srcHash = createHash5("sha256").update(name).digest("hex").slice(0, 12);
|
|
9646
9865
|
return { from: "media", tag: source.tag, trimmed: source.trimmed, srcHash };
|
|
9647
9866
|
}
|
|
@@ -9707,7 +9926,7 @@ async function runProbeStage(input) {
|
|
|
9707
9926
|
});
|
|
9708
9927
|
fileServer = await createFileServer({
|
|
9709
9928
|
projectDir,
|
|
9710
|
-
compiledDir:
|
|
9929
|
+
compiledDir: join19(workDir, "compiled"),
|
|
9711
9930
|
port: 0,
|
|
9712
9931
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
9713
9932
|
fps: job.config.fps,
|
|
@@ -9744,7 +9963,7 @@ async function runProbeStage(input) {
|
|
|
9744
9963
|
log.info("Creating capture session...", { attempt, maxAttempts: PROBE_MAX_ATTEMPTS });
|
|
9745
9964
|
probeSession = await createCaptureSession(
|
|
9746
9965
|
fileServer.url,
|
|
9747
|
-
|
|
9966
|
+
join19(workDir, "probe"),
|
|
9748
9967
|
captureOpts,
|
|
9749
9968
|
null,
|
|
9750
9969
|
probeCfg
|
|
@@ -9829,7 +10048,7 @@ async function runProbeStage(input) {
|
|
|
9829
10048
|
});
|
|
9830
10049
|
probeSession = await createCaptureSession(
|
|
9831
10050
|
fileServer.url,
|
|
9832
|
-
|
|
10051
|
+
join19(workDir, "probe-screenshot"),
|
|
9833
10052
|
captureOpts,
|
|
9834
10053
|
null,
|
|
9835
10054
|
{ ...probeCfg, forceScreenshot: true }
|
|
@@ -9867,7 +10086,7 @@ async function runProbeStage(input) {
|
|
|
9867
10086
|
compiled,
|
|
9868
10087
|
resolutions,
|
|
9869
10088
|
projectDir,
|
|
9870
|
-
|
|
10089
|
+
join19(workDir, "downloads"),
|
|
9871
10090
|
job.config.allowOutsideProjectAssets ? void 0 : projectDir,
|
|
9872
10091
|
{ includeScripts: job.config.includeOutsideScripts }
|
|
9873
10092
|
);
|
|
@@ -10067,7 +10286,7 @@ async function runProbeStage(input) {
|
|
|
10067
10286
|
});
|
|
10068
10287
|
await preflightCompositionAssetMediaTypes({
|
|
10069
10288
|
projectDir,
|
|
10070
|
-
compiledDir:
|
|
10289
|
+
compiledDir: join19(workDir, "compiled"),
|
|
10071
10290
|
composition,
|
|
10072
10291
|
signal: abortSignal
|
|
10073
10292
|
});
|
|
@@ -10225,8 +10444,8 @@ function validateDistributedDuration(input) {
|
|
|
10225
10444
|
}
|
|
10226
10445
|
|
|
10227
10446
|
// ../producer/src/services/render/stages/extractVideosStage.ts
|
|
10228
|
-
import { existsSync as
|
|
10229
|
-
import { join as
|
|
10447
|
+
import { existsSync as existsSync13 } from "fs";
|
|
10448
|
+
import { join as join20 } from "path";
|
|
10230
10449
|
|
|
10231
10450
|
// ../producer/src/services/render/extractionFailureMetadata.ts
|
|
10232
10451
|
function stringOrEmpty(value) {
|
|
@@ -10566,7 +10785,7 @@ async function runExtractVideosStage(input) {
|
|
|
10566
10785
|
// because short boundary counts can differ by one frame.
|
|
10567
10786
|
{
|
|
10568
10787
|
fps: job.config.fps,
|
|
10569
|
-
outputDir:
|
|
10788
|
+
outputDir: join20(compiledDir, "__hyperframes_video_frames"),
|
|
10570
10789
|
format: job.config.videoFrameFormat ?? "auto",
|
|
10571
10790
|
toneMapHdrToSdr: rendersSdrOnly(job.config, composition),
|
|
10572
10791
|
timelineEnd: composition.duration,
|
|
@@ -10574,7 +10793,7 @@ async function runExtractVideosStage(input) {
|
|
|
10574
10793
|
collectProbeFailures: extractionPolicy.failureMode === "enforce",
|
|
10575
10794
|
deferRangeExtraction,
|
|
10576
10795
|
shownBoxes,
|
|
10577
|
-
contentKeyedDirs: [
|
|
10796
|
+
contentKeyedDirs: [join20(compiledDir, REMOTE_MEDIA_SUBDIR)],
|
|
10578
10797
|
urlByAbsentLocalPath,
|
|
10579
10798
|
assetRoots,
|
|
10580
10799
|
onProgress: ({ planned = 0, done = 0 }) => {
|
|
@@ -10654,7 +10873,7 @@ function isPublicHttpsUrl(url) {
|
|
|
10654
10873
|
}
|
|
10655
10874
|
}
|
|
10656
10875
|
function opensLocally(path, assetRoots) {
|
|
10657
|
-
return
|
|
10876
|
+
return existsSync13(path) && (!assetRoots || assetRootsRefusal(path, assetRoots) === null);
|
|
10658
10877
|
}
|
|
10659
10878
|
function localProbeSource(src, input) {
|
|
10660
10879
|
const path = resolveProjectRelativeSrc(src, input.projectDir, input.compiledDir);
|
|
@@ -10666,7 +10885,7 @@ async function remoteProbeSource(video, input) {
|
|
|
10666
10885
|
if (!isPublicHttpsUrl(video.src)) return null;
|
|
10667
10886
|
if (!resolveRestrictPageNetwork()) return video.src;
|
|
10668
10887
|
if (!video.hasAudio || video.hidden) return null;
|
|
10669
|
-
const downloadDir = input.downloadDir ??
|
|
10888
|
+
const downloadDir = input.downloadDir ?? join20(input.compiledDir, REMOTE_MEDIA_SUBDIR);
|
|
10670
10889
|
try {
|
|
10671
10890
|
return await downloadToTemp(video.src, downloadDir, void 0, input.signal, void 0, {
|
|
10672
10891
|
onTelemetry: writeUrlDownloadTelemetry
|
|
@@ -10707,7 +10926,7 @@ async function appendVideoAudioFromProbe(input) {
|
|
|
10707
10926
|
}
|
|
10708
10927
|
|
|
10709
10928
|
// ../producer/src/services/render/videoLayerPassthroughPlan.ts
|
|
10710
|
-
import { existsSync as
|
|
10929
|
+
import { existsSync as existsSync14 } from "fs";
|
|
10711
10930
|
var SAMPLES = 9;
|
|
10712
10931
|
function inspectVideoLayout(id, w, h, time) {
|
|
10713
10932
|
window.__hf?.seek?.(time);
|
|
@@ -10769,7 +10988,7 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10769
10988
|
const { video } = q;
|
|
10770
10989
|
if (isHttpUrl(video.src)) return { reason: "remote_source" };
|
|
10771
10990
|
const path = resolveProjectRelativeSrc(video.src, input.projectDir, input.compiledDir);
|
|
10772
|
-
if (!
|
|
10991
|
+
if (!existsSync14(path)) return { reason: "source_missing" };
|
|
10773
10992
|
const layout = await probeVideoLayout(input.page, video.id, input.canvas, input.duration);
|
|
10774
10993
|
if ("reason" in layout) return layout;
|
|
10775
10994
|
const layer = await buildVideoLayerInput(
|
|
@@ -10784,16 +11003,16 @@ async function planVideoLayerPassthrough(input) {
|
|
|
10784
11003
|
}
|
|
10785
11004
|
|
|
10786
11005
|
// ../producer/src/services/render/stages/audioStage.ts
|
|
10787
|
-
import { existsSync as
|
|
10788
|
-
import { join as
|
|
11006
|
+
import { existsSync as existsSync16 } from "fs";
|
|
11007
|
+
import { join as join23 } from "path";
|
|
10789
11008
|
|
|
10790
11009
|
// ../producer/src/services/render/audioDeliveryLimit.ts
|
|
10791
|
-
import { existsSync as
|
|
10792
|
-
import { dirname as dirname9, join as
|
|
11010
|
+
import { existsSync as existsSync15 } from "fs";
|
|
11011
|
+
import { dirname as dirname9, join as join22 } from "path";
|
|
10793
11012
|
|
|
10794
11013
|
// ../producer/src/services/render/audioPadTrim.ts
|
|
10795
11014
|
import { spawn } from "child_process";
|
|
10796
|
-
import { dirname as dirname8, join as
|
|
11015
|
+
import { dirname as dirname8, join as join21 } from "path";
|
|
10797
11016
|
|
|
10798
11017
|
// ../producer/src/services/render/audioTruePeak.ts
|
|
10799
11018
|
var toDbfs = (token) => token.toLowerCase() === "-inf" ? Number.NEGATIVE_INFINITY : Number(token);
|
|
@@ -11053,7 +11272,7 @@ async function constrainAacTruePeak(input) {
|
|
|
11053
11272
|
}
|
|
11054
11273
|
async function cutSource(input, scratchDir, attenuationDb) {
|
|
11055
11274
|
if (!input.sourcePath || !input.rewriteSource) return true;
|
|
11056
|
-
const cutPath =
|
|
11275
|
+
const cutPath = join21(scratchDir, "source.wav");
|
|
11057
11276
|
try {
|
|
11058
11277
|
const result = await input.rewriteSource(input.sourcePath, cutPath, gainFilter(attenuationDb));
|
|
11059
11278
|
if (!result.success) throw new Error(result.error);
|
|
@@ -11068,7 +11287,7 @@ async function enforceAacTruePeak(input) {
|
|
|
11068
11287
|
let scratchDir;
|
|
11069
11288
|
try {
|
|
11070
11289
|
scratchDir = createStagingDir(dirname8(input.audioPath), ".true-peak-");
|
|
11071
|
-
const correctedPath =
|
|
11290
|
+
const correctedPath = join21(scratchDir, "audio.m4a");
|
|
11072
11291
|
const measurements = [];
|
|
11073
11292
|
let attenuationDb = 0;
|
|
11074
11293
|
let sourcePeakDbfs;
|
|
@@ -11281,14 +11500,14 @@ async function limitDeliveryPeaks(input, deps = {
|
|
|
11281
11500
|
applyChain: applyAudioFxChain,
|
|
11282
11501
|
encode: encodeAac,
|
|
11283
11502
|
rename: renameWithRetry,
|
|
11284
|
-
sourceExists:
|
|
11503
|
+
sourceExists: existsSync15
|
|
11285
11504
|
}) {
|
|
11286
11505
|
const { audioPath, sourcePath, signal, timeoutMs } = input;
|
|
11287
11506
|
if (!deps.sourceExists(sourcePath)) return { success: true };
|
|
11288
11507
|
const peak = await deps.measure(audioPath, { timeoutMs, signal });
|
|
11289
11508
|
if (peak <= AAC_DELIVERY_TRUE_PEAK_DBFS) return { success: true };
|
|
11290
11509
|
const alternating = ["a", "b"].map(
|
|
11291
|
-
(k) =>
|
|
11510
|
+
(k) => join22(dirname9(sourcePath), `audio-source-limited-${k}.wav`)
|
|
11292
11511
|
);
|
|
11293
11512
|
let encodedFrom;
|
|
11294
11513
|
let ceiling = AAC_DELIVERY_TRUE_PEAK_DBFS;
|
|
@@ -11361,7 +11580,7 @@ function runAudioStage(input) {
|
|
|
11361
11580
|
}
|
|
11362
11581
|
async function runAudioStageScoped(input) {
|
|
11363
11582
|
const stageStart = Date.now();
|
|
11364
|
-
const pcmSourcePath =
|
|
11583
|
+
const pcmSourcePath = join23(input.workDir, "audio-source.wav");
|
|
11365
11584
|
const duration = input.totalFrames * input.fps.den / input.fps.num;
|
|
11366
11585
|
let deliverySourcePath;
|
|
11367
11586
|
try {
|
|
@@ -11377,7 +11596,7 @@ async function runAudioStageScoped(input) {
|
|
|
11377
11596
|
);
|
|
11378
11597
|
audioLoweredDb = guard.loweredDb;
|
|
11379
11598
|
input.log?.info("[audio] phases", { ...result.audioPhaseMs, guard: Date.now() - guardStart });
|
|
11380
|
-
if (input.keepDeliverySource && !guard.sourceStale &&
|
|
11599
|
+
if (input.keepDeliverySource && !guard.sourceStale && existsSync16(pcmSourcePath)) {
|
|
11381
11600
|
deliverySourcePath = pcmSourcePath;
|
|
11382
11601
|
}
|
|
11383
11602
|
}
|
|
@@ -11426,7 +11645,7 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11426
11645
|
assertNotAborted,
|
|
11427
11646
|
log
|
|
11428
11647
|
} = input;
|
|
11429
|
-
const audioOutputPath =
|
|
11648
|
+
const audioOutputPath = join23(workDir, MIXED_AUDIO_FILENAME);
|
|
11430
11649
|
let hasAudio = false;
|
|
11431
11650
|
let audioError;
|
|
11432
11651
|
let audioFailures;
|
|
@@ -11506,8 +11725,8 @@ async function mixAudioForDelivery(input, duration, pcmSourcePath) {
|
|
|
11506
11725
|
}
|
|
11507
11726
|
|
|
11508
11727
|
// ../producer/src/services/render/stages/captureStage.ts
|
|
11509
|
-
import { existsSync as
|
|
11510
|
-
import { join as
|
|
11728
|
+
import { existsSync as existsSync17, readdirSync as readdirSync4, statfsSync as statfsSync2 } from "fs";
|
|
11729
|
+
import { join as join24 } from "path";
|
|
11511
11730
|
function shouldAllowAdaptiveCaptureRetry(workerCount, _explicitlyConfigured) {
|
|
11512
11731
|
return workerCount > 1;
|
|
11513
11732
|
}
|
|
@@ -11563,16 +11782,16 @@ function diskCaptureShortfallError(needBytes, freeBytes, framesDir, basis, remed
|
|
|
11563
11782
|
}
|
|
11564
11783
|
function measureCaptureFrameBytes(workDir, framesDir) {
|
|
11565
11784
|
let total = sampleDirectoryBytes(framesDir);
|
|
11566
|
-
if (!
|
|
11785
|
+
if (!existsSync17(workDir)) return total;
|
|
11567
11786
|
for (const attempt of readdirSync4(workDir)) {
|
|
11568
11787
|
if (/^retry-\d+-batch-\d+-worker-\d+$/.test(attempt)) {
|
|
11569
|
-
total += sampleDirectoryBytes(
|
|
11788
|
+
total += sampleDirectoryBytes(join24(workDir, attempt));
|
|
11570
11789
|
continue;
|
|
11571
11790
|
}
|
|
11572
11791
|
if (!/^capture-attempt-\d+$/.test(attempt)) continue;
|
|
11573
|
-
const attemptDir =
|
|
11792
|
+
const attemptDir = join24(workDir, attempt);
|
|
11574
11793
|
for (const name of readdirSync4(attemptDir)) {
|
|
11575
|
-
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(
|
|
11794
|
+
if (/^worker-\d+$/.test(name)) total += sampleDirectoryBytes(join24(attemptDir, name));
|
|
11576
11795
|
}
|
|
11577
11796
|
}
|
|
11578
11797
|
return total;
|
|
@@ -11870,8 +12089,8 @@ async function captureSessionFrames(session, { input, rangeStart, rangeEnd, resu
|
|
|
11870
12089
|
}
|
|
11871
12090
|
|
|
11872
12091
|
// ../producer/src/services/render/stages/captureHdrStage.ts
|
|
11873
|
-
import { existsSync as
|
|
11874
|
-
import { join as
|
|
12092
|
+
import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
|
|
12093
|
+
import { join as join28 } from "path";
|
|
11875
12094
|
|
|
11876
12095
|
// ../producer/src/services/hdrImageTransferCache.ts
|
|
11877
12096
|
var DEFAULT_MAX_BYTES = 200 * 1024 * 1024;
|
|
@@ -11933,7 +12152,7 @@ function createHdrImageTransferCache(options = {}) {
|
|
|
11933
12152
|
}
|
|
11934
12153
|
|
|
11935
12154
|
// ../producer/src/services/render/stages/captureHdrSequentialLoop.ts
|
|
11936
|
-
import { join as
|
|
12155
|
+
import { join as join25 } from "path";
|
|
11937
12156
|
async function runSequentialLayeredFrameLoop(input) {
|
|
11938
12157
|
const {
|
|
11939
12158
|
job,
|
|
@@ -12054,7 +12273,7 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
12054
12273
|
);
|
|
12055
12274
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
12056
12275
|
writeFileExclusiveSync(
|
|
12057
|
-
|
|
12276
|
+
join25(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
12058
12277
|
normalCanvas
|
|
12059
12278
|
);
|
|
12060
12279
|
}
|
|
@@ -12086,14 +12305,14 @@ async function runSequentialLayeredFrameLoop(input) {
|
|
|
12086
12305
|
}
|
|
12087
12306
|
|
|
12088
12307
|
// ../producer/src/services/render/stages/captureHdrHybridLoop.ts
|
|
12089
|
-
import { join as
|
|
12308
|
+
import { join as join27 } from "path";
|
|
12090
12309
|
|
|
12091
12310
|
// ../producer/src/services/shaderTransitionWorkerPool.ts
|
|
12092
12311
|
import { Worker } from "worker_threads";
|
|
12093
12312
|
import { fileURLToPath as fileURLToPath2, pathToFileURL } from "url";
|
|
12094
|
-
import { dirname as dirname10, join as
|
|
12313
|
+
import { dirname as dirname10, join as join26 } from "path";
|
|
12095
12314
|
import { createRequire } from "module";
|
|
12096
|
-
import { existsSync as
|
|
12315
|
+
import { existsSync as existsSync18 } from "fs";
|
|
12097
12316
|
function resolveWorkerEntry(explicit) {
|
|
12098
12317
|
if (explicit && explicit.length > 0) {
|
|
12099
12318
|
return { path: explicit, isTs: explicit.endsWith(".ts") };
|
|
@@ -12104,9 +12323,9 @@ function resolveWorkerEntry(explicit) {
|
|
|
12104
12323
|
return { path: override, isTs };
|
|
12105
12324
|
}
|
|
12106
12325
|
const moduleDir = dirname10(fileURLToPath2(import.meta.url));
|
|
12107
|
-
const jsPath =
|
|
12108
|
-
if (
|
|
12109
|
-
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");
|
|
12110
12329
|
return { path: tsPath, isTs: true };
|
|
12111
12330
|
}
|
|
12112
12331
|
function buildExecArgv(entryIsTs) {
|
|
@@ -12249,8 +12468,8 @@ async function createShaderTransitionWorkerPool(opts) {
|
|
|
12249
12468
|
if (terminated) {
|
|
12250
12469
|
throw new Error("shader-blend pool already terminated");
|
|
12251
12470
|
}
|
|
12252
|
-
return new Promise((
|
|
12253
|
-
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 };
|
|
12254
12473
|
const idle = slots.find((s) => !s.busy && !s.dead);
|
|
12255
12474
|
if (idle) {
|
|
12256
12475
|
queue.unshift(task);
|
|
@@ -12474,7 +12693,7 @@ async function runHybridLayeredFrameLoop(input) {
|
|
|
12474
12693
|
);
|
|
12475
12694
|
if (debugDumpEnabled && debugDumpDir && i % 30 === 0) {
|
|
12476
12695
|
writeFileExclusiveSync(
|
|
12477
|
-
|
|
12696
|
+
join27(debugDumpDir, `frame_${String(i).padStart(4, "0")}_final_rgb48le.bin`),
|
|
12478
12697
|
canvas
|
|
12479
12698
|
);
|
|
12480
12699
|
}
|
|
@@ -12670,8 +12889,8 @@ async function runCaptureHdrStage(input) {
|
|
|
12670
12889
|
if (hdrVideoFrameSources.has(v.id)) hdrVideoEndTimes.set(v.id, v.end);
|
|
12671
12890
|
}
|
|
12672
12891
|
const debugDumpEnabled = process.env.KEEP_TEMP === "1";
|
|
12673
|
-
const debugDumpDir = debugDumpEnabled ?
|
|
12674
|
-
if (debugDumpDir && !
|
|
12892
|
+
const debugDumpDir = debugDumpEnabled ? join28(framesDir, "debug-composite") : null;
|
|
12893
|
+
if (debugDumpDir && !existsSync19(debugDumpDir)) {
|
|
12675
12894
|
mkdirSync8(debugDumpDir, { recursive: true });
|
|
12676
12895
|
}
|
|
12677
12896
|
const compositeTransfer = resolveCompositeTransfer(hasHdrContent, effectiveHdr);
|
|
@@ -12830,7 +13049,7 @@ async function runCaptureHdrStage(input) {
|
|
|
12830
13049
|
// ../producer/src/services/render/stages/encodeStage.ts
|
|
12831
13050
|
import {
|
|
12832
13051
|
copyFileSync as copyFileSync2,
|
|
12833
|
-
existsSync as
|
|
13052
|
+
existsSync as existsSync20,
|
|
12834
13053
|
mkdirSync as mkdirSync9,
|
|
12835
13054
|
readdirSync as readdirSync5,
|
|
12836
13055
|
readFileSync as readFileSync7,
|
|
@@ -12839,7 +13058,7 @@ import {
|
|
|
12839
13058
|
writeFileSync as writeFileSync5
|
|
12840
13059
|
} from "fs";
|
|
12841
13060
|
import { readFile as readFile2 } from "fs/promises";
|
|
12842
|
-
import { dirname as dirname11, join as
|
|
13061
|
+
import { dirname as dirname11, join as join29 } from "path";
|
|
12843
13062
|
|
|
12844
13063
|
// ../producer/src/services/render/stages/gifEncodeArgs.ts
|
|
12845
13064
|
function fpsToFfmpegArg2(fps) {
|
|
@@ -12949,7 +13168,7 @@ async function encodeGifFromDir(framesDir, framePattern, outputPath, input) {
|
|
|
12949
13168
|
const failure = await reencodeWithClearedWholeFrames(argsInput, run, startTime);
|
|
12950
13169
|
if (failure) return failure;
|
|
12951
13170
|
}
|
|
12952
|
-
const fileSize =
|
|
13171
|
+
const fileSize = existsSync20(outputPath) ? statSync7(outputPath).size : 0;
|
|
12953
13172
|
return {
|
|
12954
13173
|
success: true,
|
|
12955
13174
|
outputPath,
|
|
@@ -13040,10 +13259,10 @@ function encodeWhileCapturing(input, totalFrames, captureBudget) {
|
|
|
13040
13259
|
const stream = await encoder;
|
|
13041
13260
|
for (let next = 0; next < totalFrames; next++) {
|
|
13042
13261
|
while (!landed.has(next) && !captureDone && !signal.aborted) {
|
|
13043
|
-
await new Promise((
|
|
13262
|
+
await new Promise((resolve12) => wake = resolve12);
|
|
13044
13263
|
}
|
|
13045
13264
|
if (signal.aborted) return;
|
|
13046
|
-
const mergedPath =
|
|
13265
|
+
const mergedPath = join29(input.framesDir, formatCaptureFrameName(next, "jpg"));
|
|
13047
13266
|
const frame = await readLandedFrame(landed.get(next), mergedPath);
|
|
13048
13267
|
landed.delete(next);
|
|
13049
13268
|
if (!await stream.writeFrame(frame)) {
|
|
@@ -13118,7 +13337,7 @@ async function runEncodeStage(input) {
|
|
|
13118
13337
|
const stage5Start = Date.now();
|
|
13119
13338
|
if (isPngSequence) {
|
|
13120
13339
|
const encoded = startEncodeProgress(job, "Writing PNG sequence", onProgress);
|
|
13121
|
-
if (!
|
|
13340
|
+
if (!existsSync20(outputPath)) mkdirSync9(outputPath, { recursive: true });
|
|
13122
13341
|
const captured = readdirSync5(framesDir).filter((name) => name.endsWith(".png")).sort();
|
|
13123
13342
|
if (captured.length === 0) {
|
|
13124
13343
|
throw new Error(
|
|
@@ -13126,11 +13345,11 @@ async function runEncodeStage(input) {
|
|
|
13126
13345
|
);
|
|
13127
13346
|
}
|
|
13128
13347
|
captured.forEach((name, i) => {
|
|
13129
|
-
const dst =
|
|
13130
|
-
copyFileSync2(
|
|
13348
|
+
const dst = join29(outputPath, formatExportFrameName(i, "png"));
|
|
13349
|
+
copyFileSync2(join29(framesDir, name), dst);
|
|
13131
13350
|
});
|
|
13132
|
-
if (hasAudio && audioOutputPath &&
|
|
13133
|
-
copyFileSync2(audioOutputPath,
|
|
13351
|
+
if (hasAudio && audioOutputPath && existsSync20(audioOutputPath)) {
|
|
13352
|
+
copyFileSync2(audioOutputPath, join29(outputPath, MIXED_AUDIO_FILENAME));
|
|
13134
13353
|
log.info(
|
|
13135
13354
|
`[Render] png-sequence: ${MIXED_AUDIO_FILENAME} sidecar written to ${outputPath}/${MIXED_AUDIO_FILENAME}`
|
|
13136
13355
|
);
|
|
@@ -13150,7 +13369,7 @@ async function runEncodeStage(input) {
|
|
|
13150
13369
|
const encodeResult2 = await encodeGifFromDir(framesDir, framePattern2, outputPath, {
|
|
13151
13370
|
fps: job.config.fps,
|
|
13152
13371
|
loop,
|
|
13153
|
-
palettePath:
|
|
13372
|
+
palettePath: join29(dirname11(videoOnlyPath), "gif-palette.png"),
|
|
13154
13373
|
preserveAlpha: needsAlpha,
|
|
13155
13374
|
signal: abortSignal,
|
|
13156
13375
|
timeout: engineCfg.ffmpegEncodeTimeout
|
|
@@ -13360,7 +13579,7 @@ function sampleDirectoryBytes(dir) {
|
|
|
13360
13579
|
continue;
|
|
13361
13580
|
}
|
|
13362
13581
|
for (const name of entries) {
|
|
13363
|
-
const full =
|
|
13582
|
+
const full = join30(current, name);
|
|
13364
13583
|
try {
|
|
13365
13584
|
const st = statSync8(full);
|
|
13366
13585
|
if (st.isDirectory()) {
|
|
@@ -13396,6 +13615,7 @@ function summarizeExtractionObservability(extractionResult, videoCount, coverage
|
|
|
13396
13615
|
vfrPreflightCount: phaseBreakdown?.vfrPreflightCount,
|
|
13397
13616
|
cacheHits: phaseBreakdown?.cacheHits,
|
|
13398
13617
|
cacheMisses: phaseBreakdown?.cacheMisses,
|
|
13618
|
+
cachePublishFailures: phaseBreakdown?.cachePublishFailures,
|
|
13399
13619
|
transientRetries: phaseBreakdown?.transientRetries,
|
|
13400
13620
|
...coverageGauges,
|
|
13401
13621
|
authoredTimedClipCount
|
|
@@ -13517,8 +13737,8 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
13517
13737
|
const ranges = [];
|
|
13518
13738
|
let rangeStart = null;
|
|
13519
13739
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
13520
|
-
const framePath =
|
|
13521
|
-
const missing = !
|
|
13740
|
+
const framePath = join30(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
13741
|
+
const missing = !existsSync21(framePath) || statSync8(framePath).size <= 8;
|
|
13522
13742
|
if (missing && rangeStart === null) {
|
|
13523
13743
|
rangeStart = frameIndex;
|
|
13524
13744
|
} else if (!missing && rangeStart !== null) {
|
|
@@ -13534,7 +13754,7 @@ function findMissingFrameRanges(totalFrames, framesDir, frameExt) {
|
|
|
13534
13754
|
function buildMissingFrameRetryBatches(ranges, maxWorkers, workDir, attempt, rangeStart = 0, stride = 1) {
|
|
13535
13755
|
const workersPerBatch = Math.max(1, Math.floor(maxWorkers));
|
|
13536
13756
|
const batches = [];
|
|
13537
|
-
const outputDirFor = (batchIndex, workerId) =>
|
|
13757
|
+
const outputDirFor = (batchIndex, workerId) => join30(workDir, `retry-${attempt}-batch-${batchIndex}-worker-${workerId}`);
|
|
13538
13758
|
if (stride > 1) {
|
|
13539
13759
|
const spans = /* @__PURE__ */ new Map();
|
|
13540
13760
|
for (const range of ranges) {
|
|
@@ -13593,9 +13813,9 @@ function createCaptureObservabilityUpdater(observability, platform2 = process.pl
|
|
|
13593
13813
|
function getNextRetryWorkerCount(currentWorkers) {
|
|
13594
13814
|
return Math.max(1, Math.floor(currentWorkers / 2));
|
|
13595
13815
|
}
|
|
13596
|
-
function resolveRenderWorkDirPrefix(outputPath, jobId, platform2 = process.platform, systemTempDir =
|
|
13597
|
-
if (platform2 === "win32" || platform2 === "darwin") return
|
|
13598
|
-
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}-`);
|
|
13599
13819
|
}
|
|
13600
13820
|
var MAX_TRANSIENT_CAPTURE_RETRIES = 1;
|
|
13601
13821
|
function isTransientCaptureRetryEligible(failureKind, missing, retriesUsed) {
|
|
@@ -13650,8 +13870,8 @@ The composition is too large for the available memory. To reduce memory pressure
|
|
|
13650
13870
|
function countCapturedFrames(totalFrames, framesDir, frameExt) {
|
|
13651
13871
|
let captured = 0;
|
|
13652
13872
|
for (let frameIndex = 0; frameIndex < totalFrames; frameIndex++) {
|
|
13653
|
-
const framePath =
|
|
13654
|
-
if (
|
|
13873
|
+
const framePath = join30(framesDir, formatCaptureFrameName(frameIndex, frameExt));
|
|
13874
|
+
if (existsSync21(framePath)) captured++;
|
|
13655
13875
|
}
|
|
13656
13876
|
return captured;
|
|
13657
13877
|
}
|
|
@@ -13676,7 +13896,7 @@ async function executeDiskCaptureWithAdaptiveRetry(options) {
|
|
|
13676
13896
|
reason: attempt === 0 ? "initial" : pendingTransientRetry ? "transient-retry" : "retry"
|
|
13677
13897
|
});
|
|
13678
13898
|
pendingTransientRetry = false;
|
|
13679
|
-
const attemptWorkDir =
|
|
13899
|
+
const attemptWorkDir = join30(options.workDir, `capture-attempt-${attempt}`);
|
|
13680
13900
|
const batches = missingRanges ? buildMissingFrameRetryBatches(
|
|
13681
13901
|
missingRanges,
|
|
13682
13902
|
currentWorkers,
|
|
@@ -14323,8 +14543,8 @@ function deVerifyFallbackTelemetry(err) {
|
|
|
14323
14543
|
};
|
|
14324
14544
|
}
|
|
14325
14545
|
function resolveRenderDebugDir() {
|
|
14326
|
-
const producerRoot = process.env.PRODUCER_RENDERS_DIR ?
|
|
14327
|
-
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");
|
|
14328
14548
|
}
|
|
14329
14549
|
async function executeRenderJob(job, projectDir, outputPath, progressSink, abortSignal, assertRenderActive) {
|
|
14330
14550
|
validateHlsRenderConfig(job.config);
|
|
@@ -14332,11 +14552,11 @@ async function executeRenderJob(job, projectDir, outputPath, progressSink, abort
|
|
|
14332
14552
|
validateChromaSubsamplingConfig(job.config);
|
|
14333
14553
|
const debugDir = resolveRenderDebugDir();
|
|
14334
14554
|
const outputDir = dirname12(outputPath);
|
|
14335
|
-
if (!
|
|
14336
|
-
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);
|
|
14337
14557
|
const pipelineStart = Date.now();
|
|
14338
14558
|
const baseLog = job.config.logger ?? defaultLogger;
|
|
14339
|
-
const logPath = job.config.debug ?
|
|
14559
|
+
const logPath = job.config.debug ? join30(workDir, "render.log") : null;
|
|
14340
14560
|
const execution = new RenderExecutionContext({
|
|
14341
14561
|
request: { renderJobId: job.id, projectDir, outputPath },
|
|
14342
14562
|
logger: logPath ? createRenderFileLogger(logPath, baseLog) : baseLog,
|
|
@@ -14404,7 +14624,7 @@ async function executeRenderPipeline(input) {
|
|
|
14404
14624
|
imageDecodeFailures: 0
|
|
14405
14625
|
};
|
|
14406
14626
|
let hdrPerf;
|
|
14407
|
-
const perfOutputPath =
|
|
14627
|
+
const perfOutputPath = join30(workDir, "perf-summary.json");
|
|
14408
14628
|
const cfg = { ...job.config.producerConfig ?? resolveConfig() };
|
|
14409
14629
|
const observability = new RenderObservabilityRecorder({
|
|
14410
14630
|
pipelineStartMs: pipelineStart,
|
|
@@ -14480,7 +14700,7 @@ async function executeRenderPipeline(input) {
|
|
|
14480
14700
|
job.startedAt = /* @__PURE__ */ new Date();
|
|
14481
14701
|
assertNotAborted();
|
|
14482
14702
|
assertConfiguredFfmpegBinariesExist();
|
|
14483
|
-
if (!
|
|
14703
|
+
if (!existsSync21(workDir)) mkdirSync10(workDir, { recursive: true });
|
|
14484
14704
|
if (job.config.debug) {
|
|
14485
14705
|
log.info("[Render] Debug artifacts enabled", { workDir, logPath });
|
|
14486
14706
|
}
|
|
@@ -14509,8 +14729,8 @@ async function executeRenderPipeline(input) {
|
|
|
14509
14729
|
requestedWorkers: job.config.workers ?? "auto"
|
|
14510
14730
|
});
|
|
14511
14731
|
const entryFile = job.config.entryFile || "index.html";
|
|
14512
|
-
const htmlPath =
|
|
14513
|
-
if (!
|
|
14732
|
+
const htmlPath = join30(projectDir, entryFile);
|
|
14733
|
+
if (!existsSync21(htmlPath)) {
|
|
14514
14734
|
throw new Error(`Entry file not found: ${htmlPath}`);
|
|
14515
14735
|
}
|
|
14516
14736
|
assertNotAborted();
|
|
@@ -14606,7 +14826,7 @@ async function executeRenderPipeline(input) {
|
|
|
14606
14826
|
const largerThanCanvas = await oversizedVideos(
|
|
14607
14827
|
composition.videos,
|
|
14608
14828
|
projectDir,
|
|
14609
|
-
|
|
14829
|
+
join30(workDir, "compiled"),
|
|
14610
14830
|
{ width: outputWidth, height: outputHeight }
|
|
14611
14831
|
);
|
|
14612
14832
|
const probeResult = await observeRenderStage(
|
|
@@ -14703,7 +14923,7 @@ async function executeRenderPipeline(input) {
|
|
|
14703
14923
|
canvas: { width, height },
|
|
14704
14924
|
page: probeSession.page,
|
|
14705
14925
|
projectDir,
|
|
14706
|
-
compiledDir:
|
|
14926
|
+
compiledDir: join30(workDir, "compiled")
|
|
14707
14927
|
});
|
|
14708
14928
|
if (videoLayerPlan.videoId === void 0) {
|
|
14709
14929
|
log.info(`[Render] Video layer passthrough off: ${videoLayerPlan.reason}`);
|
|
@@ -14721,7 +14941,7 @@ async function executeRenderPipeline(input) {
|
|
|
14721
14941
|
updateJobStatus(job, "preprocessing", "Extracting video frames", 10, onProgress, {
|
|
14722
14942
|
code: "extract_video"
|
|
14723
14943
|
});
|
|
14724
|
-
const compiledDir =
|
|
14944
|
+
const compiledDir = join30(workDir, "compiled");
|
|
14725
14945
|
const segmentsCapture = (layeredOrEffectRoute) => shouldSegmentCapture({
|
|
14726
14946
|
env: process.env,
|
|
14727
14947
|
durationSeconds: probeResult.duration,
|
|
@@ -14857,7 +15077,7 @@ async function executeRenderPipeline(input) {
|
|
|
14857
15077
|
try {
|
|
14858
15078
|
fileServer = await createFileServer({
|
|
14859
15079
|
projectDir,
|
|
14860
|
-
compiledDir:
|
|
15080
|
+
compiledDir: join30(workDir, "compiled"),
|
|
14861
15081
|
port: 0,
|
|
14862
15082
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
14863
15083
|
fps: job.config.fps,
|
|
@@ -14877,8 +15097,8 @@ async function executeRenderPipeline(input) {
|
|
|
14877
15097
|
if (!activeFileServer) {
|
|
14878
15098
|
throw new Error("File server failed to initialize before frame capture");
|
|
14879
15099
|
}
|
|
14880
|
-
const framesDir =
|
|
14881
|
-
if (!
|
|
15100
|
+
const framesDir = join30(workDir, "captured-frames");
|
|
15101
|
+
if (!existsSync21(framesDir)) mkdirSync10(framesDir, { recursive: true });
|
|
14882
15102
|
updateJobStatus(job, "rendering", "Checking browser GPU", 25, onProgress, {
|
|
14883
15103
|
code: "start_browsers"
|
|
14884
15104
|
});
|
|
@@ -15458,7 +15678,7 @@ async function executeRenderPipeline(input) {
|
|
|
15458
15678
|
hls: ".mp4"
|
|
15459
15679
|
};
|
|
15460
15680
|
const videoExt = FORMAT_EXT[outputFormat] ?? ".mp4";
|
|
15461
|
-
const videoOnlyPath =
|
|
15681
|
+
const videoOnlyPath = join30(workDir, `video-only${videoExt}`);
|
|
15462
15682
|
let usePageSideCompositingForTransitions = (cfg.enablePageSideCompositing || isGif) && compiled.hasShaderTransitions && !hasHdrContent && outputSupportsPageSideShaderCompositing(outputFormat);
|
|
15463
15683
|
if (usePageSideCompositingForTransitions) {
|
|
15464
15684
|
activeFileServer.addPreHeadScript(HF_PAGE_SIDE_COMPOSITING_STUB);
|
|
@@ -15775,7 +15995,7 @@ async function executeRenderPipeline(input) {
|
|
|
15775
15995
|
pageMotionBlur: job.config.pageMotionBlur,
|
|
15776
15996
|
captureQuality: captureOptions.quality
|
|
15777
15997
|
});
|
|
15778
|
-
const segmentDir = segmentDirFor(
|
|
15998
|
+
const segmentDir = segmentDirFor(join30(projectDir, "renders"), segmentPlanHash);
|
|
15779
15999
|
let completedSegments = /* @__PURE__ */ new Set();
|
|
15780
16000
|
if (job.config.resumeSegments === true) {
|
|
15781
16001
|
const existing = readSegmentManifest(segmentDir);
|
|
@@ -16319,7 +16539,7 @@ async function executeRenderPipeline(input) {
|
|
|
16319
16539
|
})
|
|
16320
16540
|
);
|
|
16321
16541
|
const totalElapsed = Date.now() - pipelineStart;
|
|
16322
|
-
const tmpPeakBytes =
|
|
16542
|
+
const tmpPeakBytes = existsSync21(workDir) ? sampleDirectoryBytes(workDir) : 0;
|
|
16323
16543
|
recordTransientRetryObservability();
|
|
16324
16544
|
observability.checkpoint("pipeline", "artifact validated", { totalElapsedMs: totalElapsed });
|
|
16325
16545
|
const observabilitySummary = observability.summary({
|
|
@@ -16400,8 +16620,8 @@ async function executeRenderPipeline(input) {
|
|
|
16400
16620
|
}
|
|
16401
16621
|
}
|
|
16402
16622
|
if (job.config.debug) {
|
|
16403
|
-
if (!isPngSequence && !isHls &&
|
|
16404
|
-
const debugOutput =
|
|
16623
|
+
if (!isPngSequence && !isHls && existsSync21(stagedOutputPath)) {
|
|
16624
|
+
const debugOutput = join30(workDir, `output${videoExt}`);
|
|
16405
16625
|
copyFileSync3(stagedOutputPath, debugOutput);
|
|
16406
16626
|
}
|
|
16407
16627
|
}
|
|
@@ -16480,7 +16700,8 @@ async function executeRenderPipeline(input) {
|
|
|
16480
16700
|
perfStages,
|
|
16481
16701
|
hdrDiagnostics,
|
|
16482
16702
|
observability: observabilitySummary,
|
|
16483
|
-
subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs)
|
|
16703
|
+
subTimelineWait: worstSubTimelineWaitOutcome(dedupPerfs),
|
|
16704
|
+
missingPath: describeMissingPath(error, { cacheDir: cfg.extractCacheDir, workDir })
|
|
16484
16705
|
});
|
|
16485
16706
|
publishRenderFailure(
|
|
16486
16707
|
job,
|
|
@@ -16515,13 +16736,13 @@ async function executeRenderPipeline(input) {
|
|
|
16515
16736
|
|
|
16516
16737
|
// ../producer/src/services/distributed/renderSpan.ts
|
|
16517
16738
|
import { mkdirSync as mkdirSync18, mkdtempSync, readFileSync as readFileSync13, rmSync as rmSync16 } from "fs";
|
|
16518
|
-
import { join as
|
|
16519
|
-
import { tmpdir as
|
|
16739
|
+
import { join as join44 } from "path";
|
|
16740
|
+
import { tmpdir as tmpdir5 } from "os";
|
|
16520
16741
|
|
|
16521
16742
|
// ../producer/src/services/distributed/mp4Stitch.ts
|
|
16522
16743
|
import { createReadStream as createReadStream3, createWriteStream, mkdirSync as mkdirSync11, rmSync as rmSync11 } from "fs";
|
|
16523
16744
|
import { open } from "fs/promises";
|
|
16524
|
-
import { basename as
|
|
16745
|
+
import { basename as basename7, dirname as dirname13, join as join31 } from "path";
|
|
16525
16746
|
import { finished, pipeline } from "stream/promises";
|
|
16526
16747
|
function boxAt(src, off, at, limit) {
|
|
16527
16748
|
let size = src.readUInt32BE(off);
|
|
@@ -16886,14 +17107,14 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
16886
17107
|
const layouts = await Promise.all(sourcePaths.map((path) => readMp4Layout(fileRange(path))));
|
|
16887
17108
|
const header = audioPath ? buildStitchedHeader(layouts.slice(1), layouts[0]) : buildStitchedHeader(layouts);
|
|
16888
17109
|
mkdirSync11(dirname13(outputPath), { recursive: true });
|
|
16889
|
-
const workDir = createStagingDir(dirname13(outputPath), `${
|
|
16890
|
-
const out = createWriteStream(
|
|
17110
|
+
const workDir = createStagingDir(dirname13(outputPath), `${basename7(outputPath)}.stitch-`);
|
|
17111
|
+
const out = createWriteStream(join31(workDir, "out.mp4"));
|
|
16891
17112
|
try {
|
|
16892
17113
|
out.write(header);
|
|
16893
17114
|
for (const [i, path] of sourcePaths.entries()) await copyPayload(path, layouts[i], i, out);
|
|
16894
17115
|
out.end();
|
|
16895
17116
|
await finished(out);
|
|
16896
|
-
renameWithRetry(
|
|
17117
|
+
renameWithRetry(join31(workDir, "out.mp4"), outputPath);
|
|
16897
17118
|
} finally {
|
|
16898
17119
|
out.destroy();
|
|
16899
17120
|
rmSync11(workDir, { recursive: true, force: true });
|
|
@@ -16904,25 +17125,25 @@ async function writeStitchedMp4(chunkPaths, outputPath, audioPath) {
|
|
|
16904
17125
|
import {
|
|
16905
17126
|
copyFileSync as copyFileSync4,
|
|
16906
17127
|
cpSync as cpSync2,
|
|
16907
|
-
existsSync as
|
|
17128
|
+
existsSync as existsSync26,
|
|
16908
17129
|
linkSync,
|
|
16909
17130
|
mkdirSync as mkdirSync14,
|
|
16910
17131
|
rmSync as rmSync12,
|
|
16911
17132
|
writeFileSync as writeFileSync9
|
|
16912
17133
|
} from "fs";
|
|
16913
|
-
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";
|
|
16914
17135
|
|
|
16915
17136
|
// ../producer/src/services/distributed/planFrameCost.ts
|
|
16916
|
-
import { join as
|
|
17137
|
+
import { join as join34 } from "path";
|
|
16917
17138
|
|
|
16918
17139
|
// ../producer/src/services/distributed/chunkFrames.ts
|
|
16919
|
-
import { existsSync as
|
|
16920
|
-
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";
|
|
16921
17142
|
|
|
16922
17143
|
// ../producer/src/services/distributed/shared.ts
|
|
16923
17144
|
import { execFile as execFileCallback } from "child_process";
|
|
16924
|
-
import { dirname as dirname14, join as
|
|
16925
|
-
import { existsSync as
|
|
17145
|
+
import { dirname as dirname14, join as join32 } from "path";
|
|
17146
|
+
import { existsSync as existsSync22, readFileSync as readFileSync8 } from "fs";
|
|
16926
17147
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
16927
17148
|
import { promisify as promisify2 } from "util";
|
|
16928
17149
|
var PLAN_VIDEOS_META_RELATIVE_PATH = "meta/videos.json";
|
|
@@ -16933,8 +17154,8 @@ function isPlanAudioArtifactPath(path) {
|
|
|
16933
17154
|
}
|
|
16934
17155
|
function resolvePlanAudioPath(planDir) {
|
|
16935
17156
|
for (const name of [PLAN_AUDIO_RELATIVE_PATH, PLAN_AUDIO_LEGACY_RELATIVE_PATH]) {
|
|
16936
|
-
const candidate =
|
|
16937
|
-
if (
|
|
17157
|
+
const candidate = join32(planDir, name);
|
|
17158
|
+
if (existsSync22(candidate)) return candidate;
|
|
16938
17159
|
}
|
|
16939
17160
|
return null;
|
|
16940
17161
|
}
|
|
@@ -17198,8 +17419,8 @@ function readProducerVersion() {
|
|
|
17198
17419
|
const startDir = dirname14(fileURLToPath4(import.meta.url));
|
|
17199
17420
|
let current = startDir;
|
|
17200
17421
|
for (let i = 0; i < 10; i++) {
|
|
17201
|
-
const candidate =
|
|
17202
|
-
if (
|
|
17422
|
+
const candidate = join32(current, "package.json");
|
|
17423
|
+
if (existsSync22(candidate)) {
|
|
17203
17424
|
try {
|
|
17204
17425
|
const pkg = JSON.parse(readFileSync8(candidate, "utf-8"));
|
|
17205
17426
|
if (pkg.name === "@hyperframes/producer" && typeof pkg.version === "string") {
|
|
@@ -17253,8 +17474,8 @@ function frameNumberFromFileName(name) {
|
|
|
17253
17474
|
function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v1") {
|
|
17254
17475
|
const result = [];
|
|
17255
17476
|
for (const v of videos) {
|
|
17256
|
-
const outputDir =
|
|
17257
|
-
if (!
|
|
17477
|
+
const outputDir = join33(planDir, "video-frames", mediaIdPathSegment(v.videoId));
|
|
17478
|
+
if (!existsSync23(outputDir)) {
|
|
17258
17479
|
throw new Error(
|
|
17259
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.`
|
|
17260
17481
|
);
|
|
@@ -17272,7 +17493,7 @@ function rebuildExtractedFramesFromPlanDir(planDir, videos, indexMode = "dense-v
|
|
|
17272
17493
|
if (!frameName) continue;
|
|
17273
17494
|
const frameNumber = indexMode === "sparse-v2" ? frameNumberFromFileName(frameName) : null;
|
|
17274
17495
|
const frameIndex = frameNumber === null ? i : frameNumber - 1;
|
|
17275
|
-
framePaths.set(frameIndex,
|
|
17496
|
+
framePaths.set(frameIndex, join33(outputDir, frameName));
|
|
17276
17497
|
}
|
|
17277
17498
|
result.push({
|
|
17278
17499
|
videoId: v.videoId,
|
|
@@ -17352,8 +17573,8 @@ async function extractDeferredVideoFramesForChunk(input) {
|
|
|
17352
17573
|
sourceOf: (video) => {
|
|
17353
17574
|
const range = planned.get(video.videoId).deferredRange;
|
|
17354
17575
|
const remoteUrl = remoteSources[range.sourcePath];
|
|
17355
|
-
const sourcePath = remoteUrl ??
|
|
17356
|
-
if (remoteUrl === void 0 && !
|
|
17576
|
+
const sourcePath = remoteUrl ?? join33(input.planDir, ...range.sourcePath.split("/"));
|
|
17577
|
+
if (remoteUrl === void 0 && !existsSync23(sourcePath)) {
|
|
17357
17578
|
throw new RenderChunkValidationError(
|
|
17358
17579
|
MISSING_PLAN_ARTIFACT,
|
|
17359
17580
|
`[renderChunk] planDir is missing the source for video ${JSON.stringify(video.videoId)}: ${range.sourcePath}`
|
|
@@ -17383,12 +17604,12 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
17383
17604
|
planVideos,
|
|
17384
17605
|
frames: sampled,
|
|
17385
17606
|
fps: fpsRatio,
|
|
17386
|
-
outputRoot:
|
|
17607
|
+
outputRoot: join34(workDir, "frame-cost-video-frames"),
|
|
17387
17608
|
cfg: input.cfg
|
|
17388
17609
|
})
|
|
17389
17610
|
];
|
|
17390
17611
|
const lookup = extracted.length > 0 ? createFrameLookupTable(planVideos.videos, extracted, resolveRenderFpsConfig(fpsRatio).value) : null;
|
|
17391
|
-
const compiledDir =
|
|
17612
|
+
const compiledDir = join34(planDir, "compiled");
|
|
17392
17613
|
const fileServer = await createFileServer({
|
|
17393
17614
|
projectDir: compiledDir,
|
|
17394
17615
|
compiledDir,
|
|
@@ -17400,7 +17621,7 @@ async function measurePlanSecondsPerFrame(input) {
|
|
|
17400
17621
|
try {
|
|
17401
17622
|
session = await createCaptureSession(
|
|
17402
17623
|
fileServer.url,
|
|
17403
|
-
|
|
17624
|
+
join34(workDir, "frame-cost"),
|
|
17404
17625
|
buildChunkCaptureOptions({
|
|
17405
17626
|
dimensions: { ...input, fpsNum: fps, fpsDen: 1 },
|
|
17406
17627
|
encoder: input,
|
|
@@ -17496,21 +17717,21 @@ function buildWeightedChunkSlices(weights, chunkCount, minFrames, maxFrames) {
|
|
|
17496
17717
|
}
|
|
17497
17718
|
|
|
17498
17719
|
// ../producer/src/services/render/planReferenceBackground.ts
|
|
17499
|
-
import { join as
|
|
17720
|
+
import { join as join35 } from "path";
|
|
17500
17721
|
async function readPlanReferenceBackground(input) {
|
|
17501
17722
|
let server;
|
|
17502
17723
|
let session;
|
|
17503
17724
|
try {
|
|
17504
17725
|
server = await createFileServer({
|
|
17505
17726
|
projectDir: input.projectDir,
|
|
17506
|
-
compiledDir:
|
|
17727
|
+
compiledDir: join35(input.workDir, "compiled"),
|
|
17507
17728
|
port: 0,
|
|
17508
17729
|
preHeadScripts: [VIRTUAL_TIME_SHIM],
|
|
17509
17730
|
fps: input.options.fps
|
|
17510
17731
|
});
|
|
17511
17732
|
session = await createCaptureSession(
|
|
17512
17733
|
server.url,
|
|
17513
|
-
|
|
17734
|
+
join35(input.workDir, "reference"),
|
|
17514
17735
|
{
|
|
17515
17736
|
...input.options,
|
|
17516
17737
|
requiresWebGpu: false
|
|
@@ -17546,8 +17767,8 @@ async function readPlanReferenceBackground(input) {
|
|
|
17546
17767
|
}
|
|
17547
17768
|
|
|
17548
17769
|
// ../producer/src/services/render/stages/freezePlan.ts
|
|
17549
|
-
import { existsSync as
|
|
17550
|
-
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";
|
|
17551
17772
|
|
|
17552
17773
|
// ../producer/src/services/distributed/planProtocol.ts
|
|
17553
17774
|
var PLAN_SCHEMA_VERSION = 1;
|
|
@@ -17736,7 +17957,7 @@ function planFileSha256(absolutePath, digests) {
|
|
|
17736
17957
|
return sha256;
|
|
17737
17958
|
}
|
|
17738
17959
|
async function prehashPlanFiles(dir, digests) {
|
|
17739
|
-
if (!
|
|
17960
|
+
if (!existsSync24(dir)) return;
|
|
17740
17961
|
for (const { absolutePath } of listPlanFiles(dir)) {
|
|
17741
17962
|
if (!digests.has(absolutePath)) digests.set(absolutePath, await sha256FileAsync(absolutePath));
|
|
17742
17963
|
}
|
|
@@ -17757,16 +17978,16 @@ function stripUndefined(value) {
|
|
|
17757
17978
|
}
|
|
17758
17979
|
function listPlanFiles(planDir) {
|
|
17759
17980
|
const results = [];
|
|
17760
|
-
const rootResolved =
|
|
17981
|
+
const rootResolved = resolve8(planDir);
|
|
17761
17982
|
function walk(dir) {
|
|
17762
17983
|
const entries = readdirSync8(dir, { withFileTypes: true });
|
|
17763
17984
|
for (const entry of entries) {
|
|
17764
|
-
const full =
|
|
17985
|
+
const full = join36(dir, entry.name);
|
|
17765
17986
|
if (entry.isDirectory()) {
|
|
17766
17987
|
walk(full);
|
|
17767
17988
|
} else if (entry.isFile()) {
|
|
17768
17989
|
results.push({
|
|
17769
|
-
planRelativePath:
|
|
17990
|
+
planRelativePath: relative5(rootResolved, full).split(/[\\/]+/).join("/"),
|
|
17770
17991
|
absolutePath: full
|
|
17771
17992
|
});
|
|
17772
17993
|
}
|
|
@@ -17802,19 +18023,19 @@ var PLAN_REMOTE_FILES_RELATIVE_PATH = "meta/remote-files.json";
|
|
|
17802
18023
|
function writePlanRemoteFiles(planDir, files) {
|
|
17803
18024
|
if (files.length === 0) return;
|
|
17804
18025
|
const sorted = [...files].sort((a, b) => a.path < b.path ? -1 : 1);
|
|
17805
|
-
writeFileSync7(
|
|
18026
|
+
writeFileSync7(join36(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH), JSON.stringify(sorted), "utf-8");
|
|
17806
18027
|
}
|
|
17807
18028
|
function readPlanRemoteFiles(planDir) {
|
|
17808
|
-
const path =
|
|
17809
|
-
return
|
|
18029
|
+
const path = join36(planDir, PLAN_REMOTE_FILES_RELATIVE_PATH);
|
|
18030
|
+
return existsSync24(path) ? JSON.parse(readFileSync9(path, "utf-8")) : [];
|
|
17810
18031
|
}
|
|
17811
18032
|
function recomputePlanHashFromPlanDir(planDir, digests) {
|
|
17812
|
-
const planJsonPath =
|
|
17813
|
-
const encoderJsonPath =
|
|
17814
|
-
if (!
|
|
18033
|
+
const planJsonPath = join36(planDir, "plan.json");
|
|
18034
|
+
const encoderJsonPath = join36(planDir, "meta", "encoder.json");
|
|
18035
|
+
if (!existsSync24(planJsonPath)) {
|
|
17815
18036
|
throw new Error(`[freezePlan] plan.json missing: ${planJsonPath}`);
|
|
17816
18037
|
}
|
|
17817
|
-
if (!
|
|
18038
|
+
if (!existsSync24(encoderJsonPath)) {
|
|
17818
18039
|
throw new Error(`[freezePlan] meta/encoder.json missing: ${encoderJsonPath}`);
|
|
17819
18040
|
}
|
|
17820
18041
|
const planJson = JSON.parse(readFileSync9(planJsonPath, "utf-8"));
|
|
@@ -17844,21 +18065,21 @@ async function freezePlan(input) {
|
|
|
17844
18065
|
hasAudio,
|
|
17845
18066
|
digests
|
|
17846
18067
|
} = input;
|
|
17847
|
-
if (!
|
|
18068
|
+
if (!existsSync24(planDir)) {
|
|
17848
18069
|
throw new Error(`[freezePlan] planDir does not exist: ${planDir}`);
|
|
17849
18070
|
}
|
|
17850
|
-
const metaDir =
|
|
17851
|
-
if (!
|
|
18071
|
+
const metaDir = join36(planDir, "meta");
|
|
18072
|
+
if (!existsSync24(metaDir)) mkdirSync12(metaDir, { recursive: true });
|
|
17852
18073
|
writeFileSync7(
|
|
17853
|
-
|
|
18074
|
+
join36(metaDir, "composition.json"),
|
|
17854
18075
|
`${JSON.stringify(composition, null, 2)}
|
|
17855
18076
|
`,
|
|
17856
18077
|
"utf-8"
|
|
17857
18078
|
);
|
|
17858
18079
|
const encoderForCanonical = stripUndefined(encoder);
|
|
17859
18080
|
const encoderConfigCanonicalJson = canonicalJsonStringify(encoderForCanonical);
|
|
17860
|
-
writeFileSync7(
|
|
17861
|
-
writeFileSync7(
|
|
18081
|
+
writeFileSync7(join36(metaDir, "encoder.json"), encoderConfigCanonicalJson, "utf-8");
|
|
18082
|
+
writeFileSync7(join36(metaDir, "chunks.json"), `${JSON.stringify(chunks, null, 2)}
|
|
17862
18083
|
`, "utf-8");
|
|
17863
18084
|
const { compositionHtml, assets } = collectPlanAssetShas(planDir, digests);
|
|
17864
18085
|
const planHash = computePlanHash({
|
|
@@ -17883,7 +18104,7 @@ async function freezePlan(input) {
|
|
|
17883
18104
|
duration: durationSeconds,
|
|
17884
18105
|
hasAudio
|
|
17885
18106
|
};
|
|
17886
|
-
const planJsonPath =
|
|
18107
|
+
const planJsonPath = join36(planDir, "plan.json");
|
|
17887
18108
|
writeFileSync7(planJsonPath, `${JSON.stringify(planJson, null, 2)}
|
|
17888
18109
|
`, "utf-8");
|
|
17889
18110
|
return { planJsonPath, planHash };
|
|
@@ -17925,9 +18146,9 @@ function applyRuntimeEnvSnapshot(snapshot, env = process.env) {
|
|
|
17925
18146
|
}
|
|
17926
18147
|
|
|
17927
18148
|
// ../producer/src/services/distributed/chunkAudio.ts
|
|
17928
|
-
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";
|
|
17929
18150
|
import { writeFileSync as writeFileSync8, writeSync } from "fs";
|
|
17930
|
-
import { join as
|
|
18151
|
+
import { join as join37 } from "path";
|
|
17931
18152
|
function audioCutForChunk(grid, chunks, index, fps) {
|
|
17932
18153
|
const firstPacketAt = (frame) => Math.min(
|
|
17933
18154
|
grid.packetCount,
|
|
@@ -18014,7 +18235,7 @@ async function writeChunkAudioSlices(input) {
|
|
|
18014
18235
|
});
|
|
18015
18236
|
const bytes = readFileSync10(input.audioPath);
|
|
18016
18237
|
const layout = { sizeBytes: bytes.length, payloadStart, payloadEnd, partStarts: {} };
|
|
18017
|
-
mkdirSync13(
|
|
18238
|
+
mkdirSync13(join37(input.planDir, SLICE_DIR), { recursive: true });
|
|
18018
18239
|
input.chunks.forEach((_, index) => {
|
|
18019
18240
|
const cut = audioCutForChunk(grid, input.chunks, index, input.fps);
|
|
18020
18241
|
if (!cut) return;
|
|
@@ -18022,17 +18243,17 @@ async function writeChunkAudioSlices(input) {
|
|
|
18022
18243
|
const start = offsets[cut.firstPacket];
|
|
18023
18244
|
layout.partStarts[index] = start;
|
|
18024
18245
|
const end = offsets[last] + track.sizes[last];
|
|
18025
|
-
writeFileSync8(
|
|
18246
|
+
writeFileSync8(join37(input.planDir, chunkAudioSlicePath(index)), bytes.subarray(start, end));
|
|
18026
18247
|
});
|
|
18027
18248
|
const frame = [bytes.subarray(0, payloadStart), bytes.subarray(payloadEnd)];
|
|
18028
|
-
writeFileSync8(
|
|
18029
|
-
writeFileSync8(
|
|
18249
|
+
writeFileSync8(join37(input.planDir, SLICE_FRAME), Buffer.concat(frame));
|
|
18250
|
+
writeFileSync8(join37(input.planDir, SLICE_LAYOUT), JSON.stringify(layout));
|
|
18030
18251
|
}
|
|
18031
18252
|
function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
18032
|
-
const layoutPath =
|
|
18033
|
-
if (!
|
|
18253
|
+
const layoutPath = join37(planDir, SLICE_LAYOUT);
|
|
18254
|
+
if (!existsSync25(layoutPath)) return resolvePlanAudioPath(planDir);
|
|
18034
18255
|
const layout = JSON.parse(readFileSync10(layoutPath, "utf-8"));
|
|
18035
|
-
const frame = readFileSync10(
|
|
18256
|
+
const frame = readFileSync10(join37(planDir, SLICE_FRAME));
|
|
18036
18257
|
const fd = openSync5(scratchPath, "w");
|
|
18037
18258
|
try {
|
|
18038
18259
|
writeSync(fd, frame, 0, layout.payloadStart, 0);
|
|
@@ -18045,7 +18266,7 @@ function chunkAudioSource(planDir, chunkIndex, scratchPath) {
|
|
|
18045
18266
|
);
|
|
18046
18267
|
const start = layout.partStarts[chunkIndex];
|
|
18047
18268
|
if (start !== void 0) {
|
|
18048
|
-
const part = readFileSync10(
|
|
18269
|
+
const part = readFileSync10(join37(planDir, chunkAudioSlicePath(chunkIndex)));
|
|
18049
18270
|
writeSync(fd, part, 0, part.length, start);
|
|
18050
18271
|
}
|
|
18051
18272
|
ftruncateSync(fd, layout.sizeBytes);
|
|
@@ -18100,8 +18321,8 @@ async function muxChunkWithAudio(input) {
|
|
|
18100
18321
|
|
|
18101
18322
|
// ../producer/src/services/distributed/planSize.ts
|
|
18102
18323
|
import { createHash as createHash7 } from "crypto";
|
|
18103
|
-
import { lstatSync as
|
|
18104
|
-
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";
|
|
18105
18326
|
var MAX_TOP_COMPONENTS = 10;
|
|
18106
18327
|
var SOURCE_MEDIA_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
18107
18328
|
".aac",
|
|
@@ -18184,13 +18405,13 @@ function addCategoryBytes(result, category, filePath, sizeBytes) {
|
|
|
18184
18405
|
function recordFile(result, components, rootDir, rootKind, filePath) {
|
|
18185
18406
|
let sizeBytes;
|
|
18186
18407
|
try {
|
|
18187
|
-
const stat =
|
|
18408
|
+
const stat = lstatSync3(filePath);
|
|
18188
18409
|
if (!stat.isFile()) return;
|
|
18189
18410
|
sizeBytes = stat.size;
|
|
18190
18411
|
} catch {
|
|
18191
18412
|
return;
|
|
18192
18413
|
}
|
|
18193
|
-
const rel =
|
|
18414
|
+
const rel = relative6(rootDir, filePath);
|
|
18194
18415
|
const segments = rel.split(/[\\/]+/).filter(Boolean);
|
|
18195
18416
|
const classified = classifyFile(segments, rootKind);
|
|
18196
18417
|
result.totalBytes += sizeBytes;
|
|
@@ -18213,7 +18434,7 @@ function walkRegularFiles(dir, visit) {
|
|
|
18213
18434
|
return;
|
|
18214
18435
|
}
|
|
18215
18436
|
for (const entry of entries) {
|
|
18216
|
-
const full =
|
|
18437
|
+
const full = join38(dir, entry.name);
|
|
18217
18438
|
if (entry.isDirectory()) {
|
|
18218
18439
|
walkRegularFiles(full, visit);
|
|
18219
18440
|
} else if (entry.isFile()) {
|
|
@@ -18429,13 +18650,13 @@ function assertPositiveInteger2(name, value) {
|
|
|
18429
18650
|
}
|
|
18430
18651
|
var FREEZE_OWNED_PLAN_FILES = [
|
|
18431
18652
|
"plan.json",
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18653
|
+
join39("meta", "composition.json"),
|
|
18654
|
+
join39("meta", "encoder.json"),
|
|
18655
|
+
join39("meta", "chunks.json")
|
|
18435
18656
|
];
|
|
18436
18657
|
function removeFreezeOwnedPlanFiles(planDir) {
|
|
18437
18658
|
for (const relativePath of FREEZE_OWNED_PLAN_FILES) {
|
|
18438
|
-
rmSync12(
|
|
18659
|
+
rmSync12(join39(planDir, relativePath), { force: true });
|
|
18439
18660
|
}
|
|
18440
18661
|
}
|
|
18441
18662
|
function buildChunkSlices(totalFrames, chunkCount, effectiveChunkSize) {
|
|
@@ -18574,16 +18795,16 @@ function resolveDistributedEngineConfig(config) {
|
|
|
18574
18795
|
};
|
|
18575
18796
|
}
|
|
18576
18797
|
function leavesRoot(rel) {
|
|
18577
|
-
return rel === ".." || rel.startsWith(`..${
|
|
18798
|
+
return rel === ".." || rel.startsWith(`..${sep4}`) || isAbsolute3(rel);
|
|
18578
18799
|
}
|
|
18579
18800
|
function pathInside(root, path) {
|
|
18580
|
-
const rel =
|
|
18801
|
+
const rel = relative7(root, path);
|
|
18581
18802
|
return rel === "" || leavesRoot(rel) ? null : rel;
|
|
18582
18803
|
}
|
|
18583
18804
|
function stableSourcePath(roots, srcPath) {
|
|
18584
18805
|
for (const [root, prefix] of roots) {
|
|
18585
18806
|
const rel = pathInside(root, srcPath);
|
|
18586
|
-
if (rel !== null) return [prefix, ...rel.split(
|
|
18807
|
+
if (rel !== null) return [prefix, ...rel.split(sep4)].filter(Boolean).join("/");
|
|
18587
18808
|
}
|
|
18588
18809
|
return srcPath;
|
|
18589
18810
|
}
|
|
@@ -18593,19 +18814,19 @@ function createVideoSourceShipper(input) {
|
|
|
18593
18814
|
const known = shipped.get(srcPath);
|
|
18594
18815
|
if (known) return known;
|
|
18595
18816
|
const stagedRel = pathInside(input.workVideoFramesDir, srcPath);
|
|
18596
|
-
const current = stagedRel === null ? srcPath :
|
|
18817
|
+
const current = stagedRel === null ? srcPath : join39(input.planDir, "video-frames", stagedRel);
|
|
18597
18818
|
let result = null;
|
|
18598
18819
|
for (const root of stagedRel === null ? [input.workCompiledDir, input.projectDir] : []) {
|
|
18599
18820
|
const rel = pathInside(root, srcPath);
|
|
18600
|
-
if (rel !== null && (
|
|
18601
|
-
result = ["compiled", ...rel.split(
|
|
18821
|
+
if (rel !== null && (existsSync26(join39(input.planDir, "compiled", rel)) || input.isRemote(srcPath))) {
|
|
18822
|
+
result = ["compiled", ...rel.split(sep4)].join("/");
|
|
18602
18823
|
break;
|
|
18603
18824
|
}
|
|
18604
18825
|
}
|
|
18605
18826
|
if (result === null) {
|
|
18606
18827
|
result = `video-sources/${shipped.size}${extname6(current)}`;
|
|
18607
|
-
const destination =
|
|
18608
|
-
mkdirSync14(
|
|
18828
|
+
const destination = join39(input.planDir, ...result.split("/"));
|
|
18829
|
+
mkdirSync14(join39(input.planDir, "video-sources"), { recursive: true });
|
|
18609
18830
|
try {
|
|
18610
18831
|
linkSync(current, destination);
|
|
18611
18832
|
} catch {
|
|
@@ -18625,7 +18846,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18625
18846
|
useGpu: false,
|
|
18626
18847
|
browserGpuMode: "software"
|
|
18627
18848
|
});
|
|
18628
|
-
if (!
|
|
18849
|
+
if (!existsSync26(planDir)) mkdirSync14(planDir, { recursive: true });
|
|
18629
18850
|
const log = config.logger ?? defaultLogger;
|
|
18630
18851
|
const sizeLimitBytes = options.executionPlanSizeLimitBytes ?? config.planDirSizeLimitBytes ?? PLAN_DIR_SIZE_LIMIT_BYTES;
|
|
18631
18852
|
const abortSignal = config.abortSignal;
|
|
@@ -18659,21 +18880,21 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18659
18880
|
includeOutsideScripts: options.includeOutsideScripts === true
|
|
18660
18881
|
});
|
|
18661
18882
|
const entryFile = config.entryFile ?? "index.html";
|
|
18662
|
-
const htmlPath =
|
|
18663
|
-
if (!
|
|
18883
|
+
const htmlPath = join39(projectDir, entryFile);
|
|
18884
|
+
if (!existsSync26(htmlPath)) {
|
|
18664
18885
|
throw new Error(`[plan] entry file not found: ${htmlPath}`);
|
|
18665
18886
|
}
|
|
18666
|
-
const workDir =
|
|
18887
|
+
const workDir = join39(planDir, ".plan-work");
|
|
18667
18888
|
rmSync12(workDir, { recursive: true, force: true });
|
|
18668
18889
|
mkdirSync14(workDir, { recursive: true });
|
|
18669
|
-
const compiledDir =
|
|
18890
|
+
const compiledDir = join39(workDir, "compiled");
|
|
18670
18891
|
mkdirSync14(compiledDir, { recursive: true });
|
|
18671
18892
|
let stageStarted = Date.now();
|
|
18672
18893
|
cpSync2(projectDir, compiledDir, {
|
|
18673
18894
|
recursive: true,
|
|
18674
18895
|
dereference: true,
|
|
18675
18896
|
filter: (src) => {
|
|
18676
|
-
const rel =
|
|
18897
|
+
const rel = relative7(projectDir, src);
|
|
18677
18898
|
if (rel === "") return true;
|
|
18678
18899
|
if (leavesRoot(rel)) return false;
|
|
18679
18900
|
if (job.config.allowOutsideProjectAssets) {
|
|
@@ -18681,15 +18902,15 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18681
18902
|
const policy = { includeScripts: job.config.includeOutsideScripts };
|
|
18682
18903
|
if (refusesOutsideLink(projectDir, src, warn, policy)) return false;
|
|
18683
18904
|
} else if (!isSafePath(projectDir, src)) return false;
|
|
18684
|
-
const firstSegment = rel.split(
|
|
18905
|
+
const firstSegment = rel.split(sep4, 1)[0];
|
|
18685
18906
|
return firstSegment === void 0 || !PLAN_PROJECT_DIR_SKIP_SEGMENTS.has(firstSegment);
|
|
18686
18907
|
}
|
|
18687
18908
|
});
|
|
18688
18909
|
logPlanStage(log, "copy", stageStarted);
|
|
18689
|
-
const finalCompiledDir =
|
|
18910
|
+
const finalCompiledDir = join39(planDir, "compiled");
|
|
18690
18911
|
const needsAlpha = outputNeedsAlpha(config.format);
|
|
18691
18912
|
const remoteFiles = Object.entries(options.remoteFiles ?? {});
|
|
18692
|
-
const remoteLocalPath = (rel) =>
|
|
18913
|
+
const remoteLocalPath = (rel) => join39(projectDir, ...rel.split("/"));
|
|
18693
18914
|
for (const [, file] of remoteFiles) {
|
|
18694
18915
|
declareContentAddressedUrl(file.url, file.sha256);
|
|
18695
18916
|
if (file.probeFactsUrl) declareProbeFactsUrl(file.url, file.probeFactsUrl);
|
|
@@ -18786,7 +19007,7 @@ async function compilePlanComposition(projectDir, config, planDir, options) {
|
|
|
18786
19007
|
if (probeResult.fileServer) closeFileServerSafely(probeResult.fileServer, "plan", log);
|
|
18787
19008
|
if (probeResult.probeSession) {
|
|
18788
19009
|
try {
|
|
18789
|
-
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-
|
|
19010
|
+
const { closeCaptureSession: closeCaptureSession2 } = await import("./src-COKNEXLI.js");
|
|
18790
19011
|
await closeCaptureSession2(probeResult.probeSession);
|
|
18791
19012
|
} catch (err) {
|
|
18792
19013
|
log.warn("[plan] probe session close failed", {
|
|
@@ -18894,17 +19115,17 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
18894
19115
|
let stageStarted = Date.now();
|
|
18895
19116
|
const extractResult = await extractPlanVideos(c, options.deferVideoExtraction);
|
|
18896
19117
|
logPlanStage(log, "extract", stageStarted);
|
|
18897
|
-
const stagedVideoFrames =
|
|
18898
|
-
const videoFramesDst =
|
|
18899
|
-
if (
|
|
18900
|
-
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");
|
|
18901
19122
|
rmSync12(videoSourcesDir, { recursive: true, force: true });
|
|
18902
|
-
if (
|
|
19123
|
+
if (existsSync26(stagedVideoFrames)) {
|
|
18903
19124
|
renameWithRetry(stagedVideoFrames, videoFramesDst);
|
|
18904
19125
|
} else {
|
|
18905
19126
|
mkdirSync14(videoFramesDst, { recursive: true });
|
|
18906
19127
|
}
|
|
18907
|
-
if (
|
|
19128
|
+
if (existsSync26(finalCompiledDir)) rmSync12(finalCompiledDir, { recursive: true, force: true });
|
|
18908
19129
|
renameWithRetry(compiledDir, finalCompiledDir);
|
|
18909
19130
|
const shipVideoSource = createVideoSourceShipper({
|
|
18910
19131
|
planDir,
|
|
@@ -18934,7 +19155,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
18934
19155
|
};
|
|
18935
19156
|
})
|
|
18936
19157
|
});
|
|
18937
|
-
mkdirSync14(
|
|
19158
|
+
mkdirSync14(join39(planDir, "meta"), { recursive: true });
|
|
18938
19159
|
writePlanRemoteFiles(
|
|
18939
19160
|
planDir,
|
|
18940
19161
|
remoteFiles.map(([rel, { sha256, sizeBytes }]) => ({
|
|
@@ -18944,7 +19165,7 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
18944
19165
|
}))
|
|
18945
19166
|
);
|
|
18946
19167
|
writeFileSync9(
|
|
18947
|
-
|
|
19168
|
+
join39(planDir, PLAN_VIDEOS_META_RELATIVE_PATH),
|
|
18948
19169
|
JSON.stringify(planVideosJson, null, 2),
|
|
18949
19170
|
"utf-8"
|
|
18950
19171
|
);
|
|
@@ -19024,11 +19245,11 @@ async function buildLocalExecutionPlan(projectDir, config, executionPlanDir, opt
|
|
|
19024
19245
|
if (audioResult?.audioError) {
|
|
19025
19246
|
applyDistributedAudioWarningPolicy(job, audioResult.audioError, audioResult.audioFailures, log);
|
|
19026
19247
|
}
|
|
19027
|
-
const planAudioPath =
|
|
19028
|
-
if (audioResult?.hasAudio &&
|
|
19248
|
+
const planAudioPath = join39(planDir, PLAN_AUDIO_RELATIVE_PATH);
|
|
19249
|
+
if (audioResult?.hasAudio && existsSync26(audioResult.audioOutputPath)) {
|
|
19029
19250
|
renameWithRetry(audioResult.audioOutputPath, planAudioPath);
|
|
19030
19251
|
}
|
|
19031
|
-
if (chunksCarryAudio &&
|
|
19252
|
+
if (chunksCarryAudio && existsSync26(planAudioPath)) {
|
|
19032
19253
|
if (options.sliceChunkAudio) {
|
|
19033
19254
|
stageStarted = Date.now();
|
|
19034
19255
|
await writeChunkAudioSlices({
|
|
@@ -19150,14 +19371,14 @@ async function plan(projectDir, config, planDir, options = {}) {
|
|
|
19150
19371
|
|
|
19151
19372
|
// ../producer/src/services/distributed/renderChunk.ts
|
|
19152
19373
|
import { randomBytes } from "crypto";
|
|
19153
|
-
import { existsSync as
|
|
19154
|
-
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";
|
|
19155
19376
|
|
|
19156
19377
|
// ../producer/src/services/distributed/planV2.ts
|
|
19157
19378
|
import {
|
|
19158
19379
|
copyFileSync as copyFileSync6,
|
|
19159
|
-
existsSync as
|
|
19160
|
-
lstatSync as
|
|
19380
|
+
existsSync as existsSync28,
|
|
19381
|
+
lstatSync as lstatSync4,
|
|
19161
19382
|
mkdirSync as mkdirSync16,
|
|
19162
19383
|
readFileSync as readFileSync11,
|
|
19163
19384
|
readdirSync as readdirSync10,
|
|
@@ -19165,20 +19386,20 @@ import {
|
|
|
19165
19386
|
statSync as statSync10,
|
|
19166
19387
|
writeFileSync as writeFileSync11
|
|
19167
19388
|
} from "fs";
|
|
19168
|
-
import { tmpdir as
|
|
19169
|
-
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";
|
|
19170
19391
|
|
|
19171
19392
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
19172
19393
|
import {
|
|
19173
19394
|
copyFileSync as copyFileSync5,
|
|
19174
|
-
existsSync as
|
|
19395
|
+
existsSync as existsSync27,
|
|
19175
19396
|
linkSync as linkSync2,
|
|
19176
19397
|
mkdirSync as mkdirSync15,
|
|
19177
19398
|
rmSync as rmSync13,
|
|
19178
19399
|
statSync as statSync9,
|
|
19179
19400
|
writeFileSync as writeFileSync10
|
|
19180
19401
|
} from "fs";
|
|
19181
|
-
import { dirname as dirname15, join as
|
|
19402
|
+
import { dirname as dirname15, join as join41 } from "path";
|
|
19182
19403
|
|
|
19183
19404
|
// ../producer/src/services/distributed/planV2Errors.ts
|
|
19184
19405
|
var PLAN_V2_INTEGRITY_UNRECOVERABLE = "PLAN_V2_INTEGRITY_UNRECOVERABLE";
|
|
@@ -19193,7 +19414,7 @@ var PlanV2IntegrityError = class extends Error {
|
|
|
19193
19414
|
};
|
|
19194
19415
|
|
|
19195
19416
|
// ../producer/src/services/distributed/planV2Layout.ts
|
|
19196
|
-
import { join as
|
|
19417
|
+
import { join as join40 } from "path";
|
|
19197
19418
|
var SHA256_PATTERN = /^[0-9a-f]{64}$/;
|
|
19198
19419
|
function assertPlanV2Sha256(value, field) {
|
|
19199
19420
|
if (typeof value !== "string" || !SHA256_PATTERN.test(value)) {
|
|
@@ -19203,7 +19424,7 @@ function assertPlanV2Sha256(value, field) {
|
|
|
19203
19424
|
}
|
|
19204
19425
|
function planV2BlobPath(root, sha256) {
|
|
19205
19426
|
const digest = assertPlanV2Sha256(sha256, "artifact sha256");
|
|
19206
|
-
return
|
|
19427
|
+
return join40(root, "artifacts", "sha256", digest.slice(0, 2), digest);
|
|
19207
19428
|
}
|
|
19208
19429
|
|
|
19209
19430
|
// ../producer/src/services/distributed/planV2Publisher.ts
|
|
@@ -19233,7 +19454,7 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19233
19454
|
#linkFile;
|
|
19234
19455
|
#committed = false;
|
|
19235
19456
|
constructor(destinationDir, options = {}) {
|
|
19236
|
-
if (
|
|
19457
|
+
if (existsSync27(destinationDir)) {
|
|
19237
19458
|
throw new PlanV2IntegrityError(`output directory already exists: ${destinationDir}`);
|
|
19238
19459
|
}
|
|
19239
19460
|
this.destinationDir = destinationDir;
|
|
@@ -19250,10 +19471,10 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19250
19471
|
);
|
|
19251
19472
|
}
|
|
19252
19473
|
const destinationPath = planV2BlobPath(this.temporaryDir, digest);
|
|
19253
|
-
if (
|
|
19474
|
+
if (existsSync27(destinationPath)) return;
|
|
19254
19475
|
mkdirSync15(dirname15(destinationPath), { recursive: true });
|
|
19255
19476
|
const stagingDir = createStagingDir(dirname15(destinationPath), ".plan-v2-blob-");
|
|
19256
|
-
const temporaryPath =
|
|
19477
|
+
const temporaryPath = join41(stagingDir, "blob");
|
|
19257
19478
|
try {
|
|
19258
19479
|
try {
|
|
19259
19480
|
this.#linkFile(blob.sourcePath, temporaryPath);
|
|
@@ -19268,13 +19489,13 @@ var LocalPlanV2ArtifactPublisher = class {
|
|
|
19268
19489
|
}
|
|
19269
19490
|
async commitManifest(manifestBytes) {
|
|
19270
19491
|
for (const digest of new Set(manifestDigests(manifestBytes))) {
|
|
19271
|
-
if (!
|
|
19492
|
+
if (!existsSync27(planV2BlobPath(this.temporaryDir, digest))) {
|
|
19272
19493
|
throw new PlanV2IntegrityError(
|
|
19273
19494
|
`cannot commit manifest before referenced blob is durable: ${digest}`
|
|
19274
19495
|
);
|
|
19275
19496
|
}
|
|
19276
19497
|
}
|
|
19277
|
-
writeFileSync10(
|
|
19498
|
+
writeFileSync10(join41(this.temporaryDir, "plan.json"), manifestBytes, "utf-8");
|
|
19278
19499
|
renameWithRetry(this.temporaryDir, this.destinationDir);
|
|
19279
19500
|
this.#committed = true;
|
|
19280
19501
|
}
|
|
@@ -19310,21 +19531,21 @@ function readJsonFile(path, label) {
|
|
|
19310
19531
|
}
|
|
19311
19532
|
function assertSafeRelativePath(path) {
|
|
19312
19533
|
const normalized = path.split(/[\\/]+/);
|
|
19313
|
-
if (path.length === 0 ||
|
|
19534
|
+
if (path.length === 0 || isAbsolute4(path) || normalized.some((part) => part === "" || part === "." || part === "..")) {
|
|
19314
19535
|
throw new PlanV2IntegrityError(`unsafe artifact path: ${JSON.stringify(path)}`);
|
|
19315
19536
|
}
|
|
19316
19537
|
}
|
|
19317
19538
|
function listFiles(root) {
|
|
19318
19539
|
const files = [];
|
|
19319
|
-
const rootResolved =
|
|
19540
|
+
const rootResolved = resolve9(root);
|
|
19320
19541
|
function walk(dir) {
|
|
19321
19542
|
for (const entry of readdirSync10(dir, { withFileTypes: true })) {
|
|
19322
|
-
const absolutePath =
|
|
19543
|
+
const absolutePath = join42(dir, entry.name);
|
|
19323
19544
|
if (entry.isDirectory()) {
|
|
19324
19545
|
walk(absolutePath);
|
|
19325
19546
|
} else if (entry.isFile()) {
|
|
19326
19547
|
files.push({
|
|
19327
|
-
path:
|
|
19548
|
+
path: relative8(rootResolved, absolutePath).split(sep5).join("/"),
|
|
19328
19549
|
absolutePath
|
|
19329
19550
|
});
|
|
19330
19551
|
} else {
|
|
@@ -19338,7 +19559,7 @@ function listFiles(root) {
|
|
|
19338
19559
|
return files.sort((a, b) => a.path.localeCompare(b.path));
|
|
19339
19560
|
}
|
|
19340
19561
|
function assertValidExtractionCacheCompleteSentinel(path) {
|
|
19341
|
-
const sentinel =
|
|
19562
|
+
const sentinel = lstatSync4(path);
|
|
19342
19563
|
if (!sentinel.isFile() || sentinel.size !== 0) {
|
|
19343
19564
|
throw new PlanV2IntegrityError(
|
|
19344
19565
|
`${EXTRACTION_CACHE_COMPLETE_SENTINEL} must be a zero-byte regular file`
|
|
@@ -19346,13 +19567,13 @@ function assertValidExtractionCacheCompleteSentinel(path) {
|
|
|
19346
19567
|
}
|
|
19347
19568
|
}
|
|
19348
19569
|
function validateExtractionCacheCompleteSentinels(executionPlanDir) {
|
|
19349
|
-
const videoRoot =
|
|
19350
|
-
if (!
|
|
19570
|
+
const videoRoot = join42(executionPlanDir, "video-frames");
|
|
19571
|
+
if (!existsSync28(videoRoot)) return;
|
|
19351
19572
|
for (const videoEntry of readdirSync10(videoRoot, { withFileTypes: true })) {
|
|
19352
19573
|
if (!videoEntry.isDirectory()) continue;
|
|
19353
|
-
const videoDir =
|
|
19574
|
+
const videoDir = join42(videoRoot, videoEntry.name);
|
|
19354
19575
|
if (readdirSync10(videoDir).includes(EXTRACTION_CACHE_COMPLETE_SENTINEL)) {
|
|
19355
|
-
const sentinelPath =
|
|
19576
|
+
const sentinelPath = join42(videoDir, EXTRACTION_CACHE_COMPLETE_SENTINEL);
|
|
19356
19577
|
assertValidExtractionCacheCompleteSentinel(sentinelPath);
|
|
19357
19578
|
}
|
|
19358
19579
|
}
|
|
@@ -19362,9 +19583,9 @@ function isExtractionCacheCompleteSentinelPath(path) {
|
|
|
19362
19583
|
return segments.length === 3 && segments[0] === "video-frames" && segments[1] !== "" && segments[2] === EXTRACTION_CACHE_COMPLETE_SENTINEL;
|
|
19363
19584
|
}
|
|
19364
19585
|
function resolveExtractedVideoOutputDir(planDir, videoId) {
|
|
19365
|
-
const videoRoot =
|
|
19366
|
-
const outputDir =
|
|
19367
|
-
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}`)) {
|
|
19368
19589
|
throw new PlanV2IntegrityError(`unsafe extracted video id: ${JSON.stringify(videoId)}`);
|
|
19369
19590
|
}
|
|
19370
19591
|
return outputDir;
|
|
@@ -19399,7 +19620,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19399
19620
|
if (video.deferredRange) {
|
|
19400
19621
|
const framePaths2 = /* @__PURE__ */ new Map();
|
|
19401
19622
|
for (let index = 0; index < video.totalFrames; index++) {
|
|
19402
|
-
framePaths2.set(index,
|
|
19623
|
+
framePaths2.set(index, join42(outputDir, String(index)));
|
|
19403
19624
|
}
|
|
19404
19625
|
return { ...video, outputDir, framePaths: framePaths2, ownedByLookup: false };
|
|
19405
19626
|
}
|
|
@@ -19407,7 +19628,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19407
19628
|
const framePaths = /* @__PURE__ */ new Map();
|
|
19408
19629
|
for (const frameName of frameNames) {
|
|
19409
19630
|
if (frameName === EXTRACTION_CACHE_COMPLETE_SENTINEL) {
|
|
19410
|
-
assertValidExtractionCacheCompleteSentinel(
|
|
19631
|
+
assertValidExtractionCacheCompleteSentinel(join42(outputDir, frameName));
|
|
19411
19632
|
continue;
|
|
19412
19633
|
}
|
|
19413
19634
|
const match = /(\d+)(?=\.[^.]+$)/.exec(frameName);
|
|
@@ -19426,7 +19647,7 @@ function listVideoFramePaths(executionPlanDir, videos) {
|
|
|
19426
19647
|
`duplicate extracted frame index ${frameIndex} in ${outputDir}`
|
|
19427
19648
|
);
|
|
19428
19649
|
}
|
|
19429
|
-
framePaths.set(frameIndex,
|
|
19650
|
+
framePaths.set(frameIndex, join42(outputDir, frameName));
|
|
19430
19651
|
}
|
|
19431
19652
|
return {
|
|
19432
19653
|
...video,
|
|
@@ -19447,8 +19668,8 @@ function parsePlanVideosJson2(value) {
|
|
|
19447
19668
|
}
|
|
19448
19669
|
}
|
|
19449
19670
|
function materializeExtractedVideoDirectories(planDir) {
|
|
19450
|
-
const videosPath =
|
|
19451
|
-
if (!
|
|
19671
|
+
const videosPath = join42(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
19672
|
+
if (!existsSync28(videosPath)) return;
|
|
19452
19673
|
const videos = parsePlanVideosJson2(readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH));
|
|
19453
19674
|
for (const video of videos.extracted) {
|
|
19454
19675
|
mkdirSync16(resolveExtractedVideoOutputDir(planDir, video.videoId), { recursive: true });
|
|
@@ -19481,13 +19702,13 @@ function parseChunkSlices(value) {
|
|
|
19481
19702
|
});
|
|
19482
19703
|
}
|
|
19483
19704
|
function buildVideoChunkDependencies(executionPlanDir, dimensions) {
|
|
19484
|
-
const videoRoot =
|
|
19485
|
-
const hasExtractedFrames =
|
|
19486
|
-
const videosPath =
|
|
19487
|
-
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)) {
|
|
19488
19709
|
return hasExtractedFrames ? { mode: "full-source-pack", dependencies: null } : { mode: "exact-rendered-frames", dependencies: /* @__PURE__ */ new Map() };
|
|
19489
19710
|
}
|
|
19490
|
-
const chunksPath =
|
|
19711
|
+
const chunksPath = join42(executionPlanDir, "meta", "chunks.json");
|
|
19491
19712
|
const videos = readJsonFile(videosPath, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
19492
19713
|
const chunks = readJsonFile(chunksPath, "meta/chunks.json");
|
|
19493
19714
|
const parsedVideos = parsePlanVideosJson2(videos);
|
|
@@ -19524,7 +19745,7 @@ function collectChunkVideoDependencies(input) {
|
|
|
19524
19745
|
for (let frame = chunk.startFrame; frame < chunk.endFrame; frame++) {
|
|
19525
19746
|
const globalTime = frame * input.fpsDen / input.fpsNum;
|
|
19526
19747
|
for (const [videoId, payload] of input.table.getActiveFramePayloads(globalTime)) {
|
|
19527
|
-
const path = input.deferredSources.get(videoId) ??
|
|
19748
|
+
const path = input.deferredSources.get(videoId) ?? relative8(resolve9(input.executionPlanDir), payload.framePath).split(sep5).join("/");
|
|
19528
19749
|
assertSafeRelativePath(path);
|
|
19529
19750
|
const indexes = mutable.get(path) ?? /* @__PURE__ */ new Set();
|
|
19530
19751
|
indexes.add(chunk.index);
|
|
@@ -19541,10 +19762,10 @@ function computeManifestHash(manifest) {
|
|
|
19541
19762
|
return sha256Hex(`${PLAN_V2_HASH_PREFIX}${canonicalJsonStringify(manifestPayload(manifest))}`);
|
|
19542
19763
|
}
|
|
19543
19764
|
function writeBlob(sourcePath, destinationPath) {
|
|
19544
|
-
if (
|
|
19765
|
+
if (existsSync28(destinationPath)) return;
|
|
19545
19766
|
mkdirSync16(dirname16(destinationPath), { recursive: true });
|
|
19546
19767
|
const temporaryDir = createStagingDir(dirname16(destinationPath), ".plan-v2-blob-");
|
|
19547
|
-
const temporaryPath =
|
|
19768
|
+
const temporaryPath = join42(temporaryDir, "blob");
|
|
19548
19769
|
try {
|
|
19549
19770
|
copyFileSync6(sourcePath, temporaryPath);
|
|
19550
19771
|
renameWithRetry(temporaryPath, destinationPath);
|
|
@@ -19580,8 +19801,8 @@ async function putTasks(tasks) {
|
|
|
19580
19801
|
if (failure) throw failure.reason;
|
|
19581
19802
|
}
|
|
19582
19803
|
function buildPlanV2Publication(executionPlanDir, digests) {
|
|
19583
|
-
const executionPlanPath =
|
|
19584
|
-
if (!
|
|
19804
|
+
const executionPlanPath = join42(executionPlanDir, "plan.json");
|
|
19805
|
+
if (!existsSync28(executionPlanPath)) {
|
|
19585
19806
|
throw new PlanV2IntegrityError(`execution plan is missing plan.json: ${executionPlanPath}`);
|
|
19586
19807
|
}
|
|
19587
19808
|
const executionPlanValue = readJsonFile(executionPlanPath, "execution plan.json");
|
|
@@ -19608,7 +19829,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
19608
19829
|
}
|
|
19609
19830
|
validateExtractionCacheCompleteSentinels(executionPlanDir);
|
|
19610
19831
|
const videoDependencyPlan = buildVideoChunkDependencies(executionPlanDir, dimensions);
|
|
19611
|
-
const encoder = readJsonFile(
|
|
19832
|
+
const encoder = readJsonFile(join42(executionPlanDir, "meta", "encoder.json"), "meta/encoder.json");
|
|
19612
19833
|
const files = listFiles(executionPlanDir);
|
|
19613
19834
|
const chunkAudio = !isRecord3(encoder) || encoder.chunksCarryAudio !== true ? "none" : files.some((file) => chunkAudioSliceTarget(file.path) !== null) ? "sliced" : "whole";
|
|
19614
19835
|
for (const file of files) {
|
|
@@ -19661,7 +19882,7 @@ function buildPlanV2Publication(executionPlanDir, digests) {
|
|
|
19661
19882
|
};
|
|
19662
19883
|
}
|
|
19663
19884
|
function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
19664
|
-
if (
|
|
19885
|
+
if (existsSync28(planV2Dir)) {
|
|
19665
19886
|
throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
|
|
19666
19887
|
}
|
|
19667
19888
|
const publication = buildPlanV2Publication(executionPlanDir);
|
|
@@ -19675,7 +19896,7 @@ function createPlanV2FromExecutionPlan(executionPlanDir, planV2Dir) {
|
|
|
19675
19896
|
writeBlob(blob.sourcePath, planV2BlobPath(tempDir, blob.sha256));
|
|
19676
19897
|
}
|
|
19677
19898
|
writeFileSync11(
|
|
19678
|
-
|
|
19899
|
+
join42(tempDir, "plan.json"),
|
|
19679
19900
|
canonicalJsonStringify(publication.manifest),
|
|
19680
19901
|
"utf-8"
|
|
19681
19902
|
);
|
|
@@ -19716,7 +19937,7 @@ async function publishExecutionPlan(executionPlanDir, publisher, { digests, log
|
|
|
19716
19937
|
}
|
|
19717
19938
|
}
|
|
19718
19939
|
async function planV2WithPublisher(projectDir, config, publisher, options = {}) {
|
|
19719
|
-
const stagingRoot = createStagingDir(options.stagingParentDir ??
|
|
19940
|
+
const stagingRoot = createStagingDir(options.stagingParentDir ?? tmpdir4(), ".execution-plan-");
|
|
19720
19941
|
const digests = /* @__PURE__ */ new Map();
|
|
19721
19942
|
try {
|
|
19722
19943
|
const planned = await buildLocalExecutionPlan(projectDir, config, stagingRoot, {
|
|
@@ -19727,7 +19948,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19727
19948
|
// artifactTargets ships every compiled/ file to all chunks, so each is in the manifest.
|
|
19728
19949
|
whileAudioMixes: () => putBlobs(
|
|
19729
19950
|
publisher,
|
|
19730
|
-
listFiles(
|
|
19951
|
+
listFiles(join42(stagingRoot, "compiled")).map(
|
|
19731
19952
|
(file) => publishBlobFor(file.absolutePath, digests)
|
|
19732
19953
|
)
|
|
19733
19954
|
),
|
|
@@ -19751,7 +19972,7 @@ async function planV2WithPublisher(projectDir, config, publisher, options = {})
|
|
|
19751
19972
|
}
|
|
19752
19973
|
}
|
|
19753
19974
|
async function planV2(projectDir, config, planV2Dir) {
|
|
19754
|
-
if (
|
|
19975
|
+
if (existsSync28(planV2Dir)) {
|
|
19755
19976
|
throw new PlanV2IntegrityError(`output directory already exists: ${planV2Dir}`);
|
|
19756
19977
|
}
|
|
19757
19978
|
const publisher = new LocalPlanV2ArtifactPublisher(planV2Dir);
|
|
@@ -19768,7 +19989,7 @@ function resultFromManifest(planV2Dir, manifest) {
|
|
|
19768
19989
|
isRecord3(executionPlan) ? executionPlan[REFERENCE_BACKGROUND_FIELD] : void 0
|
|
19769
19990
|
),
|
|
19770
19991
|
planDir: planV2Dir,
|
|
19771
|
-
manifestPath:
|
|
19992
|
+
manifestPath: join42(planV2Dir, "plan.json"),
|
|
19772
19993
|
planProtocol: PLAN_PROTOCOL_V2,
|
|
19773
19994
|
planHash: manifest.planHash,
|
|
19774
19995
|
sourcePlanV1Hash: getPlanV2ExecutionPlanHash(manifest),
|
|
@@ -19904,8 +20125,8 @@ function parsePlanV2Manifest(value) {
|
|
|
19904
20125
|
return parsed;
|
|
19905
20126
|
}
|
|
19906
20127
|
function readPlanV2Manifest(planV2Dir) {
|
|
19907
|
-
const manifestPath =
|
|
19908
|
-
if (!
|
|
20128
|
+
const manifestPath = join42(planV2Dir, "plan.json");
|
|
20129
|
+
if (!existsSync28(manifestPath)) {
|
|
19909
20130
|
throw new PlanV2IntegrityError(`missing v2 manifest: ${manifestPath}`);
|
|
19910
20131
|
}
|
|
19911
20132
|
const value = readJsonFile(manifestPath, "v2 manifest");
|
|
@@ -19924,7 +20145,7 @@ function listPlanV2ArtifactsForTarget(manifest, target) {
|
|
|
19924
20145
|
}
|
|
19925
20146
|
function verifyBlob(planV2Dir, artifact) {
|
|
19926
20147
|
const sourcePath = planV2BlobPath(planV2Dir, artifact.sha256);
|
|
19927
|
-
if (!
|
|
20148
|
+
if (!existsSync28(sourcePath)) {
|
|
19928
20149
|
throw new PlanV2IntegrityError(`missing content-addressed artifact ${artifact.sha256}`);
|
|
19929
20150
|
}
|
|
19930
20151
|
const stats = statSync10(sourcePath);
|
|
@@ -19937,7 +20158,7 @@ function verifyBlob(planV2Dir, artifact) {
|
|
|
19937
20158
|
return sourcePath;
|
|
19938
20159
|
}
|
|
19939
20160
|
function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}) {
|
|
19940
|
-
if (
|
|
20161
|
+
if (existsSync28(destinationDir)) {
|
|
19941
20162
|
throw new PlanV2IntegrityError(`materialization destination already exists: ${destinationDir}`);
|
|
19942
20163
|
}
|
|
19943
20164
|
const manifest = readPlanV2Manifest(planV2Dir);
|
|
@@ -19953,13 +20174,13 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
19953
20174
|
const tempDir = createStagingDir(dirname16(destinationDir), ".plan-v2-materialize-");
|
|
19954
20175
|
try {
|
|
19955
20176
|
for (const { artifact, sourcePath } of verified) {
|
|
19956
|
-
const destinationPath =
|
|
20177
|
+
const destinationPath = join42(tempDir, ...artifact.path.split("/"));
|
|
19957
20178
|
mkdirSync16(dirname16(destinationPath), { recursive: true });
|
|
19958
20179
|
copyFileSync6(sourcePath, destinationPath);
|
|
19959
20180
|
}
|
|
19960
20181
|
if (target.role === "chunk") materializeExtractedVideoDirectories(tempDir);
|
|
19961
20182
|
writeFileSync11(
|
|
19962
|
-
|
|
20183
|
+
join42(tempDir, PLAN_V2_MATERIALIZATION_MARKER),
|
|
19963
20184
|
canonicalJsonStringify({
|
|
19964
20185
|
manifest,
|
|
19965
20186
|
target,
|
|
@@ -19982,7 +20203,7 @@ function materializePlanV2Target(planV2Dir, target, destinationDir, options = {}
|
|
|
19982
20203
|
// Join the artifact's OWN name, not the current constant: a plan written
|
|
19983
20204
|
// before the container change carries the legacy name, and materializing it
|
|
19984
20205
|
// under the new one would point at a file that was never written.
|
|
19985
|
-
audioPath: target.role === "assembler" ? audioArtifact ?
|
|
20206
|
+
audioPath: target.role === "assembler" ? audioArtifact ? join42(destinationDir, audioArtifact.path) : null : null
|
|
19986
20207
|
};
|
|
19987
20208
|
}
|
|
19988
20209
|
function assertRemoteSources(remoteSources, artifacts) {
|
|
@@ -20001,8 +20222,8 @@ function validatePlanV2MaterializedTarget(planDir, expectedTarget) {
|
|
|
20001
20222
|
return readValidatedPlanV2Materialization(planDir, expectedTarget)?.manifest ?? null;
|
|
20002
20223
|
}
|
|
20003
20224
|
function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
20004
|
-
const markerPath =
|
|
20005
|
-
if (!
|
|
20225
|
+
const markerPath = join42(planDir, PLAN_V2_MATERIALIZATION_MARKER);
|
|
20226
|
+
if (!existsSync28(markerPath)) return null;
|
|
20006
20227
|
const marker = readJsonFile(markerPath, "materialization marker");
|
|
20007
20228
|
if (!isRecord3(marker) || !isRecord3(marker.manifest) || !isRecord3(marker.target)) {
|
|
20008
20229
|
throw new PlanV2IntegrityError("malformed materialization marker");
|
|
@@ -20019,8 +20240,8 @@ function readValidatedPlanV2Materialization(planDir, expectedTarget) {
|
|
|
20019
20240
|
assertRemoteSources(remoteSources, required);
|
|
20020
20241
|
for (const artifact of required) {
|
|
20021
20242
|
if (Object.hasOwn(remoteSources, artifact.path)) continue;
|
|
20022
|
-
const path =
|
|
20023
|
-
if (!
|
|
20243
|
+
const path = join42(planDir, ...artifact.path.split("/"));
|
|
20244
|
+
if (!existsSync28(path) || statSync10(path).size !== artifact.sizeBytes) {
|
|
20024
20245
|
throw new PlanV2IntegrityError(
|
|
20025
20246
|
`materialized artifact missing or truncated: ${artifact.path}`
|
|
20026
20247
|
);
|
|
@@ -20150,7 +20371,7 @@ function hashChunkOutput(outputPath, kind) {
|
|
|
20150
20371
|
if (kind === "file") return sha256Hex(readFileSync12(outputPath));
|
|
20151
20372
|
const entries = readdirSync11(outputPath).filter((name) => /\.(png|jpg|jpeg)$/i.test(name)).sort();
|
|
20152
20373
|
const lines = entries.map(
|
|
20153
|
-
(name) => `${name}\0${sha256Hex(readFileSync12(
|
|
20374
|
+
(name) => `${name}\0${sha256Hex(readFileSync12(join43(outputPath, name)))}`
|
|
20154
20375
|
);
|
|
20155
20376
|
return sha256Hex(lines.join("\0"));
|
|
20156
20377
|
}
|
|
@@ -20167,10 +20388,10 @@ function resolveLockedVp9CpuUsed(lockedEncoder) {
|
|
|
20167
20388
|
async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
20168
20389
|
const start = Date.now();
|
|
20169
20390
|
const log = defaultLogger;
|
|
20170
|
-
const planJsonPath =
|
|
20171
|
-
const encoderJsonPath =
|
|
20172
|
-
const chunksJsonPath =
|
|
20173
|
-
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)) {
|
|
20174
20395
|
throw new RenderChunkValidationError(
|
|
20175
20396
|
MISSING_PLAN_ARTIFACT,
|
|
20176
20397
|
`[renderChunk] planDir is missing required artifact: ${planJsonPath}`
|
|
@@ -20186,7 +20407,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20186
20407
|
const v2Manifest = v2Materialization?.manifest ?? null;
|
|
20187
20408
|
const remoteSources = v2Materialization?.remoteSources ?? {};
|
|
20188
20409
|
for (const required of [encoderJsonPath, chunksJsonPath]) {
|
|
20189
|
-
if (!
|
|
20410
|
+
if (!existsSync29(required)) {
|
|
20190
20411
|
throw new RenderChunkValidationError(
|
|
20191
20412
|
MISSING_PLAN_ARTIFACT,
|
|
20192
20413
|
`[renderChunk] planDir is missing required artifact: ${required}`
|
|
@@ -20195,9 +20416,9 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20195
20416
|
}
|
|
20196
20417
|
const encoder = JSON.parse(readFileSync12(encoderJsonPath, "utf-8"));
|
|
20197
20418
|
const chunks = JSON.parse(readFileSync12(chunksJsonPath, "utf-8"));
|
|
20198
|
-
const videosJsonPath =
|
|
20419
|
+
const videosJsonPath = join43(planDir, PLAN_VIDEOS_META_RELATIVE_PATH);
|
|
20199
20420
|
let planVideos = null;
|
|
20200
|
-
if (
|
|
20421
|
+
if (existsSync29(videosJsonPath)) {
|
|
20201
20422
|
try {
|
|
20202
20423
|
planVideos = validatePlanVideosForChunk(JSON.parse(readFileSync12(videosJsonPath, "utf-8")));
|
|
20203
20424
|
} catch (err) {
|
|
@@ -20227,8 +20448,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20227
20448
|
}
|
|
20228
20449
|
const range = resolveChunkFrameRange(slice, chunkIndex, options?.frameRange);
|
|
20229
20450
|
const framesInChunk = range.endFrame - range.startFrame;
|
|
20230
|
-
const compiledDir =
|
|
20231
|
-
if (!
|
|
20451
|
+
const compiledDir = join43(planDir, "compiled");
|
|
20452
|
+
if (!existsSync29(compiledDir)) {
|
|
20232
20453
|
throw new RenderChunkValidationError(
|
|
20233
20454
|
MISSING_PLAN_ARTIFACT,
|
|
20234
20455
|
`[renderChunk] planDir missing compiled/ directory: ${compiledDir}`
|
|
@@ -20286,7 +20507,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20286
20507
|
};
|
|
20287
20508
|
const workDir = `${outputChunkPath}.work.${process.pid}.${randomBytes(4).toString("hex")}`;
|
|
20288
20509
|
mkdirSync17(workDir, { recursive: true });
|
|
20289
|
-
const framesDir =
|
|
20510
|
+
const framesDir = join43(workDir, "captured-frames");
|
|
20290
20511
|
mkdirSync17(framesDir, { recursive: true });
|
|
20291
20512
|
const videoFramesDir = `${workDir}.video-frames`;
|
|
20292
20513
|
const chunkFrameNumbers = Array.from({ length: framesInChunk }, (_, i) => range.startFrame + i);
|
|
@@ -20311,7 +20532,7 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20311
20532
|
dimensions: plan2.dimensions,
|
|
20312
20533
|
encoder,
|
|
20313
20534
|
videoCount: planVideos?.videos.length ?? 0,
|
|
20314
|
-
html: readFileSync12(
|
|
20535
|
+
html: readFileSync12(join43(compiledDir, "index.html"), "utf-8"),
|
|
20315
20536
|
// The plan ships a deferred source only to chunks that show it; don't wait on the rest.
|
|
20316
20537
|
skipReadinessVideoIds: deferredVideos.filter(
|
|
20317
20538
|
(video) => !shownFrames.get(video.videoId)?.size || remoteVideoIds.has(video.videoId)
|
|
@@ -20345,8 +20566,8 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20345
20566
|
const verifyInWorker = chunkWorkerCount > 1 && !forceScreenshotForChunk;
|
|
20346
20567
|
let boxesMeasured;
|
|
20347
20568
|
let boxesFailed;
|
|
20348
|
-
const boxesReady = new Promise((
|
|
20349
|
-
boxesMeasured =
|
|
20569
|
+
const boxesReady = new Promise((resolve12, reject) => {
|
|
20570
|
+
boxesMeasured = resolve12;
|
|
20350
20571
|
boxesFailed = reject;
|
|
20351
20572
|
});
|
|
20352
20573
|
boxesReady.catch(() => {
|
|
@@ -20480,10 +20701,10 @@ async function renderChunk(planDir, chunkIndex, outputChunkPath, options) {
|
|
|
20480
20701
|
const effectiveBitrate = encoder.crf != null ? void 0 : encoder.bitrate;
|
|
20481
20702
|
const videoOnlyPath = encoder.chunksCarryAudio ? `${outputChunkPath}.video.mp4` : outputChunkPath;
|
|
20482
20703
|
if (isPngSequence) {
|
|
20483
|
-
if (!
|
|
20704
|
+
if (!existsSync29(outputChunkPath)) mkdirSync17(outputChunkPath, { recursive: true });
|
|
20484
20705
|
} else {
|
|
20485
|
-
const outDir =
|
|
20486
|
-
if (!
|
|
20706
|
+
const outDir = join43(outputChunkPath, "..");
|
|
20707
|
+
if (!existsSync29(outDir)) mkdirSync17(outDir, { recursive: true });
|
|
20487
20708
|
}
|
|
20488
20709
|
const encodeInput = {
|
|
20489
20710
|
job,
|
|
@@ -20759,10 +20980,10 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20759
20980
|
if (config.cfr === true) {
|
|
20760
20981
|
throw new RenderSpanUnsupportedError("--start/--end cannot be combined with a cfr re-encode.");
|
|
20761
20982
|
}
|
|
20762
|
-
const workDir = mkdtempSync(
|
|
20983
|
+
const workDir = mkdtempSync(join44(tmpdir5(), "hf-render-span-"));
|
|
20763
20984
|
try {
|
|
20764
|
-
const planDir =
|
|
20765
|
-
const partsDir =
|
|
20985
|
+
const planDir = join44(workDir, "plan");
|
|
20986
|
+
const partsDir = join44(workDir, "parts");
|
|
20766
20987
|
mkdirSync18(partsDir, { recursive: true });
|
|
20767
20988
|
const planned = await plan(
|
|
20768
20989
|
projectDir,
|
|
@@ -20781,7 +21002,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20781
21002
|
planned.totalFrames
|
|
20782
21003
|
);
|
|
20783
21004
|
const slices = JSON.parse(
|
|
20784
|
-
readFileSync13(
|
|
21005
|
+
readFileSync13(join44(planDir, "meta", "chunks.json"), "utf-8")
|
|
20785
21006
|
);
|
|
20786
21007
|
const parts = [];
|
|
20787
21008
|
for (const slice of slices) {
|
|
@@ -20791,7 +21012,7 @@ async function renderSpan(projectDir, config, span, outputPath, options = {}) {
|
|
|
20791
21012
|
};
|
|
20792
21013
|
if (range.endFrame <= range.startFrame) continue;
|
|
20793
21014
|
throwIfAborted(config.abortSignal);
|
|
20794
|
-
const part =
|
|
21015
|
+
const part = join44(partsDir, `part-${String(parts.length).padStart(4, "0")}.mp4`);
|
|
20795
21016
|
await renderChunk(planDir, slice.index, part, { frameRange: range });
|
|
20796
21017
|
parts.push(part);
|
|
20797
21018
|
}
|
|
@@ -21406,7 +21627,7 @@ function renderRequestFromDistributedConfig(input) {
|
|
|
21406
21627
|
|
|
21407
21628
|
// ../producer/src/server.ts
|
|
21408
21629
|
import {
|
|
21409
|
-
existsSync as
|
|
21630
|
+
existsSync as existsSync32,
|
|
21410
21631
|
mkdirSync as mkdirSync19,
|
|
21411
21632
|
statSync as statSync12,
|
|
21412
21633
|
mkdtempSync as mkdtempSync2,
|
|
@@ -21414,8 +21635,8 @@ import {
|
|
|
21414
21635
|
rmSync as rmSync17,
|
|
21415
21636
|
createReadStream as createReadStream5
|
|
21416
21637
|
} from "fs";
|
|
21417
|
-
import { resolve as
|
|
21418
|
-
import { tmpdir as
|
|
21638
|
+
import { resolve as resolve11, dirname as dirname19, join as join47 } from "path";
|
|
21639
|
+
import { tmpdir as tmpdir6 } from "os";
|
|
21419
21640
|
import { parseArgs } from "util";
|
|
21420
21641
|
import { isIP } from "net";
|
|
21421
21642
|
import crypto from "crypto";
|
|
@@ -21425,7 +21646,7 @@ import { serve as serve2 } from "@hono/node-server";
|
|
|
21425
21646
|
|
|
21426
21647
|
// ../producer/src/services/hyperframeLint.ts
|
|
21427
21648
|
import {
|
|
21428
|
-
existsSync as
|
|
21649
|
+
existsSync as existsSync30,
|
|
21429
21650
|
readFileSync as readFileSync14,
|
|
21430
21651
|
statSync as statSync11,
|
|
21431
21652
|
openSync as openSync6,
|
|
@@ -21433,7 +21654,7 @@ import {
|
|
|
21433
21654
|
closeSync as closeSync6,
|
|
21434
21655
|
constants as constants3
|
|
21435
21656
|
} from "fs";
|
|
21436
|
-
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";
|
|
21437
21658
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
21438
21659
|
import { Worker as Worker2 } from "worker_threads";
|
|
21439
21660
|
function isStringRecord(value) {
|
|
@@ -21479,19 +21700,19 @@ function readEntryHtml(filePath) {
|
|
|
21479
21700
|
}
|
|
21480
21701
|
}
|
|
21481
21702
|
function leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry) {
|
|
21482
|
-
const entryRelativePath =
|
|
21483
|
-
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${
|
|
21703
|
+
const entryRelativePath = relative9(absProjectDir, absoluteEntryPath);
|
|
21704
|
+
return entryRelativePath === ".." || entryRelativePath.startsWith(`..${sep6}`) || isAbsolute5(entryRelativePath) || isAllowedEntry !== void 0 && !isAllowedEntry(absoluteEntryPath);
|
|
21484
21705
|
}
|
|
21485
21706
|
function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
21486
|
-
const absProjectDir =
|
|
21487
|
-
if (!
|
|
21707
|
+
const absProjectDir = resolve10(projectDir);
|
|
21708
|
+
if (!existsSync30(absProjectDir) || !statSync11(absProjectDir).isDirectory()) {
|
|
21488
21709
|
return { error: `Project directory not found: ${absProjectDir}` };
|
|
21489
21710
|
}
|
|
21490
21711
|
const entryCandidates = [preferredEntryFile, "index.html", "src/index.html"].filter(
|
|
21491
21712
|
(value) => typeof value === "string" && value.trim().length > 0
|
|
21492
21713
|
);
|
|
21493
21714
|
for (const entryFile of entryCandidates) {
|
|
21494
|
-
const absoluteEntryPath =
|
|
21715
|
+
const absoluteEntryPath = resolve10(absProjectDir, entryFile);
|
|
21495
21716
|
if (leavesProject(absProjectDir, absoluteEntryPath, isAllowedEntry)) {
|
|
21496
21717
|
return { error: `Entry file must stay inside project directory: ${entryFile}` };
|
|
21497
21718
|
}
|
|
@@ -21505,7 +21726,7 @@ function readProjectEntryFile(projectDir, preferredEntryFile, isAllowedEntry) {
|
|
|
21505
21726
|
}
|
|
21506
21727
|
}
|
|
21507
21728
|
return {
|
|
21508
|
-
error: `No HTML entry file found in project directory: ${
|
|
21729
|
+
error: `No HTML entry file found in project directory: ${join45(absProjectDir, preferredEntryFile || "index.html")}`
|
|
21509
21730
|
};
|
|
21510
21731
|
}
|
|
21511
21732
|
function prepareHyperframeLintBody(body, isAllowedEntry) {
|
|
@@ -21551,16 +21772,16 @@ function takeLintSlot(limit, waitMs) {
|
|
|
21551
21772
|
running++;
|
|
21552
21773
|
return Promise.resolve(true);
|
|
21553
21774
|
}
|
|
21554
|
-
return new Promise((
|
|
21775
|
+
return new Promise((resolve12) => {
|
|
21555
21776
|
const entry = () => {
|
|
21556
21777
|
clearTimeout(timer);
|
|
21557
21778
|
running++;
|
|
21558
|
-
|
|
21779
|
+
resolve12(true);
|
|
21559
21780
|
};
|
|
21560
21781
|
const timer = setTimeout(
|
|
21561
21782
|
() => {
|
|
21562
21783
|
waiting.splice(waiting.indexOf(entry), 1);
|
|
21563
|
-
|
|
21784
|
+
resolve12(false);
|
|
21564
21785
|
},
|
|
21565
21786
|
Math.max(0, waitMs)
|
|
21566
21787
|
);
|
|
@@ -21574,8 +21795,8 @@ function freeLintSlot() {
|
|
|
21574
21795
|
function resolveLintWorkerEntry() {
|
|
21575
21796
|
const here = dirname17(fileURLToPath5(import.meta.url));
|
|
21576
21797
|
for (const name of ["hyperframeLintWorker.js", "hyperframeLintWorker.ts"]) {
|
|
21577
|
-
const candidate =
|
|
21578
|
-
if (
|
|
21798
|
+
const candidate = join45(here, name);
|
|
21799
|
+
if (existsSync30(candidate)) return candidate;
|
|
21579
21800
|
}
|
|
21580
21801
|
return void 0;
|
|
21581
21802
|
}
|
|
@@ -21645,8 +21866,8 @@ async function runHyperframeLint(prepared, options = {}) {
|
|
|
21645
21866
|
// ../producer/src/services/healthWorker.ts
|
|
21646
21867
|
import { Worker as Worker3 } from "worker_threads";
|
|
21647
21868
|
import { fileURLToPath as fileURLToPath6 } from "url";
|
|
21648
|
-
import { dirname as dirname18, join as
|
|
21649
|
-
import { existsSync as
|
|
21869
|
+
import { dirname as dirname18, join as join46 } from "path";
|
|
21870
|
+
import { existsSync as existsSync31 } from "fs";
|
|
21650
21871
|
var DEFAULT_HEALTH_PORT = 9848;
|
|
21651
21872
|
async function startHealthWorker(options = {}) {
|
|
21652
21873
|
const log = options.logger ?? defaultLogger2();
|
|
@@ -21664,12 +21885,12 @@ async function startHealthWorker(options = {}) {
|
|
|
21664
21885
|
stdout: false,
|
|
21665
21886
|
stderr: false
|
|
21666
21887
|
});
|
|
21667
|
-
await new Promise((
|
|
21888
|
+
await new Promise((resolve12, reject) => {
|
|
21668
21889
|
const onMessage = (msg) => {
|
|
21669
21890
|
if (msg?.type === "listening") {
|
|
21670
21891
|
worker.off("error", onError);
|
|
21671
21892
|
worker.off("message", onMessage);
|
|
21672
|
-
|
|
21893
|
+
resolve12();
|
|
21673
21894
|
} else if (msg?.type === "listen-error") {
|
|
21674
21895
|
worker.off("error", onError);
|
|
21675
21896
|
worker.off("message", onMessage);
|
|
@@ -21721,9 +21942,9 @@ function defaultLogger2() {
|
|
|
21721
21942
|
}
|
|
21722
21943
|
function resolveWorkerEntry2() {
|
|
21723
21944
|
const here = dirname18(fileURLToPath6(import.meta.url));
|
|
21724
|
-
const candidates = [
|
|
21945
|
+
const candidates = [join46(here, "healthWorkerThread.js"), join46(here, "healthWorkerThread.ts")];
|
|
21725
21946
|
for (const candidate of candidates) {
|
|
21726
|
-
if (
|
|
21947
|
+
if (existsSync31(candidate)) return candidate;
|
|
21727
21948
|
}
|
|
21728
21949
|
return void 0;
|
|
21729
21950
|
}
|
|
@@ -21887,7 +22108,7 @@ function resolvePreparedRenderOutput(prepared, rendersDir, log, confineOutput) {
|
|
|
21887
22108
|
}
|
|
21888
22109
|
}
|
|
21889
22110
|
const outputDir = dirname19(absoluteOutputPath);
|
|
21890
|
-
if (!
|
|
22111
|
+
if (!existsSync32(outputDir)) mkdirSync19(outputDir, { recursive: true });
|
|
21891
22112
|
return { input, cleanupProjectDir, absoluteOutputPath };
|
|
21892
22113
|
}
|
|
21893
22114
|
function prepareRenderJob(prepared, rendersDir, log, confineOutput) {
|
|
@@ -21948,7 +22169,7 @@ function validateOutputResolutionOverride(body) {
|
|
|
21948
22169
|
var MAX_PREVIEW_HTML_BYTES = 20 * 1024 * 1024;
|
|
21949
22170
|
function resolveRenderRequestPolicy(options) {
|
|
21950
22171
|
return {
|
|
21951
|
-
projectsDir:
|
|
22172
|
+
projectsDir: resolve11(
|
|
21952
22173
|
options.projectsDir ?? (process.env.PRODUCER_PROJECTS_DIR || process.cwd())
|
|
21953
22174
|
),
|
|
21954
22175
|
allowDebug: options.allowDebug ?? process.env.PRODUCER_ALLOW_DEBUG === "1"
|
|
@@ -21963,14 +22184,14 @@ function isAllowedEntryPath(policy, projectDir, path) {
|
|
|
21963
22184
|
function prepareProjectDirectory(projectDir, options, policy) {
|
|
21964
22185
|
const candidate = nonEmptyString(projectDir);
|
|
21965
22186
|
if (!candidate) return null;
|
|
21966
|
-
const absProjectDir = policy ?
|
|
22187
|
+
const absProjectDir = policy ? resolve11(policy.projectsDir, candidate) : resolve11(candidate);
|
|
21967
22188
|
const shown = policy ? candidate : absProjectDir;
|
|
21968
|
-
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !
|
|
22189
|
+
if (policy && !isAllowedProjectPath(policy.projectsDir, absProjectDir) || !existsSync32(absProjectDir) || !statSync12(absProjectDir).isDirectory()) {
|
|
21969
22190
|
return { error: `Project directory not found: ${shown}` };
|
|
21970
22191
|
}
|
|
21971
22192
|
const entry = options.entryFile || "index.html";
|
|
21972
|
-
const entryPath =
|
|
21973
|
-
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !
|
|
22193
|
+
const entryPath = resolve11(absProjectDir, entry);
|
|
22194
|
+
if (policy && !isAllowedEntryPath(policy, absProjectDir, entryPath) || !existsSync32(entryPath)) {
|
|
21974
22195
|
return { error: `Entry file "${entry}" not found in project directory: ${shown}` };
|
|
21975
22196
|
}
|
|
21976
22197
|
return { prepared: { input: { projectDir: absProjectDir, ...options } } };
|
|
@@ -21990,9 +22211,9 @@ async function resolveInlineRenderHtml(body) {
|
|
|
21990
22211
|
}
|
|
21991
22212
|
}
|
|
21992
22213
|
function materializeInlineProject(html, options) {
|
|
21993
|
-
const tempRoot = process.env.PRODUCER_TMP_PROJECT_DIR ||
|
|
21994
|
-
const tempProjectDir = mkdtempSync2(
|
|
21995
|
-
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");
|
|
21996
22217
|
return {
|
|
21997
22218
|
prepared: {
|
|
21998
22219
|
input: { projectDir: tempProjectDir, ...options },
|
|
@@ -22020,7 +22241,7 @@ function resolveOutputPath(projectDir, outputCandidate, rendersDir, log) {
|
|
|
22020
22241
|
try {
|
|
22021
22242
|
return resolveRenderPaths(projectDir, outputCandidate, rendersDir).absoluteOutputPath;
|
|
22022
22243
|
} catch (error) {
|
|
22023
|
-
const fallbackPath =
|
|
22244
|
+
const fallbackPath = resolve11(rendersDir, `producer-fallback-${Date.now()}.mp4`);
|
|
22024
22245
|
log.warn("Failed to resolve output path, using fallback", {
|
|
22025
22246
|
fallback: fallbackPath,
|
|
22026
22247
|
error: error instanceof Error ? error.message : String(error)
|
|
@@ -22068,7 +22289,7 @@ function publicPerfSummary(job) {
|
|
|
22068
22289
|
return job.perfSummary ? { ...job.perfSummary, renderId: void 0 } : null;
|
|
22069
22290
|
}
|
|
22070
22291
|
function outputFileSize(path) {
|
|
22071
|
-
return
|
|
22292
|
+
return existsSync32(path) ? statSync12(path).size : 0;
|
|
22072
22293
|
}
|
|
22073
22294
|
function createBlockingProgressReporter(log, requestId) {
|
|
22074
22295
|
let lastLoggedPct = -10;
|
|
@@ -22188,7 +22409,7 @@ function createRenderHandlers(options = {}) {
|
|
|
22188
22409
|
const lintProjectDir = nonEmptyString(body.projectDir);
|
|
22189
22410
|
let isAllowedEntry;
|
|
22190
22411
|
if (policy && lintProjectDir) {
|
|
22191
|
-
const absProjectDir =
|
|
22412
|
+
const absProjectDir = resolve11(policy.projectsDir, lintProjectDir);
|
|
22192
22413
|
if (!isAllowedProjectPath(policy.projectsDir, absProjectDir)) {
|
|
22193
22414
|
const error = `Project directory not found: ${lintProjectDir}`;
|
|
22194
22415
|
return c.json({ success: false, requestId, error }, 400);
|
|
@@ -22395,7 +22616,7 @@ function createRenderHandlers(options = {}) {
|
|
|
22395
22616
|
if (!artifact) {
|
|
22396
22617
|
return c.json({ success: false, error: "Output artifact not found or expired" }, 404);
|
|
22397
22618
|
}
|
|
22398
|
-
if (!
|
|
22619
|
+
if (!existsSync32(artifact.path)) {
|
|
22399
22620
|
store.delete(token);
|
|
22400
22621
|
return c.json({ success: false, error: "Output artifact file missing" }, 404);
|
|
22401
22622
|
}
|
|
@@ -22536,7 +22757,7 @@ function startServer(options = {}) {
|
|
|
22536
22757
|
});
|
|
22537
22758
|
async function shutdown(signal) {
|
|
22538
22759
|
log.info(`Received ${signal}, shutting down`);
|
|
22539
|
-
const { drainBrowserPool } = await import("./src-
|
|
22760
|
+
const { drainBrowserPool } = await import("./src-COKNEXLI.js");
|
|
22540
22761
|
await drainBrowserPool().catch(() => {
|
|
22541
22762
|
});
|
|
22542
22763
|
const handle = await Promise.race([
|
|
@@ -22560,7 +22781,7 @@ function startServer(options = {}) {
|
|
|
22560
22781
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
22561
22782
|
return server;
|
|
22562
22783
|
}
|
|
22563
|
-
var entryScript = process.argv[1] ?
|
|
22784
|
+
var entryScript = process.argv[1] ? resolve11(process.argv[1]) : "";
|
|
22564
22785
|
var isPublicServerEntry = entryScript.endsWith("/public-server.js") || entryScript.endsWith("/src/server.ts");
|
|
22565
22786
|
if (isPublicServerEntry) {
|
|
22566
22787
|
const { values } = parseArgs({
|
|
@@ -22573,13 +22794,13 @@ if (isPublicServerEntry) {
|
|
|
22573
22794
|
|
|
22574
22795
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
22575
22796
|
import { mkdtempSync as mkdtempSync3, rmSync as rmSync19 } from "fs";
|
|
22576
|
-
import { tmpdir as
|
|
22577
|
-
import { join as
|
|
22797
|
+
import { tmpdir as tmpdir7 } from "os";
|
|
22798
|
+
import { join as join49 } from "path";
|
|
22578
22799
|
|
|
22579
22800
|
// ../producer/src/services/distributed/assemble.ts
|
|
22580
22801
|
import {
|
|
22581
22802
|
cpSync as cpSync3,
|
|
22582
|
-
existsSync as
|
|
22803
|
+
existsSync as existsSync33,
|
|
22583
22804
|
mkdirSync as mkdirSync20,
|
|
22584
22805
|
readFileSync as readFileSync15,
|
|
22585
22806
|
readdirSync as readdirSync12,
|
|
@@ -22587,7 +22808,7 @@ import {
|
|
|
22587
22808
|
statSync as statSync13,
|
|
22588
22809
|
writeFileSync as writeFileSync14
|
|
22589
22810
|
} from "fs";
|
|
22590
|
-
import { basename as
|
|
22811
|
+
import { basename as basename8, dirname as dirname20, join as join48 } from "path";
|
|
22591
22812
|
function cfrRateControlArgs(locked) {
|
|
22592
22813
|
const preset = getEncoderPreset(locked.quality ?? "standard", "mp4");
|
|
22593
22814
|
if (locked.crf == null && locked.bitrate) {
|
|
@@ -22620,10 +22841,10 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22620
22841
|
}
|
|
22621
22842
|
const format = plan2.dimensions.format;
|
|
22622
22843
|
const cfrEncoder = cfr ? readCfrEncoder(planDir, format) : null;
|
|
22623
|
-
if (!
|
|
22844
|
+
if (!existsSync33(dirname20(outputPath))) {
|
|
22624
22845
|
mkdirSync20(dirname20(outputPath), { recursive: true });
|
|
22625
22846
|
}
|
|
22626
|
-
const workDir = createStagingDir(dirname20(outputPath), `${
|
|
22847
|
+
const workDir = createStagingDir(dirname20(outputPath), `${basename8(outputPath)}.assemble-work-`);
|
|
22627
22848
|
const fps = { num: plan2.dimensions.fpsNum, den: plan2.dimensions.fpsDen };
|
|
22628
22849
|
const stageMs = {};
|
|
22629
22850
|
const ctx = {
|
|
@@ -22643,8 +22864,8 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22643
22864
|
};
|
|
22644
22865
|
try {
|
|
22645
22866
|
const videoSources = cfrEncoder ? [await reencodeCfr(ctx, chunkPaths, cfrEncoder)] : chunkPaths;
|
|
22646
|
-
const finalPath =
|
|
22647
|
-
const audio = audioPath !== null &&
|
|
22867
|
+
const finalPath = join48(workDir, `output.${format}`);
|
|
22868
|
+
const audio = audioPath !== null && existsSync33(audioPath) ? audioPath : null;
|
|
22648
22869
|
await writeJoined(ctx, videoSources, audio, finalPath);
|
|
22649
22870
|
renameWithRetry(finalPath, outputPath);
|
|
22650
22871
|
log.info("[assemble] stage timings", {
|
|
@@ -22662,7 +22883,7 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22662
22883
|
});
|
|
22663
22884
|
}
|
|
22664
22885
|
}
|
|
22665
|
-
const fileSize =
|
|
22886
|
+
const fileSize = existsSync33(outputPath) ? statSync13(outputPath).size : 0;
|
|
22666
22887
|
return {
|
|
22667
22888
|
...referenceBackgroundResult(plan2[REFERENCE_BACKGROUND_FIELD]),
|
|
22668
22889
|
outputPath,
|
|
@@ -22672,15 +22893,15 @@ async function assemble(planDir, chunkOutputs, audioPath, outputPath, options) {
|
|
|
22672
22893
|
};
|
|
22673
22894
|
}
|
|
22674
22895
|
function readAssemblePlan(planDir, chunkPaths) {
|
|
22675
|
-
const planJsonPath =
|
|
22676
|
-
const chunksJsonPath =
|
|
22677
|
-
if (!
|
|
22896
|
+
const planJsonPath = join48(planDir, "plan.json");
|
|
22897
|
+
const chunksJsonPath = join48(planDir, "meta", "chunks.json");
|
|
22898
|
+
if (!existsSync33(planJsonPath)) {
|
|
22678
22899
|
throw new Error(`[assemble] planDir missing plan.json: ${planJsonPath}`);
|
|
22679
22900
|
}
|
|
22680
22901
|
const plan2 = JSON.parse(readFileSync15(planJsonPath, "utf-8"));
|
|
22681
22902
|
readPlanProtocolV1(plan2, DISTRIBUTED_RENDER_CAPABILITIES.roles.assembler);
|
|
22682
22903
|
validatePlanV2MaterializedTarget(planDir, { role: "assembler" });
|
|
22683
|
-
if (!
|
|
22904
|
+
if (!existsSync33(chunksJsonPath)) {
|
|
22684
22905
|
throw new Error(`[assemble] planDir missing meta/chunks.json: ${chunksJsonPath}`);
|
|
22685
22906
|
}
|
|
22686
22907
|
const chunks = JSON.parse(readFileSync15(chunksJsonPath, "utf-8"));
|
|
@@ -22695,7 +22916,7 @@ function readAssemblePlan(planDir, chunkPaths) {
|
|
|
22695
22916
|
}
|
|
22696
22917
|
}
|
|
22697
22918
|
for (const path of chunkPaths.flat()) {
|
|
22698
|
-
if (!
|
|
22919
|
+
if (!existsSync33(path)) {
|
|
22699
22920
|
throw new Error(`[assemble] chunk path does not exist: ${path}`);
|
|
22700
22921
|
}
|
|
22701
22922
|
}
|
|
@@ -22724,7 +22945,7 @@ function cfrEncodeArgs(inputArgs, encoder, fpsArg) {
|
|
|
22724
22945
|
return args;
|
|
22725
22946
|
}
|
|
22726
22947
|
async function reencodeCfr(ctx, chunkPaths, encoder) {
|
|
22727
|
-
const cfrOutputPath =
|
|
22948
|
+
const cfrOutputPath = join48(ctx.workDir, `cfr.${ctx.format}`);
|
|
22728
22949
|
const cfrArgs = cfrEncodeArgs(videoInputArgs(ctx, chunkPaths), encoder, ctx.fpsArg);
|
|
22729
22950
|
appendRenderProvenanceArgs(cfrArgs, cfrOutputPath);
|
|
22730
22951
|
cfrArgs.push("-y", cfrOutputPath);
|
|
@@ -22751,7 +22972,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
22751
22972
|
);
|
|
22752
22973
|
return;
|
|
22753
22974
|
}
|
|
22754
|
-
const paddedAudioPath =
|
|
22975
|
+
const paddedAudioPath = join48(ctx.workDir, "audio-padded.m4a");
|
|
22755
22976
|
const padTrimResult = await ctx.timed(
|
|
22756
22977
|
"audioMs",
|
|
22757
22978
|
() => padOrTrimAudioToVideoFrameCount({
|
|
@@ -22791,7 +23012,7 @@ async function writeJoined(ctx, videoSources, audioPath, finalPath) {
|
|
|
22791
23012
|
}
|
|
22792
23013
|
}
|
|
22793
23014
|
function concatDemuxerInput(chunkPaths, workDir, fpsArg) {
|
|
22794
|
-
const listPath =
|
|
23015
|
+
const listPath = join48(workDir, "concat-list.txt");
|
|
22795
23016
|
const body = chunkPaths.map((path) => `file '${path.replace(/'/g, "'\\''")}'`).join("\n");
|
|
22796
23017
|
writeFileSync14(listPath, `${body}
|
|
22797
23018
|
`, "utf-8");
|
|
@@ -22829,12 +23050,12 @@ function stitchesSeparateAudio(planDir) {
|
|
|
22829
23050
|
return lockedAudio(planDir).separateAudio === true;
|
|
22830
23051
|
}
|
|
22831
23052
|
function planFormat(planDir) {
|
|
22832
|
-
const plan2 = JSON.parse(readFileSync15(
|
|
23053
|
+
const plan2 = JSON.parse(readFileSync15(join48(planDir, "plan.json"), "utf-8"));
|
|
22833
23054
|
return plan2.dimensions.format;
|
|
22834
23055
|
}
|
|
22835
23056
|
function lockedAudio(planDir) {
|
|
22836
|
-
const encoderJsonPath =
|
|
22837
|
-
if (!
|
|
23057
|
+
const encoderJsonPath = join48(planDir, "meta", "encoder.json");
|
|
23058
|
+
if (!existsSync33(encoderJsonPath)) return {};
|
|
22838
23059
|
return JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
|
|
22839
23060
|
}
|
|
22840
23061
|
function readCfrEncoder(planDir, format) {
|
|
@@ -22843,8 +23064,8 @@ function readCfrEncoder(planDir, format) {
|
|
|
22843
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.`
|
|
22844
23065
|
);
|
|
22845
23066
|
}
|
|
22846
|
-
const encoderJsonPath =
|
|
22847
|
-
if (!
|
|
23067
|
+
const encoderJsonPath = join48(planDir, "meta", "encoder.json");
|
|
23068
|
+
if (!existsSync33(encoderJsonPath)) {
|
|
22848
23069
|
throw new Error(`[assemble] planDir missing meta/encoder.json: ${encoderJsonPath}`);
|
|
22849
23070
|
}
|
|
22850
23071
|
const encoderJson = JSON.parse(readFileSync15(encoderJsonPath, "utf-8"));
|
|
@@ -22856,7 +23077,7 @@ function readCfrEncoder(planDir, format) {
|
|
|
22856
23077
|
return encoderJson;
|
|
22857
23078
|
}
|
|
22858
23079
|
function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, startTimeMs) {
|
|
22859
|
-
if (
|
|
23080
|
+
if (existsSync33(outputPath)) rmSync18(outputPath, { recursive: true, force: true });
|
|
22860
23081
|
mkdirSync20(outputPath, { recursive: true });
|
|
22861
23082
|
let globalIdx = 0;
|
|
22862
23083
|
for (const chunkDir of chunkPaths) {
|
|
@@ -22870,8 +23091,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22870
23091
|
throw new Error(`[assemble] png-sequence chunk has no frames: ${chunkDir}`);
|
|
22871
23092
|
}
|
|
22872
23093
|
for (const frame of frames) {
|
|
22873
|
-
const dst =
|
|
22874
|
-
cpSync3(
|
|
23094
|
+
const dst = join48(outputPath, formatExportFrameName(globalIdx, "png"));
|
|
23095
|
+
cpSync3(join48(chunkDir, frame), dst);
|
|
22875
23096
|
globalIdx += 1;
|
|
22876
23097
|
}
|
|
22877
23098
|
}
|
|
@@ -22880,14 +23101,14 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22880
23101
|
`[assemble] png-sequence frame count mismatch: merged ${globalIdx} frames vs plan.totalFrames=${totalFrames}. Using on-disk count.`
|
|
22881
23102
|
);
|
|
22882
23103
|
}
|
|
22883
|
-
if (audioPath !== null &&
|
|
22884
|
-
const sidecar =
|
|
23104
|
+
if (audioPath !== null && existsSync33(audioPath)) {
|
|
23105
|
+
const sidecar = join48(outputPath, MIXED_AUDIO_FILENAME);
|
|
22885
23106
|
cpSync3(audioPath, sidecar);
|
|
22886
23107
|
}
|
|
22887
23108
|
let fileSize = 0;
|
|
22888
23109
|
for (const name of readdirSync12(outputPath)) {
|
|
22889
23110
|
try {
|
|
22890
|
-
fileSize += statSync13(
|
|
23111
|
+
fileSize += statSync13(join48(outputPath, name)).size;
|
|
22891
23112
|
} catch {
|
|
22892
23113
|
}
|
|
22893
23114
|
}
|
|
@@ -22901,8 +23122,8 @@ function mergePngFrameDirs(chunkPaths, outputPath, totalFrames, audioPath, start
|
|
|
22901
23122
|
|
|
22902
23123
|
// ../producer/src/services/distributed/planV2Execution.ts
|
|
22903
23124
|
async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
22904
|
-
const workRoot = mkdtempSync3(
|
|
22905
|
-
const materializedPlanDir =
|
|
23125
|
+
const workRoot = mkdtempSync3(join49(tmpdir7(), "hf-plan-v2-chunk-"));
|
|
23126
|
+
const materializedPlanDir = join49(workRoot, "plan");
|
|
22906
23127
|
try {
|
|
22907
23128
|
materializePlanV2Target(planV2Dir, { role: "chunk", chunkIndex }, materializedPlanDir);
|
|
22908
23129
|
return await renderChunk(materializedPlanDir, chunkIndex, outputChunkPath, options);
|
|
@@ -22911,8 +23132,8 @@ async function renderChunkV2(planV2Dir, chunkIndex, outputChunkPath, options) {
|
|
|
22911
23132
|
}
|
|
22912
23133
|
}
|
|
22913
23134
|
async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
22914
|
-
const workRoot = mkdtempSync3(
|
|
22915
|
-
const materializedPlanDir =
|
|
23135
|
+
const workRoot = mkdtempSync3(join49(tmpdir7(), "hf-plan-v2-assembler-"));
|
|
23136
|
+
const materializedPlanDir = join49(workRoot, "plan");
|
|
22916
23137
|
try {
|
|
22917
23138
|
const materialized = materializePlanV2Target(
|
|
22918
23139
|
planV2Dir,
|
|
@@ -22934,7 +23155,7 @@ async function assembleV2(planV2Dir, chunkPaths, outputPath, options) {
|
|
|
22934
23155
|
// ../producer/src/services/distributed/projectHash.ts
|
|
22935
23156
|
import { closeSync as closeSync7, openSync as openSync7, readdirSync as readdirSync13, readSync as readSync5, realpathSync as realpathSync2, statSync as statSync14 } from "fs";
|
|
22936
23157
|
import { createHash as createHash8 } from "crypto";
|
|
22937
|
-
import { join as
|
|
23158
|
+
import { join as join50, sep as sep7 } from "path";
|
|
22938
23159
|
var READ_CHUNK_BYTES = 256 * 1024;
|
|
22939
23160
|
|
|
22940
23161
|
// ../producer/src/services/distributed/audioSidecar.ts
|
|
@@ -22950,6 +23171,7 @@ export {
|
|
|
22950
23171
|
defaultLogger,
|
|
22951
23172
|
createFileServer,
|
|
22952
23173
|
normalizeErrorMessage,
|
|
23174
|
+
missingPathOf,
|
|
22953
23175
|
RENDER_JOB_DIR,
|
|
22954
23176
|
createOwnedRenderDir,
|
|
22955
23177
|
listAbandonedRenderDirs,
|