hyperframes 0.8.170 → 0.8.172
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-KDCZCEMQ.js → add-TJNZWO7P.js} +12 -11
- package/dist/{animatedGifPrep-MVP5LCEM.js → animatedGifPrep-K4WFG6KK.js} +7 -7
- package/dist/api.js +13 -13
- package/dist/{asset-6VH3OCEC.js → asset-QN5J2P7H.js} +2 -2
- package/dist/{assetCataloger-RN5A2SVA.js → assetCataloger-RLFDI5YD.js} +7 -7
- package/dist/{audio-636CQSXK.js → audio-QJ4C3NMN.js} +16 -15
- package/dist/{auth-AHLKM4M2.js → auth-K7EHUGWE.js} +1 -1
- package/dist/{autoUpdate-5UA6TJW7.js → autoUpdate-76QXHQRT.js} +2 -2
- package/dist/{backgroundChecks-DP242536.js → backgroundChecks-NMYRM5LV.js} +3 -3
- package/dist/backgroundChecksWorker.js +3 -3
- package/dist/{batchRender-KWBVAUE3.js → batchRender-RENYERF5.js} +3 -3
- package/dist/{beats-HKY5L463.js → beats-ZOR2HBAR.js} +4 -4
- package/dist/{benchmark-4YQDVIO5.js → benchmark-CY2VFIKL.js} +8 -8
- package/dist/{browser-7ZPWXEYW.js → browser-NPCKLUT7.js} +3 -3
- package/dist/{bundleWithLocalizedFonts-42V34HJF.js → bundleWithLocalizedFonts-FKH55KKW.js} +2 -2
- package/dist/{capture-572X5NDD.js → capture-IC2QJMMQ.js} +11 -11
- package/dist/{capture-VXMUZSBI.js → capture-TMSBTUYU.js} +2 -2
- package/dist/{catalog-PUUTHPP7.js → catalog-N7OCMRPT.js} +12 -11
- package/dist/{catch-up-K6CV44WQ.js → catch-up-2MGK5I2D.js} +4 -4
- package/dist/{check-MBDLSWCY.js → check-NU4GL2WC.js} +37 -36
- package/dist/{checkBrowser-33UWWDZG.js → checkBrowser-HRXAL4QD.js} +34 -33
- package/dist/{chunk-T5LGOTQR.js → chunk-257IUNPQ.js} +1 -1
- package/dist/{chunk-WZQSL7UX.js → chunk-2VR7HIPZ.js} +2 -2
- package/dist/{chunk-WLNNWLIE.js → chunk-4N2YVSXH.js} +7 -7
- package/dist/{chunk-CFBGKAKQ.js → chunk-4UR2EQSR.js} +10 -10
- package/dist/{chunk-PP64Q43K.js → chunk-5B57KZJX.js} +1 -1
- package/dist/{chunk-IWFLMU2N.js → chunk-6BNTGNGD.js} +56 -16
- package/dist/{chunk-UDDJQEGS.js → chunk-6K2N6WPO.js} +22 -8
- package/dist/{chunk-JAERN4RH.js → chunk-7DVH2IQQ.js} +1 -1
- package/dist/{chunk-MSFON5DJ.js → chunk-AG2O2USE.js} +3 -3
- package/dist/{chunk-PH3RS5X4.js → chunk-BQYQV6JP.js} +2 -2
- package/dist/{chunk-WICIV6R3.js → chunk-BRHI7EIA.js} +3 -5
- package/dist/{chunk-PXA4S6OE.js → chunk-C2F37AXS.js} +2 -2
- package/dist/{chunk-AWSVUIWG.js → chunk-CDXC2UQ7.js} +1 -1
- package/dist/{chunk-ZINH7YA2.js → chunk-CUDHVUIF.js} +1 -1
- package/dist/{chunk-QO3JEPEW.js → chunk-DOV2QOFY.js} +2 -2
- package/dist/{chunk-EJYBYR4C.js → chunk-DQRZWV3B.js} +1 -1
- package/dist/{chunk-KUW4LWY6.js → chunk-EKKROA7V.js} +1 -1
- package/dist/{chunk-KUFEPCR3.js → chunk-FQP7TLRF.js} +2 -2
- package/dist/{chunk-AGHHZIZN.js → chunk-FXHGO3NH.js} +2 -2
- package/dist/{chunk-G6GKIAEM.js → chunk-FYR6GKFN.js} +3 -3
- package/dist/{chunk-PLWORQFC.js → chunk-G47TXPYN.js} +1 -1
- package/dist/{chunk-JGYHWVXQ.js → chunk-GMJ3ILLW.js} +34 -13
- package/dist/{chunk-LWB3KZ5E.js → chunk-HN5WVJZB.js} +1 -1
- package/dist/{chunk-2UD6O6QG.js → chunk-HZWXDKYB.js} +73 -23
- package/dist/chunk-JHOCK3DG.js +27 -0
- package/dist/{chunk-FSP2JNAP.js → chunk-K6SBDWUV.js} +1 -1
- package/dist/{chunk-NSJLCWLG.js → chunk-KOMXCNZX.js} +1 -1
- package/dist/{chunk-UUP4KOMD.js → chunk-KRMOJUVL.js} +9 -5
- package/dist/{chunk-AUMJ3QSO.js → chunk-KRTCHLBA.js} +2 -2
- package/dist/{chunk-FAORS3UR.js → chunk-M235XUHL.js} +2 -2
- package/dist/{chunk-GU5FLCZV.js → chunk-MEEETF7G.js} +1 -1
- package/dist/{chunk-PCX3YF2U.js → chunk-MFWQEG2W.js} +1 -1
- package/dist/{chunk-PECICVTJ.js → chunk-NLEDKGZT.js} +2 -2
- package/dist/{chunk-44GV6ZMC.js → chunk-NYXHZOPD.js} +22 -12
- package/dist/{chunk-VKFYI7AQ.js → chunk-NZ5HOUJH.js} +3 -3
- package/dist/{chunk-QZUVPWC4.js → chunk-PDFMNU6D.js} +1 -1
- package/dist/chunk-Q2E3DQII.js +3803 -0
- package/dist/{chunk-GG3V5BHG.js → chunk-QQI7R2QL.js} +1 -1
- package/dist/{chunk-4RXJG3SY.js → chunk-QVVANKN2.js} +9 -9
- package/dist/{chunk-GBWSBTEE.js → chunk-R2P2SANE.js} +2 -2
- package/dist/{chunk-YFGJVADL.js → chunk-R73GAMUQ.js} +9 -9
- package/dist/{chunk-T56MM7RC.js → chunk-S6JCFZVB.js} +2 -2
- package/dist/{chunk-4B6PUT4R.js → chunk-TV2N4UIJ.js} +1 -1
- package/dist/{chunk-BAW7UNLK.js → chunk-UFAKRR5G.js} +9 -9
- package/dist/{chunk-EHDKCMKX.js → chunk-UIDRXHUY.js} +1 -1
- package/dist/{chunk-2E7NDKTN.js → chunk-UNALPZL6.js} +4 -3
- package/dist/{chunk-NYCJCQNY.js → chunk-V5IZAL3H.js} +4 -4
- package/dist/{chunk-X3U6KEID.js → chunk-VQSSP7XG.js} +1 -1
- package/dist/{chunk-QABAVWEX.js → chunk-W47D3KOB.js} +1 -1
- package/dist/{chunk-OGVQJHNM.js → chunk-XEJUMBIC.js} +3 -3
- package/dist/{chunk-UQPH3Y45.js → chunk-YAA3AOBA.js} +2 -2
- package/dist/{chunk-MXMIVNUE.js → chunk-YHECAUDC.js} +39 -9
- package/dist/{chunk-LMMFO5UV.js → chunk-Z5ENX63S.js} +2 -2
- package/dist/{chunk-ERJHLFPD.js → chunk-Z6L3W5KZ.js} +2 -2
- package/dist/{chunk-V2T7FFPB.js → chunk-ZY43P2M7.js} +1 -1
- package/dist/{clean-5AXXHD45.js → clean-JDODBRVL.js} +14 -14
- package/dist/cli.js +53 -53
- package/dist/{cloud-DQCCYKOB.js → cloud-YHJZ72XP.js} +4 -4
- package/dist/{cloudrun-CDFL5JBL.js → cloudrun-E5EOHYTG.js} +4 -4
- package/dist/{compare-6RB5X3SO.js → compare-VQQXHSE3.js} +28 -27
- package/dist/{compiler-GU5GPO5A.js → compiler-I4GWSEK3.js} +4 -4
- package/dist/{component-7RRNNC5F.js → component-WOSMKPL7.js} +3 -3
- package/dist/{compositions-CANET3EJ.js → compositions-WLJE5752.js} +11 -11
- package/dist/{delete-KEZJPDWJ.js → delete-PILRKH5C.js} +2 -2
- package/dist/{dist-OTCFZEKF.js → dist-7TYQROOE.js} +2 -2
- package/dist/{dist-IDZRZHGE.js → dist-SDXOTECD.js} +2 -2
- package/dist/{doctor-5RAEGA6G.js → doctor-FNICQNSA.js} +9 -9
- package/dist/{events-4ZJSJ76H.js → events-5WNYSVPY.js} +2 -2
- package/dist/{events-SHOWEHI5.js → events-YXPWFV5S.js} +3 -3
- package/dist/{feedback-4IIGUUYZ.js → feedback-KLA5RSSN.js} +6 -6
- package/dist/{figma-BFDECPE5.js → figma-PQIZI67M.js} +3 -3
- package/dist/fontLocalizeCli.js +9 -9
- package/dist/{get-BO32YZUQ.js → get-OBOWSUA7.js} +2 -2
- package/dist/{gpuPolicy-QWJYZLVJ.js → gpuPolicy-HWH4OW6H.js} +7 -7
- package/dist/{grade-compare-SW4SAG5R.js → grade-compare-5IOHWZX6.js} +28 -27
- package/dist/{help-7AMSMPUF.js → help-K4IK2N36.js} +1 -1
- package/dist/{history-VXAQFJJV.js → history-AC5ZUFOX.js} +7 -7
- package/dist/hyperframe-runtime.js +56 -56
- package/dist/hyperframe.manifest.json +1 -1
- package/dist/hyperframe.runtime.iife.js +56 -56
- package/dist/hyperframes-player.global.js +3 -3
- package/dist/{info-KN4TX6T5.js → info-BD6555FQ.js} +7 -7
- package/dist/{init-7A2T7LDW.js → init-KTNJH3QB.js} +23 -22
- package/dist/{inspect-CCCV6JFV.js → inspect-PF2DWLRP.js} +29 -28
- package/dist/{installer-ZCCZUOPN.js → installer-72NGZ5BM.js} +4 -4
- package/dist/{keyframes-K6XNZGK3.js → keyframes-P3GRO3LL.js} +7 -7
- package/dist/{lambda-B2K237DX.js → lambda-XRNX7HLH.js} +5 -5
- package/dist/{layout-HAPR5OV4.js → layout-KN7SX3WH.js} +29 -28
- package/dist/{lint-3COFAXAJ.js → lint-TXBEZUA5.js} +8 -8
- package/dist/{lintProject-PXB5Y6TX.js → lintProject-65YGC4UB.js} +2 -2
- package/dist/{list-QCNHO7DR.js → list-4YL3BA2G.js} +2 -2
- package/dist/{login-BAFYZS6W.js → login-JUI7PHHJ.js} +4 -4
- package/dist/{media-treatment-C53ZBW2B.js → media-treatment-6DDWZLLE.js} +17 -20
- package/dist/{models-INX67ETR.js → models-CLSFYHTD.js} +10 -10
- package/dist/{motionShot-UOS26VLB.js → motionShot-WMJSRE67.js} +15 -15
- package/dist/{normalize-audio-I7HGJGA5.js → normalize-audio-YZTHI75G.js} +4 -4
- package/dist/{open-RFXGV4RY.js → open-VSJ3TPAB.js} +4 -4
- package/dist/{parakeetRunner-PCCBODBS.js → parakeetRunner-YCZT3DG2.js} +10 -10
- package/dist/{pipeline-GDC7SL5N.js → pipeline-RV64A4MZ.js} +7 -7
- package/dist/{play-DRCWK35L.js → play-CF6TJIQL.js} +20 -19
- package/dist/{present-HUJV553D.js → present-5XKI26BN.js} +15 -15
- package/dist/{preview-CZENYIGN.js → preview-RORZIRSN.js} +22 -18
- package/dist/{producer-23NJEJRO.js → producer-K2H3YFX5.js} +1 -1
- package/dist/{projectConfig-R3FCIARW.js → projectConfig-Q2ECBQUG.js} +7 -6
- package/dist/{publication-GY3OJ6VH.js → publication-2V3WX4HW.js} +2 -2
- package/dist/{publish-XBW4NVFY.js → publish-7COI3FRD.js} +10 -9
- package/dist/{remove-background-Q7CQ3PJF.js → remove-background-QSOESZXW.js} +8 -8
- package/dist/{render-DOHHCT2G.js → render-3ZLZDN64.js} +8 -8
- package/dist/{render-WWAXTKYR.js → render-ACRKADG6.js} +27 -26
- package/dist/{render-24JWWXMA.js → render-KHDJ2P4J.js} +3 -3
- package/dist/{render-batch-EK4ZBQHH.js → render-batch-OG3JHMDF.js} +7 -20
- package/dist/renderSetupWorker.js +2 -2
- package/dist/{resolver-5Y6VNMTC.js → resolver-ALLVWDQE.js} +5 -4
- package/dist/{sherpa-VMADZBF7.js → sherpa-QY3NGRLC.js} +9 -9
- package/dist/{skills-ONFYYL6R.js → skills-YIZYEARC.js} +5 -5
- package/dist/{skillsUpdateCheck-JTHZOHRT.js → skillsUpdateCheck-EXZOQQRS.js} +3 -3
- package/dist/{snapshot-SUA62VQ2.js → snapshot-3XMGHMRD.js} +31 -30
- package/dist/{src-J6KABXGZ.js → src-CGIRN4KP.js} +8 -8
- package/dist/{src-VFTQPSQD.js → src-RY4V2ZZT.js} +6 -6
- package/dist/{staticProjectServer-XQPUABYX.js → staticProjectServer-4E3ODA5P.js} +16 -15
- package/dist/studio/assets/{hyperframes-player-Dsmhm7Q8.js → hyperframes-player-BDj9J28W.js} +2 -2
- package/dist/studio/assets/{index-DT1wigvW.js → index--HWjGqrU.js} +1 -1
- package/dist/studio/assets/{index-CV00F8qG.js → index-CVxB8lqm.js} +101 -101
- package/dist/studio/index.html +1 -1
- package/dist/{studio-api-MBDDFEA2.js → studio-api-LTHBT45F.js} +9 -9
- package/dist/{studioServer-7HWDCLKT.js → studioServer-NDRRYB5V.js} +47 -41
- package/dist/{telemetry-763NW3QF.js → telemetry-QBHPMHPC.js} +3 -3
- package/dist/{timeline-ZLFPNI27.js → timeline-J22LXNAI.js} +17 -17
- package/dist/{tokens-RXJLVZKD.js → tokens-EAPT2GUT.js} +2 -2
- package/dist/{transcribe-UDISJXCZ.js → transcribe-6LCZK44H.js} +14 -14
- package/dist/{transcribe-IM5UNBSH.js → transcribe-L5GHBNR6.js} +8 -8
- package/dist/{updateCheck-V2RXHFQL.js → updateCheck-B3U7O3QS.js} +2 -2
- package/dist/{upgrade-MJI3EW3W.js → upgrade-UMJEDSYD.js} +2 -2
- package/dist/{urlDownloader-BOLOMGC7.js → urlDownloader-SRL6J4NU.js} +6 -6
- package/dist/{validate-IM5NPJHI.js → validate-I3KHH5Z4.js} +22 -22
- package/dist/{video-HUNOZDLT.js → video-HWLZYFUC.js} +7 -7
- package/package.json +1 -1
- package/dist/chunk-6M3IPJS6.js +0 -3803
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
machServiceDenied,
|
|
11
11
|
oneProcessOverPipe,
|
|
12
12
|
sandboxDeniedRemediation
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-BRHI7EIA.js";
|
|
14
14
|
import {
|
|
15
15
|
resolveCaptureBrowserGpuMode
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-C2F37AXS.js";
|
|
17
17
|
import {
|
|
18
18
|
isNavigationTimeoutError,
|
|
19
19
|
withRemainingBudget
|
|
@@ -36,6 +36,7 @@ var closing = /* @__PURE__ */ new WeakMap();
|
|
|
36
36
|
var pending = /* @__PURE__ */ new Map();
|
|
37
37
|
var sessionCleanups = /* @__PURE__ */ new Set();
|
|
38
38
|
var CLOSE_GRACE_MS = 1e3;
|
|
39
|
+
var LAUNCH_TIMEOUT_MS = 3e4;
|
|
39
40
|
var EXIT_POLL_MS = 50;
|
|
40
41
|
var listening = false;
|
|
41
42
|
var shutdown;
|
|
@@ -58,6 +59,7 @@ function ownSignals() {
|
|
|
58
59
|
}
|
|
59
60
|
async function resolveManagedGpuMode(requestedMode, chromePath, context = {}) {
|
|
60
61
|
ownSignals();
|
|
62
|
+
if (requestedMode === "auto" && inAgentSandbox()) return "software";
|
|
61
63
|
return resolveCaptureBrowserGpuMode(requestedMode, chromePath, {
|
|
62
64
|
launch: async (puppeteer, options) => {
|
|
63
65
|
context.signal?.throwIfAborted();
|
|
@@ -99,12 +101,15 @@ async function launchOwnedBrowser(puppeteer, options) {
|
|
|
99
101
|
ownSignals();
|
|
100
102
|
const abort = new AbortController();
|
|
101
103
|
const signal = options.signal ? AbortSignal.any([options.signal, abort.signal]) : abort.signal;
|
|
102
|
-
const launch =
|
|
103
|
-
...options,
|
|
104
|
-
signal
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const launch = untilLaunchOrAbort(
|
|
105
|
+
puppeteer.launch({ ...options, signal, handleSIGINT: false, handleSIGTERM: false }),
|
|
106
|
+
signal
|
|
107
|
+
);
|
|
108
|
+
const limit = options.timeout ?? LAUNCH_TIMEOUT_MS;
|
|
109
|
+
const timer = limit > 0 ? setTimeout(
|
|
110
|
+
() => abort.abort(new Error(`The browser did not finish starting within ${limit} ms.`)),
|
|
111
|
+
limit
|
|
112
|
+
) : void 0;
|
|
108
113
|
pending.set(launch, abort);
|
|
109
114
|
try {
|
|
110
115
|
const browser = await launch;
|
|
@@ -114,9 +119,18 @@ async function launchOwnedBrowser(puppeteer, options) {
|
|
|
114
119
|
child.once("exit", () => browsers.delete(browser));
|
|
115
120
|
return browser;
|
|
116
121
|
} finally {
|
|
122
|
+
clearTimeout(timer);
|
|
117
123
|
pending.delete(launch);
|
|
118
124
|
}
|
|
119
125
|
}
|
|
126
|
+
function untilLaunchOrAbort(launch, signal) {
|
|
127
|
+
const aborted = new Promise((_, reject) => {
|
|
128
|
+
if (signal.aborted) reject(signal.reason);
|
|
129
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
130
|
+
});
|
|
131
|
+
void launch.then((late) => signal.aborted ? closeManagedBrowser(late) : void 0).catch(() => void 0);
|
|
132
|
+
return Promise.race([launch, aborted]);
|
|
133
|
+
}
|
|
120
134
|
async function closeManagedBrowsers() {
|
|
121
135
|
for (const abort of pending.values()) abort.abort();
|
|
122
136
|
await Promise.allSettled(pending.keys());
|
|
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
getMimeType,
|
|
9
9
|
injectMediaCodecMapIntoHtml
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-YHECAUDC.js";
|
|
11
11
|
import {
|
|
12
12
|
PROXY_VARIANT_CONFIG,
|
|
13
13
|
ProxyCapacityError,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
recordProxyRequest,
|
|
19
19
|
resolveProxy,
|
|
20
20
|
resolveProxyVariantRequest
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-FXHGO3NH.js";
|
|
22
22
|
import {
|
|
23
23
|
resolveAutoProxy
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-MFWQEG2W.js";
|
|
25
25
|
import {
|
|
26
26
|
decodeWellFormedEscapes
|
|
27
27
|
} from "./chunk-BSQ7XANM.js";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
DEFAULT_VP9_CPU_USED,
|
|
9
9
|
isHttpUrl,
|
|
10
10
|
runFfmpeg
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NZ5HOUJH.js";
|
|
12
12
|
import {
|
|
13
13
|
parseAnimatedGifMetadata
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PDFMNU6D.js";
|
|
15
15
|
import {
|
|
16
16
|
parseHTML
|
|
17
17
|
} from "./chunk-SDYDNHEE.js";
|
|
@@ -8,6 +8,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
8
8
|
// src/browser/sandboxDenied.ts
|
|
9
9
|
var MACH_SERVICE_DENIED = /bootstrap_check_in\b[^\n]*Permission denied/;
|
|
10
10
|
var SINGLE_PROCESS = "--single-process";
|
|
11
|
+
var CPU_COMPOSITING = "--disable-gpu-compositing";
|
|
11
12
|
function machServiceDenied(errorMessage) {
|
|
12
13
|
return MACH_SERVICE_DENIED.test(errorMessage);
|
|
13
14
|
}
|
|
@@ -16,11 +17,8 @@ function inAgentSandbox(env = process.env, platform = process.platform) {
|
|
|
16
17
|
}
|
|
17
18
|
function oneProcessOverPipe(options) {
|
|
18
19
|
const args = options.args ?? [];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
pipe: true,
|
|
22
|
-
args: args.includes(SINGLE_PROCESS) ? args : [...args, SINGLE_PROCESS]
|
|
23
|
-
};
|
|
20
|
+
const missing = [SINGLE_PROCESS, CPU_COMPOSITING].filter((flag) => !args.includes(flag));
|
|
21
|
+
return { ...options, pipe: true, args: [...args, ...missing] };
|
|
24
22
|
}
|
|
25
23
|
function isOneProcessOverPipe(options) {
|
|
26
24
|
return options.pipe === true && (options.args ?? []).includes(SINGLE_PROCESS);
|
|
@@ -7,7 +7,7 @@ var __dirname = __hf_dirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
resolveConfig,
|
|
9
9
|
usesSoftwareWebGpu
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NZ5HOUJH.js";
|
|
11
11
|
|
|
12
12
|
// src/browser/gpuPolicy.ts
|
|
13
13
|
function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
|
|
@@ -17,7 +17,7 @@ function resolveLocalBrowserGpuMode(browserGpuArg, envMode = process.env.PRODUCE
|
|
|
17
17
|
return "auto";
|
|
18
18
|
}
|
|
19
19
|
async function resolveCaptureBrowserGpuMode(requestedMode, chromePath, probeLifecycle) {
|
|
20
|
-
const { resolveBrowserGpuMode } = await import("./src-
|
|
20
|
+
const { resolveBrowserGpuMode } = await import("./src-RY4V2ZZT.js");
|
|
21
21
|
return resolveBrowserGpuMode(requestedMode, { chromePath, probeLifecycle });
|
|
22
22
|
}
|
|
23
23
|
function resolveLocalWebGpu(browserGpuMode, requiresWebGpu) {
|
|
@@ -6,7 +6,7 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
shouldTrack
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-K6SBDWUV.js";
|
|
10
10
|
|
|
11
11
|
// src/telemetry/renderObservability.ts
|
|
12
12
|
function renderObservabilityTelemetryPayload(observability) {
|
|
@@ -8,14 +8,14 @@ import {
|
|
|
8
8
|
DEFAULT_REGISTRY_URL,
|
|
9
9
|
fetchItemFile,
|
|
10
10
|
validRegistryItem
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UNALPZL6.js";
|
|
12
12
|
import {
|
|
13
13
|
publishRegistryFile,
|
|
14
14
|
registryTargetPath
|
|
15
15
|
} from "./chunk-GMECXFAN.js";
|
|
16
16
|
import {
|
|
17
17
|
validateVariables
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PDFMNU6D.js";
|
|
19
19
|
import {
|
|
20
20
|
realProjectRoot
|
|
21
21
|
} from "./chunk-OFQWTKPW.js";
|
|
@@ -6,14 +6,14 @@ var __filename = __hf_fileURLToPath(import.meta.url);
|
|
|
6
6
|
var __dirname = __hf_dirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
resolveProject
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DQRZWV3B.js";
|
|
10
10
|
import {
|
|
11
11
|
DEFAULT_HISTORY_ROOT,
|
|
12
12
|
HistoryBusyError,
|
|
13
13
|
MAX_WINDOW_IDLE_MS,
|
|
14
14
|
openProjectHistory,
|
|
15
15
|
readProjectHistory
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GMJ3ILLW.js";
|
|
17
17
|
import {
|
|
18
18
|
findPreviewServerForProject,
|
|
19
19
|
studioApiUrl
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
formatPreviewProxyBox,
|
|
10
10
|
hdrToSdrToneMapFilter,
|
|
11
11
|
parseFirstFrameColour
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PDFMNU6D.js";
|
|
13
13
|
import {
|
|
14
14
|
decodeAuthoredAttribute,
|
|
15
15
|
scanHtmlOpeningTags
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
isRemoteOrInlineUrl,
|
|
25
25
|
isUnresolvedAssetPlaceholder,
|
|
26
26
|
resolveExistingLocalAsset
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-6BNTGNGD.js";
|
|
28
28
|
import {
|
|
29
29
|
findFfBinary
|
|
30
30
|
} from "./chunk-VAS6HQX3.js";
|
|
@@ -32,21 +32,21 @@ import {
|
|
|
32
32
|
import {
|
|
33
33
|
getUpdateMeta,
|
|
34
34
|
withMeta
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-QQI7R2QL.js";
|
|
36
36
|
import {
|
|
37
37
|
CONFIG_PATH,
|
|
38
38
|
withFileLock
|
|
39
39
|
} from "./chunk-XUXGIA7H.js";
|
|
40
40
|
import {
|
|
41
41
|
VERSION
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-YAA3AOBA.js";
|
|
43
43
|
import {
|
|
44
44
|
OPTIONAL_PACKAGES,
|
|
45
45
|
installedOptionalPackageVersion
|
|
46
46
|
} from "./chunk-3DKN5WKL.js";
|
|
47
47
|
import {
|
|
48
48
|
resolveExtractCacheDir
|
|
49
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-NZ5HOUJH.js";
|
|
50
50
|
import {
|
|
51
51
|
normalizeErrorMessage
|
|
52
52
|
} from "./chunk-KNU5COPB.js";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
mkdirWithinProject
|
|
19
19
|
} from "./chunk-OFQWTKPW.js";
|
|
20
20
|
|
|
21
|
-
// ../studio-server/dist/chunk-
|
|
21
|
+
// ../studio-server/dist/chunk-GG4AS4RK.js
|
|
22
22
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
23
23
|
import { mkdir as mkdir2, readdir as readdir3, rm as rm3, rmdir, writeFile } from "fs/promises";
|
|
24
24
|
import {
|
|
@@ -37,7 +37,7 @@ import { createHash, randomUUID } from "crypto";
|
|
|
37
37
|
import { readFileSync as readFileSync2 } from "fs";
|
|
38
38
|
import { isAbsolute, relative, resolve, sep } from "path";
|
|
39
39
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
40
|
-
import { linkSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
40
|
+
import { linkSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
|
|
41
41
|
import { join } from "path";
|
|
42
42
|
import { createHash as createHash2 } from "crypto";
|
|
43
43
|
import { lstatSync, readFileSync as readFileSync3, readdirSync } from "fs";
|
|
@@ -61,14 +61,14 @@ var PREVIEW_IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
|
61
61
|
"renders"
|
|
62
62
|
]);
|
|
63
63
|
|
|
64
|
-
// ../studio-server/dist/chunk-
|
|
64
|
+
// ../studio-server/dist/chunk-GG4AS4RK.js
|
|
65
65
|
import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
|
|
66
|
-
import { constants, createReadStream, createWriteStream, renameSync } from "fs";
|
|
66
|
+
import { constants, createReadStream, createWriteStream, renameSync as renameSync2 } from "fs";
|
|
67
67
|
import { copyFile, mkdir, readdir, readFile, rename, rm, stat } from "fs/promises";
|
|
68
68
|
import { dirname, join as join2 } from "path";
|
|
69
69
|
import { pipeline } from "stream/promises";
|
|
70
70
|
import { randomUUID as randomUUID5 } from "crypto";
|
|
71
|
-
import { readdirSync as readdirSync2, readFileSync as readFileSync5, renameSync as
|
|
71
|
+
import { readdirSync as readdirSync2, readFileSync as readFileSync5, renameSync as renameSync3, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
72
72
|
import { lstat, readdir as readdir2, rm as rm2 } from "fs/promises";
|
|
73
73
|
import { tmpdir } from "os";
|
|
74
74
|
import { dirname as dirname2, join as join4 } from "path";
|
|
@@ -76,7 +76,7 @@ import { randomUUID as randomUUID4 } from "crypto";
|
|
|
76
76
|
import { existsSync, mkdirSync as mkdirSync2, readFileSync as readFileSync4, statSync, writeFileSync as writeFileSync2 } from "fs";
|
|
77
77
|
import { basename, join as join3, resolve as resolve3 } from "path";
|
|
78
78
|
import { createHash as createHash5, randomUUID as randomUUID6 } from "crypto";
|
|
79
|
-
import { createReadStream as createReadStream2, existsSync as existsSync2, readFileSync as readFileSync8, renameSync as
|
|
79
|
+
import { createReadStream as createReadStream2, existsSync as existsSync2, readFileSync as readFileSync8, renameSync as renameSync4, statSync as statSync3 } from "fs";
|
|
80
80
|
import { isAbsolute as isAbsolute4, join as join7, resolve as resolve6 } from "path";
|
|
81
81
|
import { createHash as createHash4 } from "crypto";
|
|
82
82
|
import {
|
|
@@ -182,12 +182,14 @@ function newestReceipt(absPath, expectedVersion) {
|
|
|
182
182
|
}
|
|
183
183
|
var consumeFileWriteReceipt = identifyFileWrite;
|
|
184
184
|
var HistoryBusyError = class extends Error {
|
|
185
|
-
constructor(pid) {
|
|
185
|
+
constructor(pid, url) {
|
|
186
186
|
super(`This project's history is open in another process (pid ${pid}).`);
|
|
187
187
|
this.pid = pid;
|
|
188
|
+
this.url = url;
|
|
188
189
|
this.name = "HistoryBusyError";
|
|
189
190
|
}
|
|
190
191
|
pid;
|
|
192
|
+
url;
|
|
191
193
|
};
|
|
192
194
|
function alive(pid) {
|
|
193
195
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
@@ -238,14 +240,32 @@ function evictDeadOwner(file) {
|
|
|
238
240
|
releaseOwn(evictor);
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
|
-
|
|
243
|
+
function advertise(urlFile, url) {
|
|
244
|
+
if (!url) return rmSync(urlFile, { force: true });
|
|
245
|
+
const draft = `${urlFile}-${process.pid}-${randomUUID2()}.tmp`;
|
|
246
|
+
writeFileSync(draft, JSON.stringify({ pid: process.pid, url }));
|
|
247
|
+
renameSync(draft, urlFile);
|
|
248
|
+
}
|
|
249
|
+
function servedBy(file, urlFile, pid) {
|
|
250
|
+
try {
|
|
251
|
+
const said = JSON.parse(readFileSync(urlFile, "utf-8"));
|
|
252
|
+
const live = said.pid === pid && alive(pid) && ownerOf(file) === pid;
|
|
253
|
+
return live && typeof said.url === "string" ? said.url : void 0;
|
|
254
|
+
} catch {
|
|
255
|
+
return void 0;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
async function takeHistoryOwnership(home, waitMs, url) {
|
|
242
259
|
const file = join(home, "owner.pid");
|
|
260
|
+
const urlFile = join(home, "owner-url.json");
|
|
243
261
|
const deadline = Date.now() + waitMs;
|
|
244
262
|
mkdirSync(home, { recursive: true });
|
|
245
263
|
for (; ; ) {
|
|
246
264
|
if (claim(file)) {
|
|
265
|
+
advertise(urlFile, url);
|
|
247
266
|
let held = true;
|
|
248
267
|
return () => {
|
|
268
|
+
if (held && servedBy(file, urlFile, process.pid)) rmSync(urlFile, { force: true });
|
|
249
269
|
if (held) releaseOwn(file);
|
|
250
270
|
held = false;
|
|
251
271
|
};
|
|
@@ -253,7 +273,7 @@ async function takeHistoryOwnership(home, waitMs) {
|
|
|
253
273
|
const pid = ownerOf(file);
|
|
254
274
|
if (pid === null) continue;
|
|
255
275
|
if (!alive(pid) && evictDeadOwner(file)) continue;
|
|
256
|
-
if (Date.now() >= deadline) throw new HistoryBusyError(pid);
|
|
276
|
+
if (Date.now() >= deadline) throw new HistoryBusyError(pid, servedBy(file, urlFile, pid));
|
|
257
277
|
await new Promise((settle) => setTimeout(settle, 50));
|
|
258
278
|
}
|
|
259
279
|
}
|
|
@@ -496,7 +516,7 @@ async function cloneOrCopy(from, to, beforeReplace) {
|
|
|
496
516
|
try {
|
|
497
517
|
await copyFile(from, temp, constants.COPYFILE_FICLONE);
|
|
498
518
|
beforeReplace?.();
|
|
499
|
-
|
|
519
|
+
renameSync2(temp, to);
|
|
500
520
|
} catch (error) {
|
|
501
521
|
await rm(temp, { force: true });
|
|
502
522
|
throw error;
|
|
@@ -697,7 +717,7 @@ function recheckAndMoveAway(historyRoot, id, { now, dryRun, tempDir }) {
|
|
|
697
717
|
if (projectDir === null) return null;
|
|
698
718
|
if (dryRun) return { projectDir, trash: null };
|
|
699
719
|
const trash = join4(historyRoot, `${PRUNED_PREFIX}${id}-${randomUUID5()}`);
|
|
700
|
-
|
|
720
|
+
renameSync3(home, trash);
|
|
701
721
|
return { projectDir, trash };
|
|
702
722
|
}
|
|
703
723
|
function abandonedProject(home, id, now, tempDir) {
|
|
@@ -1119,7 +1139,7 @@ async function updateState(dir, update) {
|
|
|
1119
1139
|
state = readState(dir);
|
|
1120
1140
|
} catch (error) {
|
|
1121
1141
|
if (!(error instanceof SyntaxError)) throw error;
|
|
1122
|
-
|
|
1142
|
+
renameSync4(statePath(dir), `${statePath(dir)}.invalid-${randomUUID6()}`);
|
|
1123
1143
|
state = emptyState();
|
|
1124
1144
|
}
|
|
1125
1145
|
update(state);
|
|
@@ -2401,7 +2421,8 @@ async function openProjectHistory(options) {
|
|
|
2401
2421
|
const projectId = projectHistoryId(options.projectDir, options.historyRoot);
|
|
2402
2422
|
const release = await takeHistoryOwnership(
|
|
2403
2423
|
join8(options.historyRoot, projectId),
|
|
2404
|
-
options.ownerWaitMs ?? 5e3
|
|
2424
|
+
options.ownerWaitMs ?? 5e3,
|
|
2425
|
+
options.ownerUrl
|
|
2405
2426
|
);
|
|
2406
2427
|
try {
|
|
2407
2428
|
const blobs = await openBlobStore(join8(options.historyRoot, projectId, "blobs"));
|
|
@@ -1278,7 +1278,7 @@ async function withFigmaErrors(command, fn) {
|
|
|
1278
1278
|
} catch (err) {
|
|
1279
1279
|
if (err instanceof Error) {
|
|
1280
1280
|
try {
|
|
1281
|
-
const { trackCommandFailure } = await import("./events-
|
|
1281
|
+
const { trackCommandFailure } = await import("./events-YXPWFV5S.js");
|
|
1282
1282
|
trackCommandFailure(
|
|
1283
1283
|
command,
|
|
1284
1284
|
err,
|
|
@@ -9,28 +9,28 @@ import {
|
|
|
9
9
|
launchManagedBrowser,
|
|
10
10
|
resolveManagedGpuMode,
|
|
11
11
|
rethrowAfterBrowserCleanup
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6K2N6WPO.js";
|
|
13
13
|
import {
|
|
14
14
|
resolveCompositionViewportFromHtml
|
|
15
15
|
} from "./chunk-FH7WODJH.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveDiagnosticNavigationTimeoutMs,
|
|
18
18
|
windowsChromeCrashRemediation
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Z5ENX63S.js";
|
|
20
20
|
import {
|
|
21
21
|
oneProcessOverPipe
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-BRHI7EIA.js";
|
|
23
23
|
import {
|
|
24
24
|
resolveLocalBrowserGpuMode,
|
|
25
25
|
resolveLocalWebGpu
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-C2F37AXS.js";
|
|
27
27
|
import {
|
|
28
28
|
c
|
|
29
29
|
} from "./chunk-ZTZA4UWZ.js";
|
|
30
30
|
import {
|
|
31
31
|
assertWebGpuAdapterAvailable,
|
|
32
32
|
compositionRequiresWebGpu
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-NZ5HOUJH.js";
|
|
34
34
|
import {
|
|
35
35
|
normalizeErrorMessage
|
|
36
36
|
} from "./chunk-KNU5COPB.js";
|
|
@@ -52,7 +52,8 @@ var DENSE_GEOMETRY_SEEK_OPTIONS = {
|
|
|
52
52
|
animationFrameSettle: "none",
|
|
53
53
|
waitForFontsMs: 0,
|
|
54
54
|
settleMs: 0,
|
|
55
|
-
waitForVideoFrames: false
|
|
55
|
+
waitForVideoFrames: false,
|
|
56
|
+
skipWebglDraws: true
|
|
56
57
|
};
|
|
57
58
|
function resolveCliChromeGpuMode(envMode = process.env.PRODUCER_BROWSER_GPU_MODE) {
|
|
58
59
|
return resolveLocalBrowserGpuMode(void 0, envMode);
|
|
@@ -113,9 +114,9 @@ async function openSettledCompositionPage(html, url, options) {
|
|
|
113
114
|
const { ensureBrowser, findSystemBrowser } = await import("./manager-HEUPD2YB.js");
|
|
114
115
|
const browser = await ensureBrowser({ signal: options.signal });
|
|
115
116
|
const puppeteer = await import("puppeteer-core");
|
|
116
|
-
const { buildChromeArgs } = await import("./src-
|
|
117
|
+
const { buildChromeArgs } = await import("./src-RY4V2ZZT.js");
|
|
117
118
|
const requestedGpuMode = options.browserGpuMode ?? resolveCliChromeGpuMode();
|
|
118
|
-
const answer = (await import("./staticProjectServer-
|
|
119
|
+
const answer = (await import("./staticProjectServer-4E3ODA5P.js")).inProcessAnswer(url);
|
|
119
120
|
const requiresWebGpu = compositionRequiresWebGpu(html);
|
|
120
121
|
let softwareWebGpu = false;
|
|
121
122
|
const launch = async (executablePath) => {
|
|
@@ -193,7 +194,7 @@ async function seekCompositionTimeline(page, timeSeconds, options = {}) {
|
|
|
193
194
|
await page.evaluate(
|
|
194
195
|
// Serialized into the page; the seek-target cascade must stay one function.
|
|
195
196
|
// fallow-ignore-next-line complexity
|
|
196
|
-
(t, fallbackToBridgeAndTimelines, exactTime) => {
|
|
197
|
+
(t, fallbackToBridgeAndTimelines, exactTime, skipDraws) => {
|
|
197
198
|
const getProperty = (target, key) => {
|
|
198
199
|
if ((typeof target !== "object" || target === null) && typeof target !== "function") {
|
|
199
200
|
return void 0;
|
|
@@ -212,26 +213,75 @@ async function seekCompositionTimeline(page, timeSeconds, options = {}) {
|
|
|
212
213
|
const playerSeek = getProperty(player, "seek");
|
|
213
214
|
const hf = Reflect.get(window, "__hf");
|
|
214
215
|
const bridgeSeek = getProperty(hf, "seek");
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
const gsap = Reflect.get(window, "gsap");
|
|
217
|
+
const ticker = getProperty(gsap, "ticker");
|
|
218
|
+
const seekTo = (time) => {
|
|
219
|
+
if (call(renderSeek, player, exactTime ? [time, { exact: true }] : [time])) {
|
|
220
|
+
} else if (fallbackToBridgeAndTimelines && call(bridgeSeek, hf, [time])) {
|
|
221
|
+
} else if (call(playerSeek, player, [time])) {
|
|
222
|
+
} else if (fallbackToBridgeAndTimelines) {
|
|
223
|
+
const timelines = Reflect.get(window, "__timelines");
|
|
224
|
+
if (typeof timelines === "object" && timelines !== null) {
|
|
225
|
+
for (const key of Object.keys(timelines)) {
|
|
226
|
+
const timeline = Reflect.get(timelines, key);
|
|
227
|
+
call(getProperty(timeline, "pause"), timeline, []);
|
|
228
|
+
call(getProperty(timeline, "seek"), timeline, [time]);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
call(getProperty(ticker, "tick"), ticker, []);
|
|
233
|
+
};
|
|
234
|
+
const gateSlot = /* @__PURE__ */ Symbol.for("hyperframes.webglDrawGate");
|
|
235
|
+
let gate = Reflect.get(window, gateSlot);
|
|
236
|
+
if (skipDraws && !gate) {
|
|
237
|
+
const installed = { skip: false, skipped: false };
|
|
238
|
+
for (const name of ["WebGLRenderingContext", "WebGL2RenderingContext"]) {
|
|
239
|
+
const proto = getProperty(Reflect.get(window, name), "prototype");
|
|
240
|
+
if (!proto) continue;
|
|
241
|
+
for (const method of [
|
|
242
|
+
"clear",
|
|
243
|
+
"drawArrays",
|
|
244
|
+
"drawElements",
|
|
245
|
+
"drawArraysInstanced",
|
|
246
|
+
"drawElementsInstanced",
|
|
247
|
+
"drawRangeElements",
|
|
248
|
+
"blitFramebuffer"
|
|
249
|
+
]) {
|
|
250
|
+
const draw = getProperty(proto, method);
|
|
251
|
+
if (typeof draw !== "function") continue;
|
|
252
|
+
Reflect.set(proto, method, function(...args) {
|
|
253
|
+
if (!installed.skip) return Reflect.apply(draw, this, args);
|
|
254
|
+
installed.skipped = true;
|
|
255
|
+
return void 0;
|
|
256
|
+
});
|
|
225
257
|
}
|
|
226
258
|
}
|
|
259
|
+
Reflect.set(window, gateSlot, installed);
|
|
260
|
+
gate = installed;
|
|
227
261
|
}
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
|
|
262
|
+
const seekWithoutDraws = (time) => {
|
|
263
|
+
if (!gate) return seekTo(time);
|
|
264
|
+
gate.skip = true;
|
|
265
|
+
try {
|
|
266
|
+
seekTo(time);
|
|
267
|
+
} finally {
|
|
268
|
+
gate.skip = false;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
if (skipDraws) {
|
|
272
|
+
seekWithoutDraws(safe);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
if (gate?.skipped) {
|
|
276
|
+
seekWithoutDraws(safe >= 1e-3 ? safe - 1e-3 : safe + 1e-3);
|
|
277
|
+
gate.skipped = false;
|
|
278
|
+
}
|
|
279
|
+
seekTo(safe);
|
|
231
280
|
},
|
|
232
281
|
timeSeconds,
|
|
233
282
|
options.fallbackToBridgeAndTimelines === true,
|
|
234
|
-
options.exactTime === true
|
|
283
|
+
options.exactTime === true,
|
|
284
|
+
options.skipWebglDraws === true
|
|
235
285
|
);
|
|
236
286
|
await page.evaluate(
|
|
237
287
|
async (barrier) => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// src/utils/concurrency.ts
|
|
9
|
+
async function runWithConcurrencyLimit(inputs, limit, worker) {
|
|
10
|
+
if (limit < 1) throw new Error(`runWithConcurrencyLimit: limit must be \u2265 1, got ${limit}`);
|
|
11
|
+
const results = new Array(inputs.length);
|
|
12
|
+
let cursor = 0;
|
|
13
|
+
const workerCount = Math.min(limit, inputs.length);
|
|
14
|
+
await Promise.all(
|
|
15
|
+
Array.from({ length: workerCount }, async () => {
|
|
16
|
+
while (cursor < inputs.length) {
|
|
17
|
+
const idx = cursor++;
|
|
18
|
+
results[idx] = await worker(inputs[idx], idx);
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
return results;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
runWithConcurrencyLimit
|
|
27
|
+
};
|