hyperframes 0.8.225 → 0.8.227
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-ZGNY2AXJ.js → add-XX23UL2L.js} +12 -12
- package/dist/{agentPromptGenerator-GG4FFZH7.js → agentPromptGenerator-IMNWTMHM.js} +7 -7
- package/dist/{animatedGifPrep-NVDUG2CD.js → animatedGifPrep-MPU6T26Y.js} +7 -7
- package/dist/api.d.ts +122 -1
- package/dist/api.js +31 -23
- package/dist/{asset-UC3OQBB3.js → asset-FZSKOSMO.js} +2 -2
- package/dist/{assetCataloger-WQTNJMZU.js → assetCataloger-SITUNOV5.js} +8 -8
- package/dist/{audio-T6RWZHAA.js → audio-T5RHG57J.js} +17 -17
- package/dist/{auth-FSXEGF3B.js → auth-CMGIWJ6S.js} +5 -5
- package/dist/{autoUpdate-LOBHDWAA.js → autoUpdate-NNHBVLHN.js} +2 -2
- package/dist/{backgroundChecks-RBFWIWBP.js → backgroundChecks-HQYOBCV2.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-LDZ6NO2X.js → batchRender-5URYGOLM.js} +3 -3
- package/dist/{beats-WFPPVM6N.js → beats-J7IBNLP4.js} +10 -10
- package/dist/{benchmark-7MYD5S26.js → benchmark-Q2BILDRB.js} +9 -9
- package/dist/{billing-2BJTLFDX.js → billing-WNOAP6KO.js} +4 -4
- package/dist/{browser-6C4IDYQE.js → browser-EERGHDRV.js} +4 -4
- package/dist/{bundleWithLocalizedFonts-ARTT664T.js → bundleWithLocalizedFonts-FKU44QSO.js} +2 -2
- package/dist/{capture-7TFC65RN.js → capture-5W7BR36Q.js} +3 -3
- package/dist/{capture-TWZ5DQHP.js → capture-IRJ7DO45.js} +17 -17
- package/dist/{captureCompositionFrame-EMP6R3F6.js → captureCompositionFrame-R4LFCHHV.js} +14 -13
- package/dist/{catalog-W4RJO4FE.js → catalog-IRFBKRFP.js} +12 -12
- package/dist/{catch-up-OOCJH3O6.js → catch-up-RGQAFA3E.js} +5 -5
- package/dist/{check-BPPHG2CF.js → check-EXLZVGDY.js} +40 -39
- package/dist/{checkAudio-QEGCKX2V.js → checkAudio-K3XKXNEN.js} +10 -10
- package/dist/{checkBrowser-4JDYYAVA.js → checkBrowser-ZOU5XFMN.js} +34 -33
- package/dist/chunk-262C25DQ.js +31 -0
- package/dist/{chunk-3XQQLL3G.js → chunk-27JEDDX5.js} +1 -1
- package/dist/{chunk-AKMY4QVI.js → chunk-2GTFW4MK.js} +9 -1
- package/dist/{chunk-EECV7SDN.js → chunk-2M6LMJ32.js} +1 -1
- package/dist/{chunk-G45NYKSM.js → chunk-3TWAMQF6.js} +3 -3
- package/dist/{chunk-BEMGUGGJ.js → chunk-3ZWUNOTS.js} +1 -1
- package/dist/{chunk-Z7GIHPAZ.js → chunk-53ZOVLGJ.js} +2 -2
- package/dist/{chunk-G6Z47UQP.js → chunk-5ETFQB5F.js} +49 -31
- package/dist/{chunk-ZGQC6IU7.js → chunk-62LATJB6.js} +1 -1
- package/dist/{chunk-KDF67KEB.js → chunk-65LMGFJ5.js} +13 -13
- package/dist/{chunk-SVGHIMPQ.js → chunk-6HPCEV3U.js} +2 -2
- package/dist/{chunk-VLA6UJGH.js → chunk-6NJVSTSY.js} +5 -6
- package/dist/{chunk-VHL26GNQ.js → chunk-6PQXDPKV.js} +2 -2
- package/dist/{chunk-T5KG6H6L.js → chunk-6RSOEYIG.js} +7 -7
- package/dist/{chunk-5HGS5MGD.js → chunk-6TXW6LHH.js} +339 -136
- package/dist/{chunk-IJWDVOIO.js → chunk-7XNMKKXI.js} +2 -2
- package/dist/{chunk-SIYDHVN2.js → chunk-A3UIADPB.js} +1 -1
- package/dist/{chunk-X5BSSPC2.js → chunk-AI6Z7BVD.js} +1 -1
- package/dist/{chunk-BKHBSFEO.js → chunk-AJREH4PX.js} +3 -2
- package/dist/{chunk-GI42ZB52.js → chunk-AQ2C6AQH.js} +1 -1
- package/dist/{chunk-UZ5AWZCA.js → chunk-AXRFHQRS.js} +1 -1
- package/dist/{chunk-WQCVZEXH.js → chunk-BKK57WEL.js} +6 -6
- package/dist/{chunk-5I6XEO4W.js → chunk-BW3CQT3A.js} +3 -25
- package/dist/{chunk-W464PHF3.js → chunk-CQKK7S4I.js} +7 -7
- package/dist/{chunk-2YZD6CAF.js → chunk-E2GNVQSH.js} +10 -3
- package/dist/{chunk-652ERUZD.js → chunk-FD7Z5BDR.js} +2 -2
- package/dist/{chunk-UQWOOANM.js → chunk-FFCQR7AP.js} +2 -2
- package/dist/{chunk-AMQFGICP.js → chunk-GIGZYW5Q.js} +1 -1
- package/dist/{chunk-HT3D5AKG.js → chunk-GR2T3BOX.js} +6 -5
- package/dist/{chunk-LWTT7I7X.js → chunk-HGEFDPRP.js} +1 -1
- package/dist/{chunk-HW6HTTBZ.js → chunk-HNB7DA2F.js} +1 -1
- package/dist/{chunk-R6JPOEDZ.js → chunk-IN2355UQ.js} +1 -1
- package/dist/{chunk-EIIMWDZW.js → chunk-IQFLDX7I.js} +4 -4
- package/dist/{chunk-GE4ABM5K.js → chunk-ISEHEDSN.js} +41 -12
- package/dist/{chunk-RDLJSUI4.js → chunk-IUQCPWHU.js} +17 -11
- package/dist/{chunk-FJ3KUOUZ.js → chunk-IZRC24DI.js} +1 -1
- package/dist/{chunk-LZB5AHFD.js → chunk-JP6C673M.js} +1 -1
- package/dist/{chunk-OZMZFJDW.js → chunk-K6YHKCVX.js} +1 -1
- package/dist/{chunk-CGX4EOGT.js → chunk-K7LS42XC.js} +3 -3
- package/dist/{chunk-7RTPHNOO.js → chunk-KLTD64CP.js} +7 -4
- package/dist/{chunk-E47ZWDMH.js → chunk-KU6VRNJF.js} +1 -1
- package/dist/{chunk-KVBOJJ5R.js → chunk-L2XYH5SQ.js} +1 -1
- package/dist/{chunk-XM5KYLIE.js → chunk-M63U54H7.js} +4 -4
- package/dist/{chunk-4K6AS5TX.js → chunk-MBS45ZKL.js} +313 -149
- package/dist/{chunk-5KADQQ6S.js → chunk-MR7I3L6N.js} +1 -1
- package/dist/{chunk-FPWCICAI.js → chunk-NFUJ35XX.js} +1 -1
- package/dist/{chunk-35NDLXHZ.js → chunk-NQ4MVBNC.js} +10 -10
- package/dist/{chunk-PICDT6ZW.js → chunk-OG3S6SE6.js} +1 -1
- package/dist/{chunk-GZPGTGRV.js → chunk-OJW6TC57.js} +1 -1
- package/dist/{chunk-Z57RQBIA.js → chunk-OVLO32XC.js} +3 -3
- package/dist/{chunk-HMS6UHUW.js → chunk-OWJTWCE6.js} +2 -2
- package/dist/{chunk-M3WOI7BU.js → chunk-PFGBFTNS.js} +1 -1
- package/dist/{chunk-ACUVSKUI.js → chunk-PSRFHITV.js} +13 -13
- package/dist/{chunk-2EH3WQCS.js → chunk-PVLG6IY4.js} +5 -5
- package/dist/chunk-PXH3TD4X.js +760 -0
- package/dist/{chunk-Y5OSQXGZ.js → chunk-Q7S4JN73.js} +5 -5
- package/dist/{chunk-K73PYNON.js → chunk-QSWUM7WR.js} +2 -5
- package/dist/{chunk-EQFDOQTG.js → chunk-RABQDJMA.js} +1 -1
- package/dist/{chunk-ADOBHVHW.js → chunk-RG7WG2BC.js} +2 -2
- package/dist/{chunk-4Z2SU2VC.js → chunk-RVKHNBJI.js} +18 -18
- package/dist/{chunk-BTDKWWND.js → chunk-SANQC4QD.js} +1 -1
- package/dist/chunk-SBQV5FLG.js +5030 -0
- package/dist/{chunk-4VTXUGDR.js → chunk-SPN4SJV7.js} +1 -1
- package/dist/chunk-SQJNSPL5.js +177 -0
- package/dist/{chunk-4A643C3B.js → chunk-SZVMN7L3.js} +7 -7
- package/dist/{chunk-IB7I5IEC.js → chunk-T53C5UTH.js} +1 -1
- package/dist/{chunk-KEDN4LSV.js → chunk-TFJSU4IV.js} +2 -2
- package/dist/{chunk-UBH2R663.js → chunk-TG5RBLCM.js} +2 -2
- package/dist/{chunk-CXVFPIOM.js → chunk-TJ6G325N.js} +1 -1
- package/dist/{chunk-UBXKKXXR.js → chunk-TJPZYMYX.js} +3 -3
- package/dist/{chunk-M4NN4AHH.js → chunk-TMTZ5M4R.js} +9 -9
- package/dist/{chunk-RR5QE7DB.js → chunk-TNPFF5TQ.js} +18 -14
- package/dist/{chunk-AF3EN5XS.js → chunk-UIDZKSF6.js} +1 -1
- package/dist/{chunk-QOYZ3U6G.js → chunk-V4SD6HQ6.js} +2 -3
- package/dist/{chunk-EEBIHQF2.js → chunk-V7BBBD5C.js} +2 -2
- package/dist/{chunk-SXHSNLEC.js → chunk-VHREBR3T.js} +1 -1
- package/dist/chunk-VO55NLTM.js +111 -0
- package/dist/{chunk-IORJ42GY.js → chunk-VUDMPRZN.js} +5 -6
- package/dist/{chunk-3HRQI6LJ.js → chunk-WISN2ACZ.js} +1 -1
- package/dist/{chunk-7HSV5SJ4.js → chunk-XOFJZ3UG.js} +1 -1
- package/dist/{chunk-UCPEABYK.js → chunk-XZULISH5.js} +2 -2
- package/dist/{chunk-3E2BO3L3.js → chunk-YKOHWGUC.js} +1 -1
- package/dist/{chunk-A25SCSOK.js → chunk-YTMWGLEQ.js} +1 -1
- package/dist/{chunk-6IV2N527.js → chunk-ZAE5Q7D5.js} +2 -2
- package/dist/{chunk-O3MGHHJO.js → chunk-ZSZKNGSQ.js} +3 -3
- package/dist/{chunk-NLELDFX7.js → chunk-ZU5GYVRG.js} +3 -3
- package/dist/{clean-XWDDXLRP.js → clean-IXG2MEQ6.js} +18 -18
- package/dist/cli.js +57 -57
- package/dist/{cloud-SETWVGKH.js → cloud-C2SUZ4ML.js} +4 -4
- package/dist/{cloudrun-RHPVVXCR.js → cloudrun-SWS7AI67.js} +4 -4
- package/dist/{compare-FWMFV7A7.js → compare-HKONJNY4.js} +31 -30
- package/dist/{compiler-SKRY6FPA.js → compiler-67X7VCNS.js} +4 -4
- package/dist/{component-HGEIXY3U.js → component-YBGAFPNS.js} +3 -3
- package/dist/{compositions-2TXJLBWE.js → compositions-B5T65NKW.js} +12 -12
- package/dist/{curve-SSFKIA2L.js → curve-QZCRRLBS.js} +11 -11
- package/dist/{cuts-BWXHTOOP.js → cuts-5DIKHPDZ.js} +20 -15
- package/dist/{delete-F5RDWZEJ.js → delete-GHNNYUXL.js} +6 -6
- package/dist/{deploy-OH4SMYTG.js → deploy-IARSTZY6.js} +1 -1
- package/dist/{describeProject-B7H4T5PW.js → describeProject-6DA3FMM2.js} +8 -8
- package/dist/{diff-6JFFTFKR.js → diff-JWNEN6CO.js} +89 -229
- package/dist/{dist-YEYUGCOR.js → dist-AY2X5DPM.js} +2 -2
- package/dist/{dist-24QQO5IL.js → dist-DCP77RWC.js} +2 -2
- package/dist/{doctor-XQCZB5BY.js → doctor-BMUGN4C2.js} +11 -11
- package/dist/{energy-MEMYSTFT.js → energy-DSK2FPBK.js} +12 -12
- package/dist/{events-T7OLH6MW.js → events-6VLVSDSN.js} +4 -4
- package/dist/{events-U6PXJI34.js → events-HD5CYSPO.js} +3 -3
- package/dist/{events-ZU2ATKWK.js → events-KKH2U7U5.js} +14 -14
- package/dist/{extract-25TUTGCA.js → extract-IFMYI2DA.js} +15 -19
- package/dist/{face-KMLYOE5H.js → face-JD2ZVOH3.js} +12 -12
- package/dist/{feedback-FE7GQTBH.js → feedback-LI55MDGG.js} +14 -14
- package/dist/{ffmpeg-CXYPYIZK.js → ffmpeg-A4M2I6R3.js} +7 -7
- package/dist/{figma-QMKU7M7T.js → figma-CNVJZ7BL.js} +3 -3
- package/dist/fontLocalizeCli.js +10 -10
- package/dist/{frames-2NPBO6LB.js → frames-MOAPFEBS.js} +13 -13
- package/dist/{generate-I6E3V7PU.js → generate-ZRQYOJ3I.js} +18 -18
- package/dist/{get-JJWBP5NB.js → get-2RNNB5KC.js} +6 -6
- package/dist/{gpuPolicy-2OMDU74V.js → gpuPolicy-MXPGQGRO.js} +7 -7
- package/dist/{grade-compare-QCA3VIKQ.js → grade-compare-CQHZR7LX.js} +32 -31
- package/dist/{heifImagePrep-P53GG4GF.js → heifImagePrep-PRXKTL2U.js} +8 -8
- package/dist/{help-COSONWFD.js → help-MDT2MEPS.js} +1 -1
- package/dist/{history-CWKF5AXI.js → history-N7H2FN6R.js} +8 -8
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-SD74Y6V5.js → info-NXYRDRHE.js} +8 -8
- package/dist/{init-XAYQNTVF.js → init-DJ5EJAQI.js} +28 -28
- package/dist/ink-WZSITVIW.js +148 -0
- package/dist/{inspect-Y5IIQBIW.js → inspect-JAXBBYA3.js} +32 -31
- package/dist/{installer-NQA4KXRP.js → installer-N5OHXI5C.js} +4 -4
- package/dist/{keyframes-MNPCJZYU.js → keyframes-TXNYBMOV.js} +8 -8
- package/dist/{lambda-PMI6IDVN.js → lambda-4LVII6VK.js} +11 -11
- package/dist/{layout-6IM6R6LX.js → layout-AS4FJ53O.js} +32 -31
- package/dist/{lint-6VUHVHFF.js → lint-DCAYD4CN.js} +9 -9
- package/dist/{lintProject-6H64SX3V.js → lintProject-54CNQ4HT.js} +2 -2
- package/dist/{list-XXTAS744.js → list-7Z6YRO6I.js} +6 -6
- package/dist/{localPage-2UHUS6LM.js → localPage-FUOBAMSA.js} +7 -7
- package/dist/{login-KM3LPYQ7.js → login-JZ4COLEB.js} +7 -7
- package/dist/{logout-LHTQV2BZ.js → logout-6CEIH4HW.js} +3 -3
- package/dist/{look-3CD3ZSXY.js → look-QELVFTKU.js} +12 -12
- package/dist/{manager-C6GVT3EI.js → manager-ZJPSMHK6.js} +8 -8
- package/dist/{measure-DWZX4YAK.js → measure-2I5VAVHN.js} +12 -11
- package/dist/{media-treatment-IIUPGQIX.js → media-treatment-MDTQ6564.js} +14 -14
- package/dist/{media-use-HLHUEFDK.js → media-use-NFGRWEGA.js} +3 -3
- package/dist/{models-IWHY5V6N.js → models-DKSUFPQ6.js} +11 -11
- package/dist/{motionShot-4NKHFUS7.js → motionShot-BJARRLMN.js} +17 -16
- package/dist/{normalize-audio-M2RS5Q23.js → normalize-audio-EW5JUESE.js} +10 -10
- package/dist/{open-U7CCHUBO.js → open-737GUSFD.js} +13 -13
- package/dist/{parakeetRunner-ZHG3S6GY.js → parakeetRunner-OIVHACYW.js} +12 -12
- package/dist/{pipeline-66JR7EC7.js → pipeline-UTNPWFMF.js} +10 -10
- package/dist/{play-5COR53D2.js → play-ZCYUVL2Y.js} +22 -22
- package/dist/{preflight-OKAO5NPW.js → preflight-HWFWGTIG.js} +8 -8
- package/dist/{present-YKFQC22R.js → present-AO3XZKSL.js} +18 -18
- package/dist/{preview-3YNKJZME.js → preview-ORIRMNIU.js} +20 -20
- package/dist/{probe-QMPDGKU5.js → probe-HYO2KC2E.js} +11 -11
- package/dist/{producer-WBVDP3IV.js → producer-B4VCP4D2.js} +1 -1
- package/dist/{projectConfig-UI4NZDN7.js → projectConfig-HUR4LZME.js} +6 -6
- package/dist/{publication-VPJZQCLA.js → publication-YH74GUD4.js} +2 -2
- package/dist/{publish-7RA2MK2M.js → publish-WIEB5ON4.js} +25 -25
- package/dist/{refresh-AM2ULRRV.js → refresh-MQTO43RB.js} +3 -3
- package/dist/{remove-background-ELC7V7KT.js → remove-background-NHLEPVOM.js} +11 -11
- package/dist/{render-WH7MPRZD.js → render-3WFVN7HO.js} +45 -43
- package/dist/{render-R7E7TTNE.js → render-DQSNIKEG.js} +59 -759
- package/dist/{render-IYV73CG6.js → render-GBJSUM3R.js} +5 -5
- package/dist/{render-batch-IN2ZXPS7.js → render-batch-YZF2XMYL.js} +8 -8
- package/dist/renderSetupWorker.js +2 -2
- package/dist/{resolver-DIXFK5ZR.js → resolver-KGTY7RJU.js} +4 -4
- package/dist/{run-MCVU7AZX.js → run-OJ2GBYKB.js} +4 -4
- package/dist/{sherpa-FP6HX5KK.js → sherpa-B3T3I2PX.js} +11 -11
- package/dist/skills/media-use/audio/scripts/lib/heygen.mjs +3 -9
- package/dist/skills/media-use/audio/scripts/lib/heygen.test.mjs +6 -4
- package/dist/skills/media-use/references/heygen.md +2 -1
- package/dist/skills/media-use/scripts/lib/logo-provider.mjs +8 -3
- package/dist/skills/media-use/scripts/lib/logo-provider.test.mjs +14 -0
- package/dist/skills/media-use/scripts/resolve.mjs +11 -5
- package/dist/{skills-JLNDM2KP.js → skills-FATGE2YZ.js} +6 -6
- package/dist/{skillsUpdateCheck-WS5M25TN.js → skillsUpdateCheck-AHDI2POI.js} +3 -3
- package/dist/{snapshot-VPN6GA7U.js → snapshot-SELBWDZ7.js} +68 -43
- package/dist/{src-RGQFYVHO.js → src-55VXHZM5.js} +9 -9
- package/dist/{src-AP7B27MZ.js → src-6H4ENHBH.js} +10 -6
- package/dist/{staticProjectServer-YA6XOSFY.js → staticProjectServer-E4BZ4YZO.js} +18 -18
- package/dist/{status-Y5ZBFJ53.js → status-6WAZ5EBM.js} +5 -5
- package/dist/studio/assets/{hyperframes-player-Do2ZF6Lp.js → hyperframes-player-merzSkao.js} +3 -3
- package/dist/studio/assets/{index-CK4_IJ8G.js → index-B4XEg_n-.js} +1 -1
- package/dist/studio/assets/{index-Dxb7fTWf.js → index-DoXOJGW5.js} +174 -174
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-57E36S5N.js → studio-api-IERYGFXT.js} +10 -10
- package/dist/{studioServer-EVMF3HHL.js → studioServer-3RCCQB3T.js} +51 -50
- package/dist/{sync-ASUBSVGQ.js → sync-VV7L5GRE.js} +12 -12
- package/dist/{telemetry-YON45KT4.js → telemetry-KZRSFUC6.js} +4 -4
- package/dist/{timeline-OQWDGV7L.js → timeline-ALU6E3WE.js} +20 -20
- package/dist/{tokens-NMPY673W.js → tokens-XEZF2LGB.js} +2 -2
- package/dist/{transcribe-HSYXT5TZ.js → transcribe-HJX65J5D.js} +10 -10
- package/dist/{transcribe-C6FKVSRR.js → transcribe-OVOOUYK7.js} +22 -22
- package/dist/{updateCheck-B7PAAPCJ.js → updateCheck-FEOJQNLJ.js} +2 -2
- package/dist/{upgrade-BOECDD5S.js → upgrade-VM2DGLXZ.js} +2 -2
- package/dist/{urlDownloader-KC2SS457.js → urlDownloader-YENOMQQF.js} +6 -6
- package/dist/{validate-LEEBUIIH.js → validate-HXTL5C7J.js} +26 -25
- package/dist/{video-JJAEISDH.js → video-3BIRQK2N.js} +8 -8
- package/dist/warmCheck.js +40 -39
- package/package.json +1 -1
- package/dist/chunk-6UWSEXQ3.js +0 -5030
- package/dist/chunk-TRPNLI6V.js +0 -71
|
@@ -14,25 +14,12 @@ import {
|
|
|
14
14
|
createCloudClient,
|
|
15
15
|
pollUntilTerminal,
|
|
16
16
|
reportApiError
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-XOFJZ3UG.js";
|
|
18
18
|
import {
|
|
19
19
|
uploadAssetViaDirectUpload,
|
|
20
20
|
uploadZipViaDirectUpload
|
|
21
21
|
} from "./chunk-CE7EQUBV.js";
|
|
22
22
|
import "./chunk-6A45RKAK.js";
|
|
23
|
-
import {
|
|
24
|
-
TEXT_FILE_EXTS,
|
|
25
|
-
assertUnchanged,
|
|
26
|
-
readChecked,
|
|
27
|
-
readStaged,
|
|
28
|
-
rewriteCssUrls,
|
|
29
|
-
rewriteHtmlAttributes,
|
|
30
|
-
rewriteStyleBlocks,
|
|
31
|
-
stagePublishFiles,
|
|
32
|
-
stagedSize,
|
|
33
|
-
zipPublishFileMap
|
|
34
|
-
} from "./chunk-IORJ42GY.js";
|
|
35
|
-
import "./chunk-Z7GIHPAZ.js";
|
|
36
23
|
import {
|
|
37
24
|
compositionEntryErrorMessage,
|
|
38
25
|
parseCompositionEntryArg
|
|
@@ -46,26 +33,35 @@ import {
|
|
|
46
33
|
reportVariableIssues,
|
|
47
34
|
resolveVariablesArg,
|
|
48
35
|
validateVariablesAgainstProject
|
|
49
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-AXRFHQRS.js";
|
|
50
37
|
import "./chunk-ZBAF6L74.js";
|
|
38
|
+
import {
|
|
39
|
+
OFFLOAD_MIN_BYTES,
|
|
40
|
+
offloadHeavyMedia
|
|
41
|
+
} from "./chunk-PXH3TD4X.js";
|
|
51
42
|
import {
|
|
52
43
|
downloadToFile
|
|
53
44
|
} from "./chunk-NO6F7CLR.js";
|
|
54
45
|
import {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
46
|
+
readStaged,
|
|
47
|
+
stagePublishFiles,
|
|
48
|
+
stagedSize,
|
|
49
|
+
zipPublishFileMap
|
|
50
|
+
} from "./chunk-VUDMPRZN.js";
|
|
51
|
+
import "./chunk-53ZOVLGJ.js";
|
|
61
52
|
import {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
resolveCloudBaseUrl
|
|
54
|
+
} from "./chunk-3ZWUNOTS.js";
|
|
55
|
+
import "./chunk-V4SD6HQ6.js";
|
|
56
|
+
import "./chunk-SWC3QIEH.js";
|
|
57
|
+
import "./chunk-NFUJ35XX.js";
|
|
66
58
|
import {
|
|
67
59
|
resolveProject
|
|
68
|
-
} from "./chunk-
|
|
60
|
+
} from "./chunk-UIDZKSF6.js";
|
|
61
|
+
import {
|
|
62
|
+
resolveDefaultFpsArg
|
|
63
|
+
} from "./chunk-BW3CQT3A.js";
|
|
64
|
+
import "./chunk-AI6Z7BVD.js";
|
|
69
65
|
import {
|
|
70
66
|
errorBox,
|
|
71
67
|
formatBytes,
|
|
@@ -73,11 +69,11 @@ import {
|
|
|
73
69
|
} from "./chunk-5LOZWO2M.js";
|
|
74
70
|
import "./chunk-EHZESMRB.js";
|
|
75
71
|
import "./chunk-A4ZTSQLW.js";
|
|
76
|
-
import "./chunk-
|
|
77
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-OG3S6SE6.js";
|
|
73
|
+
import "./chunk-RG7WG2BC.js";
|
|
78
74
|
import "./chunk-PXVQOMKL.js";
|
|
79
75
|
import "./chunk-MCDNAIFF.js";
|
|
80
|
-
import "./chunk-
|
|
76
|
+
import "./chunk-6NJVSTSY.js";
|
|
81
77
|
import {
|
|
82
78
|
defineCommand
|
|
83
79
|
} from "./chunk-DL4OD7IA.js";
|
|
@@ -86,17 +82,15 @@ import "./chunk-54HJ63Q2.js";
|
|
|
86
82
|
import {
|
|
87
83
|
c
|
|
88
84
|
} from "./chunk-2GICKZ3I.js";
|
|
89
|
-
import "./chunk-
|
|
85
|
+
import "./chunk-6TXW6LHH.js";
|
|
90
86
|
import "./chunk-Z5J67X44.js";
|
|
91
87
|
import "./chunk-5S7W3TUO.js";
|
|
92
88
|
import "./chunk-D3MUHMFG.js";
|
|
93
|
-
import "./chunk-
|
|
89
|
+
import "./chunk-KLTD64CP.js";
|
|
94
90
|
import "./chunk-YWRUQ7XZ.js";
|
|
95
|
-
import
|
|
96
|
-
parseAnimatedGifMetadata
|
|
97
|
-
} from "./chunk-FJ3KUOUZ.js";
|
|
91
|
+
import "./chunk-IZRC24DI.js";
|
|
98
92
|
import "./chunk-MEJH7VEA.js";
|
|
99
|
-
import "./chunk-
|
|
93
|
+
import "./chunk-SBQV5FLG.js";
|
|
100
94
|
import "./chunk-VC76R6W2.js";
|
|
101
95
|
import "./chunk-OFQWTKPW.js";
|
|
102
96
|
import "./chunk-RQVDTPGD.js";
|
|
@@ -108,33 +102,22 @@ import "./chunk-KGPLIH7B.js";
|
|
|
108
102
|
import "./chunk-LAGZGKKN.js";
|
|
109
103
|
import "./chunk-K4MJX7SR.js";
|
|
110
104
|
import "./chunk-WE42NVH7.js";
|
|
111
|
-
import "./chunk-
|
|
105
|
+
import "./chunk-GR2T3BOX.js";
|
|
112
106
|
import "./chunk-HYRPH6LL.js";
|
|
113
|
-
import
|
|
114
|
-
cleanAssetUrl,
|
|
115
|
-
isRemoteOrInlineUrl,
|
|
116
|
-
resolveLocalAssetCandidates
|
|
117
|
-
} from "./chunk-AKMY4QVI.js";
|
|
107
|
+
import "./chunk-2GTFW4MK.js";
|
|
118
108
|
import "./chunk-CZGHFATT.js";
|
|
119
|
-
import
|
|
120
|
-
readAuthoredDurationSeconds,
|
|
121
|
-
readMediaOffsetSeconds,
|
|
122
|
-
readPlaybackRate,
|
|
123
|
-
rewriteAssetPath
|
|
124
|
-
} from "./chunk-C2KEGBR3.js";
|
|
109
|
+
import "./chunk-C2KEGBR3.js";
|
|
125
110
|
import "./chunk-T5ELONXY.js";
|
|
126
111
|
import "./chunk-FR7YBU3H.js";
|
|
127
112
|
import "./chunk-DPVXBVLL.js";
|
|
128
|
-
import
|
|
129
|
-
parseHTML
|
|
130
|
-
} from "./chunk-GWTIFRF5.js";
|
|
113
|
+
import "./chunk-GWTIFRF5.js";
|
|
131
114
|
import "./chunk-2RY2LWAA.js";
|
|
132
115
|
import "./chunk-EPQC3FGZ.js";
|
|
133
116
|
import "./chunk-WC4MTXGN.js";
|
|
134
117
|
import "./chunk-FBN2M2HK.js";
|
|
135
118
|
import {
|
|
136
119
|
withMeta
|
|
137
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-SANQC4QD.js";
|
|
138
121
|
import "./chunk-BR2JQQC5.js";
|
|
139
122
|
import "./chunk-BLBMPEBX.js";
|
|
140
123
|
import "./chunk-ISN5GRYI.js";
|
|
@@ -145,7 +128,7 @@ import {
|
|
|
145
128
|
} from "./chunk-66W5IWLO.js";
|
|
146
129
|
import "./chunk-J3RXEDR2.js";
|
|
147
130
|
import "./chunk-QBXDU24O.js";
|
|
148
|
-
import "./chunk-
|
|
131
|
+
import "./chunk-V7BBBD5C.js";
|
|
149
132
|
import {
|
|
150
133
|
normalizeErrorMessage
|
|
151
134
|
} from "./chunk-E63BDV4Z.js";
|
|
@@ -199,707 +182,8 @@ function detectAspectRatioFromHtmlString(html) {
|
|
|
199
182
|
return { kind: "no-match", width, height, ratio };
|
|
200
183
|
}
|
|
201
184
|
|
|
202
|
-
// src/cloud/offload.ts
|
|
203
|
-
import { execFile } from "child_process";
|
|
204
|
-
import { createHash } from "crypto";
|
|
205
|
-
import {
|
|
206
|
-
copyFileSync,
|
|
207
|
-
createReadStream,
|
|
208
|
-
mkdirSync,
|
|
209
|
-
mkdtempSync,
|
|
210
|
-
readFileSync as readFileSync2,
|
|
211
|
-
renameSync,
|
|
212
|
-
rmSync,
|
|
213
|
-
writeFileSync
|
|
214
|
-
} from "fs";
|
|
215
|
-
import { homedir, tmpdir } from "os";
|
|
216
|
-
import { basename as basename2, dirname, extname, join, posix, relative, resolve } from "path";
|
|
217
|
-
import { promisify } from "util";
|
|
218
|
-
|
|
219
|
-
// src/cloud/offloadTrim.ts
|
|
220
|
-
import { basename } from "path";
|
|
221
|
-
var TRIM_MARGIN_SECONDS = 0.5;
|
|
222
|
-
var RETIMING_SCRIPT_RE = /data-(?:playback-start|media-start|start|duration|end|playback-rate)|\b(?:dataset|setAttribute|currentTime|playbackRate)\b|\.(?:src|loop)\b/;
|
|
223
|
-
function mediaSources(el) {
|
|
224
|
-
const own = el.getAttribute("src");
|
|
225
|
-
const nested = [...el.querySelectorAll("source[src]")].map((s) => s.getAttribute("src"));
|
|
226
|
-
return [...own ? [own] : [], ...nested];
|
|
227
|
-
}
|
|
228
|
-
function hasTimedAncestor(el) {
|
|
229
|
-
for (let p = el.parentElement; p; p = p.parentElement) {
|
|
230
|
-
const get = (name) => p.getAttribute(name);
|
|
231
|
-
if (readMediaOffsetSeconds(get) > 0) return true;
|
|
232
|
-
if (p.hasAttribute("data-composition-id") && p.parentElement?.closest("[data-composition-id]")) {
|
|
233
|
-
return true;
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
function playedWindow(el) {
|
|
239
|
-
if (el.hasAttribute("loop") || el.hasAttribute("data-automation") || el.hasAttribute("data-var-src") || hasTimedAncestor(el)) {
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
const get = (name) => el.getAttribute(name);
|
|
243
|
-
const start = readMediaOffsetSeconds(get);
|
|
244
|
-
const duration = readAuthoredDurationSeconds(get, Number(get("data-start") ?? 0));
|
|
245
|
-
if (duration === null || !(duration > 0)) return null;
|
|
246
|
-
return { start, end: start + duration * readPlaybackRate(get) };
|
|
247
|
-
}
|
|
248
|
-
function mergeWindows(windows, gridPerSecond) {
|
|
249
|
-
const down = (t) => Math.floor(t * gridPerSecond) / gridPerSecond;
|
|
250
|
-
const up = (t) => Math.ceil(t * gridPerSecond) / gridPerSecond;
|
|
251
|
-
const merged = [];
|
|
252
|
-
for (const w of [...windows].sort((a, b) => a.start - b.start)) {
|
|
253
|
-
const start = down(Math.max(0, w.start - TRIM_MARGIN_SECONDS));
|
|
254
|
-
const end = up(w.end + TRIM_MARGIN_SECONDS);
|
|
255
|
-
const last = merged.at(-1);
|
|
256
|
-
if (last && start <= last.end) last.end = Math.max(last.end, end);
|
|
257
|
-
else merged.push({ start, end });
|
|
258
|
-
}
|
|
259
|
-
return merged;
|
|
260
|
-
}
|
|
261
|
-
function shiftMediaStart(el, segments) {
|
|
262
|
-
const get = (name) => el.getAttribute(name);
|
|
263
|
-
const start = readMediaOffsetSeconds(get);
|
|
264
|
-
let offset = 0;
|
|
265
|
-
for (const segment of segments) {
|
|
266
|
-
if (start >= segment.start && start < segment.end) {
|
|
267
|
-
const attr = Number.parseFloat(get("data-playback-start") ?? "") >= 0 ? "data-playback-start" : "data-media-start";
|
|
268
|
-
el.setAttribute(attr, String(offset + (start - segment.start)));
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
offset += segment.end - segment.start;
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
function planTrim(input) {
|
|
275
|
-
if (input.mentionedElsewhere || RETIMING_SCRIPT_RE.test(input.scriptCode)) return null;
|
|
276
|
-
const { document } = parseHTML(input.entryHtml);
|
|
277
|
-
const uses = [];
|
|
278
|
-
let sources = 0;
|
|
279
|
-
for (const el of document.querySelectorAll("video, audio")) {
|
|
280
|
-
const matching = mediaSources(el).filter((src) => input.resolveKey(src) === input.path);
|
|
281
|
-
if (matching.length === 0) continue;
|
|
282
|
-
if (matching.some((src) => src.includes("#"))) return null;
|
|
283
|
-
uses.push(el);
|
|
284
|
-
sources += matching.length;
|
|
285
|
-
}
|
|
286
|
-
if (uses.length === 0 || input.entryHtml.split(basename(input.path)).length - 1 !== sources) {
|
|
287
|
-
return null;
|
|
288
|
-
}
|
|
289
|
-
const windows = uses.map(playedWindow);
|
|
290
|
-
if (windows.some((w) => w === null)) return null;
|
|
291
|
-
const segments = mergeWindows(windows, input.gridPerSecond);
|
|
292
|
-
for (const el of uses) shiftMediaStart(el, segments);
|
|
293
|
-
return { segments, html: document.toString() };
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// src/cloud/offload.ts
|
|
297
|
-
var execFileAsync = promisify(execFile);
|
|
298
|
-
var OFFLOAD_MIN_BYTES = 5 * 1024 * 1024;
|
|
299
|
-
var MiB = 1024 * 1024;
|
|
300
|
-
var AUDIO_MAX_BYTES = 15e8;
|
|
301
|
-
var ACCEPTED = {
|
|
302
|
-
".mp4": { contentType: "video/mp4", maxBytes: 200 * MiB },
|
|
303
|
-
".m4v": { contentType: "video/mp4", maxBytes: 200 * MiB },
|
|
304
|
-
".mov": { contentType: "video/quicktime", maxBytes: 200 * MiB },
|
|
305
|
-
".webm": { contentType: "video/webm", maxBytes: 200 * MiB },
|
|
306
|
-
".png": { contentType: "image/png", maxBytes: 200 * MiB },
|
|
307
|
-
".jpg": { contentType: "image/jpeg", maxBytes: 200 * MiB },
|
|
308
|
-
".jpeg": { contentType: "image/jpeg", maxBytes: 200 * MiB },
|
|
309
|
-
".webp": { contentType: "image/webp", maxBytes: 200 * MiB },
|
|
310
|
-
".wav": { contentType: "audio/wav", maxBytes: AUDIO_MAX_BYTES },
|
|
311
|
-
".mp3": { contentType: "audio/mpeg", maxBytes: AUDIO_MAX_BYTES }
|
|
312
|
-
};
|
|
313
|
-
var VIDEO_EXTS = /* @__PURE__ */ new Set([
|
|
314
|
-
".mp4",
|
|
315
|
-
".m4v",
|
|
316
|
-
".mov",
|
|
317
|
-
".webm",
|
|
318
|
-
".mkv",
|
|
319
|
-
".avi",
|
|
320
|
-
".mpg",
|
|
321
|
-
".mpeg",
|
|
322
|
-
".ts",
|
|
323
|
-
".m2ts",
|
|
324
|
-
".mts",
|
|
325
|
-
".flv",
|
|
326
|
-
".wmv",
|
|
327
|
-
".ogv",
|
|
328
|
-
".3gp"
|
|
329
|
-
]);
|
|
330
|
-
var AUDIO_EXTS = /* @__PURE__ */ new Set([
|
|
331
|
-
".wav",
|
|
332
|
-
".mp3",
|
|
333
|
-
".m4a",
|
|
334
|
-
".aac",
|
|
335
|
-
".ogg",
|
|
336
|
-
".oga",
|
|
337
|
-
".opus",
|
|
338
|
-
".flac",
|
|
339
|
-
".aif",
|
|
340
|
-
".aiff",
|
|
341
|
-
".wma"
|
|
342
|
-
]);
|
|
343
|
-
var CONVERTIBLE_IMAGE_EXTS = /* @__PURE__ */ new Set([".gif", ".avif", ".bmp", ".tif", ".tiff"]);
|
|
344
|
-
var REENCODE_PRESETS = {
|
|
345
|
-
video: {
|
|
346
|
-
ext: ".mp4",
|
|
347
|
-
contentType: "video/mp4",
|
|
348
|
-
args: ["-c:v", "libx264", "-preset", "slow", "-crf", "18", "-pix_fmt", "yuv420p"],
|
|
349
|
-
audio: ["-c:a", "aac", "-b:a", "320k", "-movflags", "+faststart"]
|
|
350
|
-
},
|
|
351
|
-
hdrVideo: {
|
|
352
|
-
ext: ".mp4",
|
|
353
|
-
contentType: "video/mp4",
|
|
354
|
-
args: ["-c:v", "libx265", "-preset", "slow", "-crf", "18", "-pix_fmt", "yuv420p10le"],
|
|
355
|
-
audio: ["-tag:v", "hvc1", "-c:a", "aac", "-b:a", "320k", "-movflags", "+faststart"]
|
|
356
|
-
},
|
|
357
|
-
alphaVideo: {
|
|
358
|
-
ext: ".webm",
|
|
359
|
-
contentType: "video/webm",
|
|
360
|
-
args: ["-c:v", "libvpx-vp9", "-crf", "18", "-b:v", "0", "-pix_fmt", "yuva420p"],
|
|
361
|
-
audio: ["-c:a", "libopus", "-b:a", "256k"]
|
|
362
|
-
},
|
|
363
|
-
audio: {
|
|
364
|
-
ext: ".wav",
|
|
365
|
-
contentType: "audio/wav",
|
|
366
|
-
args: ["-vn"],
|
|
367
|
-
audio: ["-c:a", "pcm_s16le"]
|
|
368
|
-
},
|
|
369
|
-
image: {
|
|
370
|
-
ext: ".png",
|
|
371
|
-
contentType: "image/png",
|
|
372
|
-
args: ["-frames:v", "1"],
|
|
373
|
-
audio: []
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
function defaultOffloadCachePath() {
|
|
377
|
-
return join(homedir(), ".cache", "hyperframes", "cloud-assets.json");
|
|
378
|
-
}
|
|
379
|
-
function readCache(path) {
|
|
380
|
-
try {
|
|
381
|
-
return JSON.parse(readFileSync2(path, "utf-8")) ?? {};
|
|
382
|
-
} catch {
|
|
383
|
-
return {};
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function writeCache(path, cache) {
|
|
387
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
388
|
-
const tmp = `${path}.${process.pid}.tmp`;
|
|
389
|
-
writeFileSync(tmp, JSON.stringify(cache, null, 2));
|
|
390
|
-
renameSync(tmp, path);
|
|
391
|
-
}
|
|
392
|
-
async function stillServed(entry, fetchImpl) {
|
|
393
|
-
try {
|
|
394
|
-
const res = await fetchImpl(entry.url, { method: "HEAD" });
|
|
395
|
-
return res.ok && Number(res.headers.get("content-length")) === entry.size_bytes;
|
|
396
|
-
} catch {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function mediaKind(path) {
|
|
401
|
-
const ext = extname(path).toLowerCase();
|
|
402
|
-
if (VIDEO_EXTS.has(ext)) return "video";
|
|
403
|
-
if (AUDIO_EXTS.has(ext)) return "audio";
|
|
404
|
-
if (ACCEPTED[ext] || CONVERTIBLE_IMAGE_EXTS.has(ext)) return "image";
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
async function probeVideo(path) {
|
|
408
|
-
const ffprobe = findFFprobe();
|
|
409
|
-
if (!ffprobe)
|
|
410
|
-
throw new Error(`Re-encoding needs ffprobe. Install ffmpeg: ${getFFmpegInstallHint()}`);
|
|
411
|
-
const { stdout } = await execFileAsync(ffprobe, [
|
|
412
|
-
"-v",
|
|
413
|
-
"error",
|
|
414
|
-
"-select_streams",
|
|
415
|
-
"v:0",
|
|
416
|
-
"-show_entries",
|
|
417
|
-
"stream=codec_name,pix_fmt,color_primaries,color_transfer,color_space:stream_tags",
|
|
418
|
-
"-of",
|
|
419
|
-
"json",
|
|
420
|
-
"--",
|
|
421
|
-
path
|
|
422
|
-
]);
|
|
423
|
-
const stream = JSON.parse(stdout).streams?.[0] ?? {};
|
|
424
|
-
const tags = stream.tags ?? {};
|
|
425
|
-
const alphaTag = Object.entries(tags).some(
|
|
426
|
-
([k, v]) => k.toLowerCase() === "alpha_mode" && v === "1"
|
|
427
|
-
);
|
|
428
|
-
const transfer = stream.color_transfer;
|
|
429
|
-
return {
|
|
430
|
-
// VP9 alpha keeps pix_fmt yuv420p and flags the plane only in the ALPHA_MODE tag.
|
|
431
|
-
alpha: alphaTag || /^(yuva|rgba|argb|bgra|abgr|gbrap|ya)/.test(String(stream.pix_fmt ?? "")),
|
|
432
|
-
hdr: transfer === "smpte2084" || transfer === "arib-std-b67",
|
|
433
|
-
codec: stream.codec_name,
|
|
434
|
-
color: {
|
|
435
|
-
primaries: stream.color_primaries,
|
|
436
|
-
transfer,
|
|
437
|
-
space: stream.color_space
|
|
438
|
-
}
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
function alphaDecoderArgs(probe) {
|
|
442
|
-
if (!probe.alpha) return [];
|
|
443
|
-
if (probe.codec === "vp9") return ["-c:v", "libvpx-vp9"];
|
|
444
|
-
if (probe.codec === "vp8") return ["-c:v", "libvpx"];
|
|
445
|
-
return [];
|
|
446
|
-
}
|
|
447
|
-
function hdrColorArgs({ color }) {
|
|
448
|
-
return [
|
|
449
|
-
...color.primaries ? ["-color_primaries", color.primaries] : [],
|
|
450
|
-
...color.transfer ? ["-color_trc", color.transfer] : [],
|
|
451
|
-
...color.space ? ["-colorspace", color.space] : []
|
|
452
|
-
];
|
|
453
|
-
}
|
|
454
|
-
var seconds = (t) => (Math.floor(t * 1e6) / 1e6).toFixed(6);
|
|
455
|
-
async function segmentArgs(sourcePath, decoder, segments, media) {
|
|
456
|
-
if (media === "image") return [...decoder, "-i", sourcePath];
|
|
457
|
-
const audio = await keptAudio(sourcePath, media);
|
|
458
|
-
const cuts = segments?.length ? segments : [void 0];
|
|
459
|
-
const inputs = cuts.flatMap((s) => [...decoder, ...seekArgs(s), "-i", sourcePath]);
|
|
460
|
-
const video = media === "video";
|
|
461
|
-
return [
|
|
462
|
-
...inputs,
|
|
463
|
-
...cuts.length > 1 ? concatArgs(cuts.length, video, audio) : streamMaps(video, audio)
|
|
464
|
-
];
|
|
465
|
-
}
|
|
466
|
-
async function keptAudio(sourcePath, media) {
|
|
467
|
-
const audio = (await probeAudio(sourcePath))?.audioStream ?? null;
|
|
468
|
-
if (media === "audio" && audio === null) {
|
|
469
|
-
throw new Error("the file has no audio track ffmpeg can decode");
|
|
470
|
-
}
|
|
471
|
-
return audio;
|
|
472
|
-
}
|
|
473
|
-
var seekArgs = (s) => s ? ["-ss", seconds(s.start), "-t", seconds(s.end - s.start)] : [];
|
|
474
|
-
var streamMaps = (video, audio) => [
|
|
475
|
-
...video ? ["-map", "0:V:0"] : [],
|
|
476
|
-
...audio === null ? [] : ["-map", `0:a:${audio}`]
|
|
477
|
-
];
|
|
478
|
-
var mediaOf = (preset) => preset === "audio" || preset === "image" ? preset : "video";
|
|
479
|
-
function concatArgs(count, video, audio) {
|
|
480
|
-
const pad = (i) => (video ? `[${i}:v]` : "") + (audio === null ? "" : `[${i}:a:${audio}]`);
|
|
481
|
-
const pads = Array.from({ length: count }, (_, i) => pad(i)).join("");
|
|
482
|
-
const flags = `n=${count}:v=${video ? 1 : 0}:a=${audio === null ? 0 : 1}`;
|
|
483
|
-
return [
|
|
484
|
-
"-filter_complex",
|
|
485
|
-
`${pads}concat=${flags}${video ? "[v]" : ""}${audio === null ? "" : "[a]"}`,
|
|
486
|
-
...video ? ["-map", "[v]"] : [],
|
|
487
|
-
...audio === null ? [] : ["-map", "[a]"]
|
|
488
|
-
];
|
|
489
|
-
}
|
|
490
|
-
async function ffmpegReencode(sourcePath, presetName, segments) {
|
|
491
|
-
const ffmpeg = findFFmpeg();
|
|
492
|
-
if (!ffmpeg) throw new Error(`Re-encoding needs ffmpeg. Install it: ${getFFmpegInstallHint()}`);
|
|
493
|
-
const preset = REENCODE_PRESETS[presetName];
|
|
494
|
-
const probe = preset.contentType.startsWith("video/") ? await probeVideo(sourcePath) : void 0;
|
|
495
|
-
const decoder = probe ? alphaDecoderArgs(probe) : [];
|
|
496
|
-
const color = presetName === "hdrVideo" && probe ? hdrColorArgs(probe) : [];
|
|
497
|
-
const workDir = mkdtempSync(join(tmpdir(), "hf-offload-"));
|
|
498
|
-
const outPath = join(workDir, `${basename2(sourcePath, extname(sourcePath))}${preset.ext}`);
|
|
499
|
-
try {
|
|
500
|
-
await execFileAsync(
|
|
501
|
-
ffmpeg,
|
|
502
|
-
[
|
|
503
|
-
"-v",
|
|
504
|
-
"error",
|
|
505
|
-
"-y",
|
|
506
|
-
...await segmentArgs(sourcePath, decoder, segments, mediaOf(presetName)),
|
|
507
|
-
...preset.args,
|
|
508
|
-
...color,
|
|
509
|
-
...preset.audio,
|
|
510
|
-
outPath
|
|
511
|
-
],
|
|
512
|
-
{ maxBuffer: 16 * MiB }
|
|
513
|
-
);
|
|
514
|
-
return {
|
|
515
|
-
bytes: readChecked(outPath, ({ size }) => assertFitsAsset(sourcePath, outPath, size)),
|
|
516
|
-
filename: basename2(outPath),
|
|
517
|
-
contentType: preset.contentType
|
|
518
|
-
};
|
|
519
|
-
} finally {
|
|
520
|
-
rmSync(workDir, { recursive: true, force: true });
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
async function choosePreset(sourcePath, kind) {
|
|
524
|
-
if (kind === "audio") return "audio";
|
|
525
|
-
if (kind === "image") return await isAnimatedImage(sourcePath) ? null : "image";
|
|
526
|
-
const probe = await probeVideo(sourcePath);
|
|
527
|
-
return probe.alpha ? "alphaVideo" : probe.hdr ? "hdrVideo" : "video";
|
|
528
|
-
}
|
|
529
|
-
async function isAnimatedImage(path) {
|
|
530
|
-
if (extname(path).toLowerCase() === ".gif") {
|
|
531
|
-
return parseAnimatedGifMetadata(readFileSync2(path))?.animated ?? true;
|
|
532
|
-
}
|
|
533
|
-
const ffprobe = findFFprobe();
|
|
534
|
-
if (!ffprobe) return true;
|
|
535
|
-
try {
|
|
536
|
-
const { stdout } = await execFileAsync(ffprobe, [
|
|
537
|
-
"-v",
|
|
538
|
-
"error",
|
|
539
|
-
"-show_entries",
|
|
540
|
-
"stream=nb_frames",
|
|
541
|
-
"-of",
|
|
542
|
-
"csv=p=0",
|
|
543
|
-
"--",
|
|
544
|
-
path
|
|
545
|
-
]);
|
|
546
|
-
return stdout.split("\n").some((line) => Number(line) > 1);
|
|
547
|
-
} catch {
|
|
548
|
-
return true;
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
async function trimGrid(sourcePath, kind) {
|
|
552
|
-
if (kind === "audio") return 1e3;
|
|
553
|
-
if (kind !== "video") return null;
|
|
554
|
-
const ffprobe = findFFprobe();
|
|
555
|
-
if (!ffprobe) return null;
|
|
556
|
-
const { stdout } = await execFileAsync(ffprobe, [
|
|
557
|
-
"-v",
|
|
558
|
-
"error",
|
|
559
|
-
"-select_streams",
|
|
560
|
-
"v:0",
|
|
561
|
-
"-show_entries",
|
|
562
|
-
"stream=r_frame_rate,avg_frame_rate",
|
|
563
|
-
"-of",
|
|
564
|
-
"csv=p=0",
|
|
565
|
-
"--",
|
|
566
|
-
sourcePath
|
|
567
|
-
]);
|
|
568
|
-
const rate = (fraction) => {
|
|
569
|
-
const [num, den] = (fraction ?? "").split("/").map(Number);
|
|
570
|
-
return num && den ? num / den : NaN;
|
|
571
|
-
};
|
|
572
|
-
const [real, average] = stdout.trim().split(",");
|
|
573
|
-
const fps = rate(real);
|
|
574
|
-
return Number.isFinite(fps) && Math.abs(fps - rate(average)) < 0.01 ? fps : null;
|
|
575
|
-
}
|
|
576
|
-
var ffmpegReencoder = { choose: choosePreset, trimGrid, run: ffmpegReencode };
|
|
577
|
-
async function stagedSha256(file) {
|
|
578
|
-
if (Buffer.isBuffer(file)) return createHash("sha256").update(file).digest("hex");
|
|
579
|
-
const hash = createHash("sha256");
|
|
580
|
-
for await (const chunk of createReadStream(file.absPath)) hash.update(chunk);
|
|
581
|
-
assertUnchanged(file);
|
|
582
|
-
return hash.digest("hex");
|
|
583
|
-
}
|
|
584
|
-
function snapshotPath(path, file, tempFiles) {
|
|
585
|
-
return Buffer.isBuffer(file) ? stagedCopy(path, file, tempFiles) : file.absPath;
|
|
586
|
-
}
|
|
587
|
-
function stagedCopy(path, file, tempFiles) {
|
|
588
|
-
const dir = mkdtempSync(join(tmpdir(), "hf-offload-src-"));
|
|
589
|
-
tempFiles.push(dir);
|
|
590
|
-
const copy = join(dir, basename2(path));
|
|
591
|
-
if (Buffer.isBuffer(file)) writeFileSync(copy, file);
|
|
592
|
-
else {
|
|
593
|
-
copyFileSync(file.absPath, copy);
|
|
594
|
-
assertUnchanged(file);
|
|
595
|
-
}
|
|
596
|
-
return copy;
|
|
597
|
-
}
|
|
598
|
-
function textOf(path, file) {
|
|
599
|
-
return TEXT_FILE_EXTS.test(path) && Buffer.isBuffer(file) ? file.toString("utf-8") : void 0;
|
|
600
|
-
}
|
|
601
|
-
function scriptCode(fileMap) {
|
|
602
|
-
const parts = [];
|
|
603
|
-
for (const [path, content] of fileMap) {
|
|
604
|
-
const text = textOf(path, content);
|
|
605
|
-
if (text === void 0) continue;
|
|
606
|
-
if (/\.html?$/i.test(path)) {
|
|
607
|
-
for (const script of parseHTML(text).document.querySelectorAll("script:not([src])")) {
|
|
608
|
-
parts.push(script.textContent ?? "");
|
|
609
|
-
}
|
|
610
|
-
} else if (/\.(m?js|cjs|json)$/i.test(path)) parts.push(text);
|
|
611
|
-
}
|
|
612
|
-
return parts.join("\n");
|
|
613
|
-
}
|
|
614
|
-
function assertFitsAsset(path, filename, size) {
|
|
615
|
-
const maxBytes = ACCEPTED[extname(filename).toLowerCase()]?.maxBytes ?? 0;
|
|
616
|
-
if (size > maxBytes) {
|
|
617
|
-
throw new Error(
|
|
618
|
-
`${path} is ${formatBytes(size)} after re-encoding at visually lossless quality, over the ${formatBytes(maxBytes)} a HeyGen asset can hold.`
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
async function planFile(ctx, path, file) {
|
|
623
|
-
const kind = mediaKind(path);
|
|
624
|
-
const size = stagedSize(file);
|
|
625
|
-
if (!kind || size < OFFLOAD_MIN_BYTES) return null;
|
|
626
|
-
const accepted = ACCEPTED[extname(path).toLowerCase()];
|
|
627
|
-
const asIs = accepted !== void 0 && size <= accepted.maxBytes;
|
|
628
|
-
const mayBeCached = ctx.opts.upload !== void 0 || (asIs ? ctx.cachedSizes.has(size) : ctx.cachedSizes.size > 0);
|
|
629
|
-
const sha256 = mayBeCached ? await stagedSha256(file) : void 0;
|
|
630
|
-
const keyFor = (variant2) => sha256 && `${ctx.opts.apiBaseUrl} ${sha256} ${variant2}`;
|
|
631
|
-
if (asIs) {
|
|
632
|
-
return { key: keyFor("as-is"), sourcePath: "", contentType: accepted?.contentType };
|
|
633
|
-
}
|
|
634
|
-
const sourcePath = snapshotPath(path, file, ctx.tempFiles);
|
|
635
|
-
const preset = await ctx.reencoder.choose(sourcePath, kind);
|
|
636
|
-
if (!preset) return null;
|
|
637
|
-
const segments = kind === "image" ? null : await planFileTrim(ctx, path, sourcePath, kind);
|
|
638
|
-
const variant = JSON.stringify([REENCODE_PRESETS[preset], segments]);
|
|
639
|
-
return { key: keyFor(variant), preset, sourcePath, segments: segments ?? void 0 };
|
|
640
|
-
}
|
|
641
|
-
async function planFileTrim(ctx, path, sourcePath, kind) {
|
|
642
|
-
const entryPath = ctx.opts.entryPath ?? "index.html";
|
|
643
|
-
const entryHtml = textOf(entryPath, ctx.fileMap.get(entryPath));
|
|
644
|
-
const gridPerSecond = entryHtml ? await ctx.reencoder.trimGrid?.(sourcePath, kind) : null;
|
|
645
|
-
if (!entryHtml || !gridPerSecond) return null;
|
|
646
|
-
const name = basename2(path);
|
|
647
|
-
const plan = planTrim({
|
|
648
|
-
entryHtml,
|
|
649
|
-
path,
|
|
650
|
-
gridPerSecond,
|
|
651
|
-
resolveKey: (raw) => htmlSrcKey(ctx.absDir, entryPath, raw, ctx.fileMap),
|
|
652
|
-
mentionedElsewhere: [...ctx.fileMap].some(
|
|
653
|
-
([other, content]) => other !== entryPath && other !== path && !!textOf(other, content)?.includes(name)
|
|
654
|
-
),
|
|
655
|
-
scriptCode: scriptCode(ctx.fileMap)
|
|
656
|
-
});
|
|
657
|
-
if (!plan) return null;
|
|
658
|
-
ctx.fileMap.set(entryPath, Buffer.from(plan.html, "utf-8"));
|
|
659
|
-
return plan.segments;
|
|
660
|
-
}
|
|
661
|
-
async function offloadFile(ctx, path, file) {
|
|
662
|
-
const plan = await planFile(ctx, path, file);
|
|
663
|
-
if (!plan) return null;
|
|
664
|
-
const item = {
|
|
665
|
-
path,
|
|
666
|
-
size_bytes: stagedSize(file),
|
|
667
|
-
action: plan.preset ? "reencode" : "upload",
|
|
668
|
-
...plan.segments && {
|
|
669
|
-
trimmed_to_seconds: plan.segments.reduce((sum, s) => sum + s.end - s.start, 0)
|
|
670
|
-
}
|
|
671
|
-
};
|
|
672
|
-
const hit = plan.key === void 0 ? void 0 : ctx.cache[plan.key];
|
|
673
|
-
if (hit && (!ctx.opts.upload || await stillServed(hit, ctx.fetchImpl))) {
|
|
674
|
-
return { ...item, action: "cached", url: hit.url };
|
|
675
|
-
}
|
|
676
|
-
if (!ctx.opts.upload) return item;
|
|
677
|
-
return { ...item, url: await uploadPlanned(ctx, ctx.opts.upload, path, file, plan) };
|
|
678
|
-
}
|
|
679
|
-
async function uploadPlanned(ctx, upload, path, staged, plan) {
|
|
680
|
-
const filename = basename2(path);
|
|
681
|
-
const file = plan.preset ? await ctx.reencoder.run(plan.sourcePath, plan.preset, plan.segments) : Buffer.isBuffer(staged) ? { bytes: staged, filename, contentType: plan.contentType } : { path: staged.absPath, size: staged.size, filename, contentType: plan.contentType };
|
|
682
|
-
if (plan.preset && !Buffer.isBuffer(staged)) assertUnchanged(staged);
|
|
683
|
-
const size = "bytes" in file ? file.bytes.byteLength : file.size;
|
|
684
|
-
assertFitsAsset(path, file.filename, size);
|
|
685
|
-
const asset = await upload(file);
|
|
686
|
-
if (!Buffer.isBuffer(staged)) assertUnchanged(staged);
|
|
687
|
-
if (plan.key !== void 0) {
|
|
688
|
-
ctx.cache[plan.key] = { asset_id: asset.asset_id, url: asset.url, size_bytes: size };
|
|
689
|
-
writeCache(ctx.cachePath, ctx.cache);
|
|
690
|
-
}
|
|
691
|
-
return asset.url;
|
|
692
|
-
}
|
|
693
|
-
var GIF_PREFIX = "_animated_gif";
|
|
694
|
-
async function prepareEntryGifs(ctx, fileMap) {
|
|
695
|
-
const entryPath = ctx.opts.entryPath ?? "index.html";
|
|
696
|
-
const html = textOf(entryPath, fileMap.get(entryPath));
|
|
697
|
-
if (!html || !/\.gif\b/i.test(html)) return;
|
|
698
|
-
const sourceAssets = entryGifSources(ctx, entryPath, html);
|
|
699
|
-
if (!sourceAssets) return;
|
|
700
|
-
const prep = ctx.opts.gifPrep ?? (await import("./src-RGQFYVHO.js")).prepareAnimatedGifInputs;
|
|
701
|
-
const outputDir = mkdtempSync(join(tmpdir(), "hf-offload-gif-"));
|
|
702
|
-
ctx.tempFiles.push(outputDir);
|
|
703
|
-
const result = await prep(html, {
|
|
704
|
-
projectDir: ctx.absDir,
|
|
705
|
-
downloadDir: outputDir,
|
|
706
|
-
outputDir,
|
|
707
|
-
outputSrcPrefix: posix.relative(posix.dirname(entryPath), GIF_PREFIX),
|
|
708
|
-
cacheDir: join(homedir(), ".cache", "hyperframes", "animated-gif"),
|
|
709
|
-
sourceAssets
|
|
710
|
-
});
|
|
711
|
-
if (result.preparedGifs.length === 0) return;
|
|
712
|
-
fileMap.set(entryPath, Buffer.from(result.html, "utf-8"));
|
|
713
|
-
for (const gif of result.preparedGifs) {
|
|
714
|
-
fileMap.set(`${GIF_PREFIX}/${basename2(gif.outputPath)}`, readFileSync2(gif.outputPath));
|
|
715
|
-
const source = htmlSrcKey(ctx.absDir, entryPath, gif.sourceSrc.trim(), fileMap);
|
|
716
|
-
if (source) ctx.preparedGifSources.push(source);
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
function entryGifSources(ctx, entryPath, html) {
|
|
720
|
-
const sourceAssets = /* @__PURE__ */ new Map();
|
|
721
|
-
let heavy = false;
|
|
722
|
-
for (const img of parseHTML(html).document.querySelectorAll("img[src]")) {
|
|
723
|
-
const src = img.getAttribute("src").trim();
|
|
724
|
-
const key = htmlSrcKey(ctx.absDir, entryPath, src, ctx.fileMap);
|
|
725
|
-
if (!key?.toLowerCase().endsWith(".gif")) continue;
|
|
726
|
-
const file = ctx.fileMap.get(key);
|
|
727
|
-
sourceAssets.set(src, stagedCopy(key, file, ctx.tempFiles));
|
|
728
|
-
heavy ||= stagedSize(file) >= OFFLOAD_MIN_BYTES;
|
|
729
|
-
}
|
|
730
|
-
return heavy ? sourceAssets : null;
|
|
731
|
-
}
|
|
732
|
-
async function offloadHeavyMedia(projectDir, fileMap, opts) {
|
|
733
|
-
const cachePath = opts.cachePath ?? defaultOffloadCachePath();
|
|
734
|
-
const cache = readCache(cachePath);
|
|
735
|
-
const apiPrefix = `${opts.apiBaseUrl} `;
|
|
736
|
-
const ctx = {
|
|
737
|
-
absDir: resolve(projectDir),
|
|
738
|
-
opts,
|
|
739
|
-
cachePath,
|
|
740
|
-
cache,
|
|
741
|
-
cachedSizes: new Set(
|
|
742
|
-
Object.entries(cache).flatMap(
|
|
743
|
-
([key, entry]) => key.startsWith(apiPrefix) ? [entry.size_bytes] : []
|
|
744
|
-
)
|
|
745
|
-
),
|
|
746
|
-
fetchImpl: opts.fetchImpl ?? fetch,
|
|
747
|
-
reencoder: opts.reencoder ?? ffmpegReencoder,
|
|
748
|
-
tempFiles: [],
|
|
749
|
-
preparedGifSources: [],
|
|
750
|
-
fileMap
|
|
751
|
-
};
|
|
752
|
-
const urls = /* @__PURE__ */ new Map();
|
|
753
|
-
const report = [];
|
|
754
|
-
try {
|
|
755
|
-
await prepareEntryGifs(ctx, fileMap);
|
|
756
|
-
const referenced = referencedFiles(ctx.absDir, fileMap);
|
|
757
|
-
for (const [path, file] of [...fileMap].sort(([a], [b]) => a.localeCompare(b))) {
|
|
758
|
-
if (!referenced.has(path)) continue;
|
|
759
|
-
const item = await offloadFile(ctx, path, file);
|
|
760
|
-
if (!item) continue;
|
|
761
|
-
urls.set(path, item.url ?? `https://assets.invalid/${report.length}`);
|
|
762
|
-
report.push(item);
|
|
763
|
-
opts.onFile?.(item);
|
|
764
|
-
}
|
|
765
|
-
} finally {
|
|
766
|
-
for (const dir of ctx.tempFiles) rmSync(dir, { recursive: true, force: true });
|
|
767
|
-
}
|
|
768
|
-
if (urls.size > 0) rewriteReferences(ctx.absDir, fileMap, (key) => urls.get(key) ?? null);
|
|
769
|
-
dropReplacedFiles(fileMap, report, ctx.preparedGifSources, [...urls.values()]);
|
|
770
|
-
return report;
|
|
771
|
-
}
|
|
772
|
-
function dropReplacedFiles(fileMap, report, preparedGifSources, assetUrls) {
|
|
773
|
-
const withoutUrls = (text) => assetUrls.reduce((acc, url) => acc.replaceAll(url, ""), text);
|
|
774
|
-
const code = withoutUrls(scriptCode(fileMap));
|
|
775
|
-
for (const item of report) {
|
|
776
|
-
if (isStillMentioned(fileMap, item.path, code, withoutUrls)) item.kept_in_archive = true;
|
|
777
|
-
else fileMap.delete(item.path);
|
|
778
|
-
}
|
|
779
|
-
for (const gif of preparedGifSources) {
|
|
780
|
-
if (!isStillMentioned(fileMap, gif, code, withoutUrls)) fileMap.delete(gif);
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
function isStillMentioned(fileMap, path, code, withoutUrls) {
|
|
784
|
-
const ext = extname(path);
|
|
785
|
-
if (code.includes(basename2(path, ext)) && code.includes(ext.slice(1))) return true;
|
|
786
|
-
const name = basename2(path);
|
|
787
|
-
for (const [entryPath, content] of fileMap) {
|
|
788
|
-
const contentText = textOf(entryPath, content);
|
|
789
|
-
if (entryPath === path || !contentText?.includes(name)) continue;
|
|
790
|
-
if (withoutUrls(contentText).includes(name)) return true;
|
|
791
|
-
}
|
|
792
|
-
return false;
|
|
793
|
-
}
|
|
794
|
-
function htmlSrcKey(absDir, entryPath, raw, fileMap) {
|
|
795
|
-
const clean = cleanAssetUrl(raw);
|
|
796
|
-
if (!clean || isRemoteOrInlineUrl(clean)) return null;
|
|
797
|
-
const rootRelative = clean.startsWith("/") ? clean : rewriteAssetPath(entryPath, clean, (p) => fileMap.has(p));
|
|
798
|
-
for (const candidate of resolveLocalAssetCandidates(absDir, rootRelative)) {
|
|
799
|
-
const key = relative(absDir, candidate).replaceAll("\\", "/");
|
|
800
|
-
if (fileMap.has(key)) return key;
|
|
801
|
-
}
|
|
802
|
-
return null;
|
|
803
|
-
}
|
|
804
|
-
function referencedFiles(absDir, fileMap) {
|
|
805
|
-
const keys = /* @__PURE__ */ new Set();
|
|
806
|
-
rewriteReferences(absDir, fileMap, (key) => {
|
|
807
|
-
if (fileMap.has(key)) keys.add(key);
|
|
808
|
-
return null;
|
|
809
|
-
});
|
|
810
|
-
return keys;
|
|
811
|
-
}
|
|
812
|
-
function rewriteReferences(absDir, fileMap, urlForKey) {
|
|
813
|
-
const urlFor = (rootRelative) => {
|
|
814
|
-
for (const candidate of resolveLocalAssetCandidates(absDir, rootRelative)) {
|
|
815
|
-
const url = urlForKey(relative(absDir, candidate).replaceAll("\\", "/"));
|
|
816
|
-
if (url) return url;
|
|
817
|
-
}
|
|
818
|
-
return null;
|
|
819
|
-
};
|
|
820
|
-
for (const [entryPath, content] of [...fileMap]) {
|
|
821
|
-
const rewrite = rewriterFor(absDir, entryPath, urlFor, fileMap);
|
|
822
|
-
const text = rewrite ? textOf(entryPath, content) : void 0;
|
|
823
|
-
const next = rewrite && text !== void 0 ? rewrite(text) : null;
|
|
824
|
-
if (next !== null) fileMap.set(entryPath, Buffer.from(next, "utf-8"));
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
function rewriterFor(absDir, entryPath, urlFor, fileMap) {
|
|
828
|
-
if (/\.html?$/i.test(entryPath)) {
|
|
829
|
-
return (text) => rewriteHtmlEntry(absDir, entryPath, text, urlFor, fileMap);
|
|
830
|
-
}
|
|
831
|
-
if (/\.css$/i.test(entryPath)) return (text) => rewriteCssEntry(absDir, entryPath, text, urlFor);
|
|
832
|
-
if (/\.(m?js|cjs|json)$/i.test(entryPath)) return (text) => rewriteStringLiterals(text, urlFor);
|
|
833
|
-
return null;
|
|
834
|
-
}
|
|
835
|
-
function localTarget(raw, toRootRelative, urlFor) {
|
|
836
|
-
const clean = cleanAssetUrl(raw);
|
|
837
|
-
if (!clean || isRemoteOrInlineUrl(clean)) return null;
|
|
838
|
-
const url = urlFor(clean.startsWith("/") ? clean : toRootRelative(clean));
|
|
839
|
-
return url && url + raw.trim().slice(clean.length);
|
|
840
|
-
}
|
|
841
|
-
function rewriteCssEntry(absDir, entryPath, css, urlFor) {
|
|
842
|
-
const result = rewriteCssUrls(
|
|
843
|
-
css,
|
|
844
|
-
resolve(absDir, dirname(entryPath)),
|
|
845
|
-
entryPath,
|
|
846
|
-
(raw) => localTarget(raw, (clean) => posix.join(posix.dirname(entryPath), clean), urlFor)
|
|
847
|
-
);
|
|
848
|
-
return result.modified ? result.css : null;
|
|
849
|
-
}
|
|
850
|
-
function rewriteHtmlEntry(absDir, entryPath, html, urlFor, fileMap) {
|
|
851
|
-
const referrerAbsDir = resolve(absDir, dirname(entryPath));
|
|
852
|
-
const resolveTarget = (raw) => localTarget(raw, (clean) => rewriteAssetPath(entryPath, clean, (p) => fileMap.has(p)), urlFor);
|
|
853
|
-
const { document } = parseHTML(html);
|
|
854
|
-
const attrs = rewriteHtmlAttributes(document, referrerAbsDir, entryPath, resolveTarget, {
|
|
855
|
-
attrs: ["src", "poster", "href"]
|
|
856
|
-
});
|
|
857
|
-
const srcsets = rewriteSrcsets(document, resolveTarget);
|
|
858
|
-
const styles = rewriteStyleBlocks(document, referrerAbsDir, entryPath, resolveTarget);
|
|
859
|
-
let scripts = false;
|
|
860
|
-
for (const script of document.querySelectorAll("script")) {
|
|
861
|
-
if (script.hasAttribute("src")) continue;
|
|
862
|
-
const next = rewriteStringLiterals(script.textContent ?? "", urlFor);
|
|
863
|
-
if (next === null) continue;
|
|
864
|
-
script.textContent = next;
|
|
865
|
-
scripts = true;
|
|
866
|
-
}
|
|
867
|
-
return attrs || srcsets || styles || scripts ? document.toString() : null;
|
|
868
|
-
}
|
|
869
|
-
var STRING_LITERAL_RE = /(["'`])([^"'`\\\n$]+)\1/g;
|
|
870
|
-
function rewriteStringLiterals(code, urlFor) {
|
|
871
|
-
let modified = false;
|
|
872
|
-
const next = code.replace(STRING_LITERAL_RE, (full, quote, value) => {
|
|
873
|
-
const url = localTarget(value, (clean) => clean, urlFor);
|
|
874
|
-
if (!url) return full;
|
|
875
|
-
modified = true;
|
|
876
|
-
return `${quote}${url}${quote}`;
|
|
877
|
-
});
|
|
878
|
-
return modified ? next : null;
|
|
879
|
-
}
|
|
880
|
-
function rewriteSrcsets(document, resolveTarget) {
|
|
881
|
-
let modified = false;
|
|
882
|
-
for (const el of document.querySelectorAll("[srcset]")) {
|
|
883
|
-
const srcset = el.getAttribute("srcset") ?? "";
|
|
884
|
-
if (srcset.includes("data:")) continue;
|
|
885
|
-
let changed = false;
|
|
886
|
-
const next = srcset.split(",").map((part) => {
|
|
887
|
-
const [url, ...descriptors] = part.trim().split(/\s+/);
|
|
888
|
-
const target = url ? resolveTarget(url, "") : null;
|
|
889
|
-
if (!target) return part.trim();
|
|
890
|
-
changed = true;
|
|
891
|
-
return [target, ...descriptors].join(" ");
|
|
892
|
-
}).join(", ");
|
|
893
|
-
if (changed) {
|
|
894
|
-
el.setAttribute("srcset", next);
|
|
895
|
-
modified = true;
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
return modified;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
185
|
// src/commands/cloud/render.ts
|
|
902
|
-
import { isAbsolute, relative
|
|
186
|
+
import { isAbsolute, relative, resolve as resolvePath } from "path";
|
|
903
187
|
import { statSync } from "fs";
|
|
904
188
|
var VALID_QUALITY = ["draft", "standard", "high"];
|
|
905
189
|
var VALID_FORMAT = ["mp4", "webm", "mov"];
|
|
@@ -931,7 +215,10 @@ var render_default = defineCommand({
|
|
|
931
215
|
meta: { name: "render", description: "Render a HyperFrames composition in the cloud" },
|
|
932
216
|
args: {
|
|
933
217
|
dir: { type: "positional", required: false, description: "Project directory (default: .)" },
|
|
934
|
-
fps: {
|
|
218
|
+
fps: {
|
|
219
|
+
type: "string",
|
|
220
|
+
description: "Frames per second (1-240). Default: the composition's root data-fps, else 30."
|
|
221
|
+
},
|
|
935
222
|
quality: { type: "string", description: "draft | standard | high (default: standard)" },
|
|
936
223
|
format: { type: "string", description: "mp4 | webm | mov (default: mp4)" },
|
|
937
224
|
"page-motion-blur": {
|
|
@@ -1026,7 +313,6 @@ var render_default = defineCommand({
|
|
|
1026
313
|
// fallow-ignore-next-line complexity
|
|
1027
314
|
async run({ args }) {
|
|
1028
315
|
const asJson = Boolean(args.json);
|
|
1029
|
-
const fps = parseIntFlag(args.fps, { flag: "--fps", min: 1, max: 240 });
|
|
1030
316
|
const quality = parseEnumFlag(args.quality, VALID_QUALITY, { flag: "--quality" });
|
|
1031
317
|
const format = parseEnumFlag(args.format, VALID_FORMAT, { flag: "--format" });
|
|
1032
318
|
const pageMotionBlur = parseEnumFlag(args["page-motion-blur"], ["off"], {
|
|
@@ -1047,6 +333,11 @@ var render_default = defineCommand({
|
|
|
1047
333
|
url: args.url
|
|
1048
334
|
});
|
|
1049
335
|
validateDryRunSource(project, args["dry-run"] ?? false);
|
|
336
|
+
const fps = parseIntFlag(resolveCloudFpsArg(project, args.fps, args.composition), {
|
|
337
|
+
flag: "--fps",
|
|
338
|
+
min: 1,
|
|
339
|
+
max: 240
|
|
340
|
+
});
|
|
1050
341
|
const aspectRatio = resolveAspectRatioForSubmit(
|
|
1051
342
|
project,
|
|
1052
343
|
args.composition,
|
|
@@ -1070,7 +361,8 @@ var render_default = defineCommand({
|
|
|
1070
361
|
project,
|
|
1071
362
|
args.composition,
|
|
1072
363
|
asJson,
|
|
1073
|
-
(file) => uploadAssetViaDirectUpload({ client, ...file })
|
|
364
|
+
(file) => uploadAssetViaDirectUpload({ client, ...file }),
|
|
365
|
+
variables && JSON.stringify(variables)
|
|
1074
366
|
) : void 0;
|
|
1075
367
|
const upload = await maybeUploadProject(
|
|
1076
368
|
client,
|
|
@@ -1253,14 +545,14 @@ function resolveVariablesAndValidateIfLocal(inline, filePath, strict, source, co
|
|
|
1253
545
|
function summarizeLargestFiles(fileMap) {
|
|
1254
546
|
return [...fileMap.entries()].map(([path, content]) => ({ path, size_bytes: stagedSize(content) })).sort((a, b) => b.size_bytes - a.size_bytes || a.path.localeCompare(b.path)).slice(0, LARGEST_FILE_COUNT);
|
|
1255
547
|
}
|
|
1256
|
-
async function prepareLocalArchive(source, composition, asJson, upload) {
|
|
548
|
+
async function prepareLocalArchive(source, composition, asJson, upload, variablesText) {
|
|
1257
549
|
const project = resolveProject(source.dir);
|
|
1258
550
|
if (!asJson) {
|
|
1259
551
|
console.log("");
|
|
1260
552
|
console.log(`${c.accent("\u25C6")} Zipping ${c.accent(project.name)}`);
|
|
1261
553
|
}
|
|
1262
554
|
const { fileMap, entryPath } = stageProjectFiles(project, composition);
|
|
1263
|
-
const offloaded = await offloadMedia(project, fileMap, entryPath, asJson, upload);
|
|
555
|
+
const offloaded = await offloadMedia(project, fileMap, entryPath, asJson, upload, variablesText);
|
|
1264
556
|
const onDiskBytes = [...fileMap.values()].filter((file) => !Buffer.isBuffer(file)).reduce((sum, file) => sum + stagedSize(file), 0);
|
|
1265
557
|
const archive = onDiskBytes > DIRECT_UPLOAD_LIMIT_BYTES ? void 0 : zipPublishFileMap(new Map([...fileMap].map(([path, file]) => [path, readStaged(file)])));
|
|
1266
558
|
const sizeBytes = archive?.buffer.byteLength ?? onDiskBytes;
|
|
@@ -1285,7 +577,7 @@ async function prepareLocalArchive(source, composition, asJson, upload) {
|
|
|
1285
577
|
function stageProjectFiles(project, composition) {
|
|
1286
578
|
try {
|
|
1287
579
|
const fileMap = stagePublishFiles(project.dir, OFFLOAD_MIN_BYTES);
|
|
1288
|
-
const entryPath =
|
|
580
|
+
const entryPath = relative(
|
|
1289
581
|
project.dir,
|
|
1290
582
|
resolvePath(project.dir, composition ?? "index.html")
|
|
1291
583
|
).replaceAll("\\", "/");
|
|
@@ -1301,13 +593,14 @@ function stageProjectFiles(project, composition) {
|
|
|
1301
593
|
failCommand();
|
|
1302
594
|
}
|
|
1303
595
|
}
|
|
1304
|
-
async function offloadMedia(project, fileMap, entryPath, asJson, upload) {
|
|
596
|
+
async function offloadMedia(project, fileMap, entryPath, asJson, upload, variablesText) {
|
|
1305
597
|
let offloaded;
|
|
1306
598
|
try {
|
|
1307
599
|
offloaded = await offloadHeavyMedia(project.dir, fileMap, {
|
|
1308
600
|
apiBaseUrl: resolveCloudBaseUrl(),
|
|
1309
601
|
upload,
|
|
1310
602
|
entryPath,
|
|
603
|
+
variablesText,
|
|
1311
604
|
onFile: (item) => (asJson ? console.error : console.log)(c.dim(` ${describeOffload(item, !upload)}`))
|
|
1312
605
|
});
|
|
1313
606
|
} catch (err) {
|
|
@@ -1324,6 +617,12 @@ async function offloadMedia(project, fileMap, entryPath, asJson, upload) {
|
|
|
1324
617
|
}
|
|
1325
618
|
return offloaded;
|
|
1326
619
|
}
|
|
620
|
+
function resolveCloudFpsArg(source, fps, composition) {
|
|
621
|
+
if (source.kind !== "dir") return fps;
|
|
622
|
+
const { dir } = resolveProject(source.dir);
|
|
623
|
+
const resolved = resolveDefaultFpsArg(fps, dir, resolvePath(dir, "index.html"), composition);
|
|
624
|
+
return resolved !== void 0 && /^\d+$/.test(resolved) ? resolved : fps;
|
|
625
|
+
}
|
|
1327
626
|
function assertArchiveFits(sizeBytes, largestFiles) {
|
|
1328
627
|
if (sizeBytes <= DIRECT_UPLOAD_LIMIT_BYTES) return;
|
|
1329
628
|
errorBox(
|
|
@@ -1531,5 +830,6 @@ export {
|
|
|
1531
830
|
render_default as default,
|
|
1532
831
|
examples,
|
|
1533
832
|
resolveAspectRatioForSubmit,
|
|
833
|
+
resolveCloudFpsArg,
|
|
1534
834
|
validateDryRunSource
|
|
1535
835
|
};
|