@remotion/renderer 4.0.351 → 4.0.353
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/assets/inline-audio-mixing.js +6 -7
- package/dist/browser/BrowserPage.js +45 -19
- package/dist/browser/ConsoleMessage.d.ts +6 -2
- package/dist/browser/ConsoleMessage.js +3 -5
- package/dist/client.d.ts +186 -6
- package/dist/esm/client.mjs +92 -29
- package/dist/esm/index.mjs +121 -60
- package/dist/format-logs.js +2 -2
- package/dist/get-compositions.js +8 -3
- package/dist/index.d.ts +72 -0
- package/dist/make-page.d.ts +2 -1
- package/dist/make-page.js +4 -1
- package/dist/options/index.d.ts +18 -0
- package/dist/options/index.js +2 -0
- package/dist/options/options-map.d.ts +168 -6
- package/dist/options/options-map.js +11 -1
- package/dist/options/video-cache-size.d.ts +19 -0
- package/dist/options/video-cache-size.js +39 -0
- package/dist/render-frames.js +6 -3
- package/dist/render-media.d.ts +1 -1
- package/dist/render-media.js +4 -2
- package/dist/render-still.js +6 -2
- package/dist/select-composition.js +8 -3
- package/dist/set-props-and-env.d.ts +2 -0
- package/dist/set-props-and-env.js +7 -3
- package/package.json +12 -12
package/dist/esm/index.mjs
CHANGED
|
@@ -674,7 +674,7 @@ var formatRemoteObject = (remoteObject) => {
|
|
|
674
674
|
if (isDelayRenderClear) {
|
|
675
675
|
return chalk.gray(`${remoteObject.value}`);
|
|
676
676
|
}
|
|
677
|
-
return
|
|
677
|
+
return `${remoteObject.value}`;
|
|
678
678
|
}
|
|
679
679
|
if (remoteObject.type === "number") {
|
|
680
680
|
return chalk.yellow(`${remoteObject.value}`);
|
|
@@ -690,7 +690,7 @@ var formatRemoteObject = (remoteObject) => {
|
|
|
690
690
|
}
|
|
691
691
|
if (remoteObject.type === "object") {
|
|
692
692
|
if (remoteObject.subtype === "null") {
|
|
693
|
-
return
|
|
693
|
+
return `null`;
|
|
694
694
|
}
|
|
695
695
|
return chalk.reset(`Object`);
|
|
696
696
|
}
|
|
@@ -878,21 +878,24 @@ class ConsoleMessage {
|
|
|
878
878
|
args;
|
|
879
879
|
previewString;
|
|
880
880
|
#stackTraceLocations;
|
|
881
|
+
logLevel;
|
|
882
|
+
tag;
|
|
881
883
|
constructor({
|
|
882
884
|
type,
|
|
883
885
|
text,
|
|
884
886
|
args,
|
|
885
887
|
stackTraceLocations,
|
|
886
|
-
previewString
|
|
888
|
+
previewString,
|
|
889
|
+
logLevel,
|
|
890
|
+
tag
|
|
887
891
|
}) {
|
|
888
892
|
this.type = type;
|
|
889
893
|
this.text = text;
|
|
890
894
|
this.args = args;
|
|
891
895
|
this.previewString = previewString;
|
|
892
896
|
this.#stackTraceLocations = stackTraceLocations;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
return this.#stackTraceLocations[0] ?? {};
|
|
897
|
+
this.logLevel = logLevel;
|
|
898
|
+
this.tag = tag;
|
|
896
899
|
}
|
|
897
900
|
stackTrace() {
|
|
898
901
|
return this.#stackTraceLocations;
|
|
@@ -2706,6 +2709,22 @@ var shouldHideWarning = (log) => {
|
|
|
2706
2709
|
}
|
|
2707
2710
|
return false;
|
|
2708
2711
|
};
|
|
2712
|
+
var format = (eventType, args) => {
|
|
2713
|
+
const previewString = args.filter((a) => !(a.type === "symbol" && a.description?.includes(`__remotion_`))).map((a) => formatRemoteObject(a)).filter(Boolean).join(" ");
|
|
2714
|
+
let logLevelFromRemotionLog = null;
|
|
2715
|
+
let tag = null;
|
|
2716
|
+
for (const a of args) {
|
|
2717
|
+
if (a.type === "symbol" && a.description?.includes(`__remotion_level_`)) {
|
|
2718
|
+
logLevelFromRemotionLog = a.description?.split("__remotion_level_")?.[1]?.replace(")", "");
|
|
2719
|
+
}
|
|
2720
|
+
if (a.type === "symbol" && a.description?.includes(`__remotion_tag_`)) {
|
|
2721
|
+
tag = a.description?.split("__remotion_tag_")?.[1]?.replace(")", "");
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
const logLevelFromEvent = eventType === "debug" ? "verbose" : eventType === "error" ? "error" : eventType === "warning" ? "warn" : "verbose";
|
|
2725
|
+
return { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag };
|
|
2726
|
+
};
|
|
2727
|
+
|
|
2709
2728
|
class Page extends EventEmitter {
|
|
2710
2729
|
id;
|
|
2711
2730
|
static async _create({
|
|
@@ -2794,14 +2813,15 @@ class Page extends EventEmitter {
|
|
|
2794
2813
|
});
|
|
2795
2814
|
}
|
|
2796
2815
|
#onConsole = (log) => {
|
|
2797
|
-
const
|
|
2816
|
+
const stackTrace = log.stackTrace();
|
|
2817
|
+
const { url, columnNumber, lineNumber } = stackTrace[0] ?? {};
|
|
2798
2818
|
const logLevel = this.logLevel;
|
|
2799
2819
|
const indent = this.indent;
|
|
2800
2820
|
if (shouldHideWarning(log)) {
|
|
2801
2821
|
return;
|
|
2802
2822
|
}
|
|
2803
2823
|
this.onBrowserLog?.({
|
|
2804
|
-
stackTrace
|
|
2824
|
+
stackTrace,
|
|
2805
2825
|
text: log.text,
|
|
2806
2826
|
type: log.type
|
|
2807
2827
|
});
|
|
@@ -2818,7 +2838,7 @@ class Page extends EventEmitter {
|
|
|
2818
2838
|
const isDelayRenderClear = log.previewString.includes(NoReactInternals2.DELAY_RENDER_CLEAR_TOKEN);
|
|
2819
2839
|
const tabInfo = `Tab ${this.pageIndex}`;
|
|
2820
2840
|
const tagInfo = [origPosition?.name, isDelayRenderClear ? null : file].filter(truthy).join("@");
|
|
2821
|
-
const tag = [tabInfo, tagInfo].filter(truthy).join(", ");
|
|
2841
|
+
const tag = [tabInfo, log.tag, log.tag ? null : tagInfo].filter(truthy).join(", ");
|
|
2822
2842
|
if (log.type === "error") {
|
|
2823
2843
|
Log.error({
|
|
2824
2844
|
logLevel,
|
|
@@ -2826,11 +2846,11 @@ class Page extends EventEmitter {
|
|
|
2826
2846
|
indent
|
|
2827
2847
|
}, log.previewString);
|
|
2828
2848
|
} else {
|
|
2829
|
-
Log
|
|
2849
|
+
Log[logLevel]({
|
|
2830
2850
|
logLevel,
|
|
2831
2851
|
tag,
|
|
2832
2852
|
indent
|
|
2833
|
-
},
|
|
2853
|
+
}, log.previewString);
|
|
2834
2854
|
}
|
|
2835
2855
|
} else if (log.type === "error") {
|
|
2836
2856
|
if (log.text.includes("Failed to load resource:")) {
|
|
@@ -2879,16 +2899,16 @@ class Page extends EventEmitter {
|
|
|
2879
2899
|
return releaseObject(this.#client, arg);
|
|
2880
2900
|
});
|
|
2881
2901
|
}
|
|
2882
|
-
const previewString = args
|
|
2883
|
-
return formatRemoteObject(arg);
|
|
2884
|
-
}).join(", ") : "";
|
|
2902
|
+
const { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag } = format(level, args ?? []);
|
|
2885
2903
|
if (source !== "worker") {
|
|
2886
2904
|
const message = new ConsoleMessage({
|
|
2887
2905
|
type: level,
|
|
2888
2906
|
text,
|
|
2889
2907
|
args: [],
|
|
2890
2908
|
stackTraceLocations: [{ url, lineNumber }],
|
|
2891
|
-
previewString
|
|
2909
|
+
previewString,
|
|
2910
|
+
logLevel: logLevelFromRemotionLog ?? logLevelFromEvent,
|
|
2911
|
+
tag
|
|
2892
2912
|
});
|
|
2893
2913
|
this.onBrowserLog?.({
|
|
2894
2914
|
stackTrace: message.stackTrace(),
|
|
@@ -3000,13 +3020,16 @@ class Page extends EventEmitter {
|
|
|
3000
3020
|
});
|
|
3001
3021
|
}
|
|
3002
3022
|
}
|
|
3003
|
-
const previewString = args.map((a) =>
|
|
3023
|
+
const { previewString, logLevelFromRemotionLog, logLevelFromEvent, tag } = format(eventType, args.map((a) => a._remoteObject) ?? []);
|
|
3024
|
+
const logLevel = logLevelFromRemotionLog ?? logLevelFromEvent;
|
|
3004
3025
|
const message = new ConsoleMessage({
|
|
3005
3026
|
type: eventType,
|
|
3006
3027
|
text: textTokens.join(" "),
|
|
3007
3028
|
args,
|
|
3008
3029
|
stackTraceLocations,
|
|
3009
|
-
previewString
|
|
3030
|
+
previewString,
|
|
3031
|
+
logLevel,
|
|
3032
|
+
tag
|
|
3010
3033
|
});
|
|
3011
3034
|
this.#onConsole(message);
|
|
3012
3035
|
}
|
|
@@ -3187,8 +3210,8 @@ var shouldLogBrowserMessage = (message) => {
|
|
|
3187
3210
|
return true;
|
|
3188
3211
|
};
|
|
3189
3212
|
var parseBrowserLogMessage = (input) => {
|
|
3190
|
-
const
|
|
3191
|
-
const match = input.match(
|
|
3213
|
+
const format2 = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*)\(([0-9]+)\)\](.*)/;
|
|
3214
|
+
const match = input.match(format2);
|
|
3192
3215
|
if (!match) {
|
|
3193
3216
|
return null;
|
|
3194
3217
|
}
|
|
@@ -15144,11 +15167,11 @@ var makeInlineAudioMixing = (dir) => {
|
|
|
15144
15167
|
const isLast = asset.frame === totalNumberOfFrames + firstFrame - 1;
|
|
15145
15168
|
const samplesToShaveFromStart = trimLeftOffset * DEFAULT_SAMPLE_RATE;
|
|
15146
15169
|
const samplesToShaveFromEnd = trimRightOffset * DEFAULT_SAMPLE_RATE;
|
|
15147
|
-
if (Math.abs(Math.round(samplesToShaveFromEnd) - samplesToShaveFromEnd) > 0.
|
|
15148
|
-
throw new Error(
|
|
15170
|
+
if (Math.abs(Math.round(samplesToShaveFromEnd) - samplesToShaveFromEnd) > 0.0000001) {
|
|
15171
|
+
throw new Error(`samplesToShaveFromEnd should be approximately an integer, is${samplesToShaveFromEnd}`);
|
|
15149
15172
|
}
|
|
15150
|
-
if (Math.abs(Math.round(samplesToShaveFromStart) - samplesToShaveFromStart) > 0.
|
|
15151
|
-
throw new Error(
|
|
15173
|
+
if (Math.abs(Math.round(samplesToShaveFromStart) - samplesToShaveFromStart) > 0.0000001) {
|
|
15174
|
+
throw new Error(`samplesToShaveFromStart should be approximately an integer, is ${samplesToShaveFromStart}`);
|
|
15152
15175
|
}
|
|
15153
15176
|
if (isFirst) {
|
|
15154
15177
|
arr = arr.slice(Math.round(samplesToShaveFromStart) * asset.numberOfChannels);
|
|
@@ -15157,7 +15180,7 @@ var makeInlineAudioMixing = (dir) => {
|
|
|
15157
15180
|
arr = arr.slice(0, arr.length + Math.round(samplesToShaveFromEnd) * asset.numberOfChannels);
|
|
15158
15181
|
}
|
|
15159
15182
|
const positionInSeconds = (asset.frame - firstFrame) / fps - (isFirst ? 0 : trimLeftOffset);
|
|
15160
|
-
const position = Math.round(positionInSeconds * asset.numberOfChannels *
|
|
15183
|
+
const position = Math.round(positionInSeconds * DEFAULT_SAMPLE_RATE) * asset.numberOfChannels * BYTES_PER_SAMPLE;
|
|
15161
15184
|
writeSync(fileDescriptor, arr, 0, arr.byteLength, 44 + position);
|
|
15162
15185
|
};
|
|
15163
15186
|
return {
|
|
@@ -16280,16 +16303,20 @@ var innerSetPropsAndEnv = async ({
|
|
|
16280
16303
|
indent,
|
|
16281
16304
|
logLevel,
|
|
16282
16305
|
onServeUrlVisited,
|
|
16283
|
-
isMainTab
|
|
16306
|
+
isMainTab,
|
|
16307
|
+
mediaCacheSizeInBytes,
|
|
16308
|
+
initialMemoryAvailable
|
|
16284
16309
|
}) => {
|
|
16285
16310
|
validatePuppeteerTimeout(timeoutInMilliseconds);
|
|
16286
16311
|
const actualTimeout = timeoutInMilliseconds ?? DEFAULT_TIMEOUT;
|
|
16287
16312
|
page.setDefaultTimeout(actualTimeout);
|
|
16288
16313
|
page.setDefaultNavigationTimeout(actualTimeout);
|
|
16289
16314
|
const urlToVisit = normalizeServeUrl(serveUrl);
|
|
16290
|
-
await page.evaluateOnNewDocument((timeout, mainTab) => {
|
|
16315
|
+
await page.evaluateOnNewDocument((timeout, mainTab, cacheSizeInBytes, initMemoryAvailable) => {
|
|
16291
16316
|
window.remotion_puppeteerTimeout = timeout;
|
|
16292
16317
|
window.remotion_isMainTab = mainTab;
|
|
16318
|
+
window.remotion_mediaCacheSizeInBytes = cacheSizeInBytes;
|
|
16319
|
+
window.remotion_initialMemoryAvailable = initMemoryAvailable;
|
|
16293
16320
|
if (window.process === undefined) {
|
|
16294
16321
|
window.process = {};
|
|
16295
16322
|
}
|
|
@@ -16297,7 +16324,7 @@ var innerSetPropsAndEnv = async ({
|
|
|
16297
16324
|
window.process.env = {};
|
|
16298
16325
|
}
|
|
16299
16326
|
window.process.env.NODE_ENV = "production";
|
|
16300
|
-
}, actualTimeout, isMainTab);
|
|
16327
|
+
}, actualTimeout, isMainTab, mediaCacheSizeInBytes, initialMemoryAvailable);
|
|
16301
16328
|
await page.evaluateOnNewDocument('window.remotion_broadcastChannel = new BroadcastChannel("remotion-video-frame-extraction")');
|
|
16302
16329
|
if (envVariables) {
|
|
16303
16330
|
await page.evaluateOnNewDocument((input) => {
|
|
@@ -16348,7 +16375,9 @@ var innerSetPropsAndEnv = async ({
|
|
|
16348
16375
|
indent,
|
|
16349
16376
|
logLevel,
|
|
16350
16377
|
onServeUrlVisited,
|
|
16351
|
-
isMainTab
|
|
16378
|
+
isMainTab,
|
|
16379
|
+
mediaCacheSizeInBytes,
|
|
16380
|
+
initialMemoryAvailable
|
|
16352
16381
|
});
|
|
16353
16382
|
};
|
|
16354
16383
|
const [pageRes, error] = await gotoPageOrThrow(page, urlToVisit, actualTimeout);
|
|
@@ -16598,7 +16627,8 @@ var innerGetCompositions = async ({
|
|
|
16598
16627
|
serveUrl,
|
|
16599
16628
|
timeoutInMilliseconds,
|
|
16600
16629
|
indent,
|
|
16601
|
-
logLevel
|
|
16630
|
+
logLevel,
|
|
16631
|
+
mediaCacheSizeInBytes
|
|
16602
16632
|
}) => {
|
|
16603
16633
|
validatePuppeteerTimeout(timeoutInMilliseconds);
|
|
16604
16634
|
await setPropsAndEnv({
|
|
@@ -16617,7 +16647,9 @@ var innerGetCompositions = async ({
|
|
|
16617
16647
|
onServeUrlVisited: () => {
|
|
16618
16648
|
return;
|
|
16619
16649
|
},
|
|
16620
|
-
isMainTab: true
|
|
16650
|
+
isMainTab: true,
|
|
16651
|
+
mediaCacheSizeInBytes,
|
|
16652
|
+
initialMemoryAvailable: getAvailableMemory(logLevel)
|
|
16621
16653
|
});
|
|
16622
16654
|
await puppeteerEvaluateWithCatch({
|
|
16623
16655
|
page,
|
|
@@ -16691,7 +16723,8 @@ var internalGetCompositionsRaw = async ({
|
|
|
16691
16723
|
binariesDirectory,
|
|
16692
16724
|
onBrowserDownload,
|
|
16693
16725
|
chromeMode,
|
|
16694
|
-
offthreadVideoThreads
|
|
16726
|
+
offthreadVideoThreads,
|
|
16727
|
+
mediaCacheSizeInBytes
|
|
16695
16728
|
}) => {
|
|
16696
16729
|
const { page, cleanupPage } = await getPageAndCleanupFn({
|
|
16697
16730
|
passedInInstance: puppeteerInstance,
|
|
@@ -16745,7 +16778,8 @@ var internalGetCompositionsRaw = async ({
|
|
|
16745
16778
|
binariesDirectory,
|
|
16746
16779
|
onBrowserDownload,
|
|
16747
16780
|
chromeMode,
|
|
16748
|
-
offthreadVideoThreads
|
|
16781
|
+
offthreadVideoThreads,
|
|
16782
|
+
mediaCacheSizeInBytes
|
|
16749
16783
|
});
|
|
16750
16784
|
}).then((comp) => {
|
|
16751
16785
|
return resolve2(comp);
|
|
@@ -16777,7 +16811,8 @@ var getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
16777
16811
|
binariesDirectory,
|
|
16778
16812
|
offthreadVideoCacheSizeInBytes,
|
|
16779
16813
|
chromeMode,
|
|
16780
|
-
offthreadVideoThreads
|
|
16814
|
+
offthreadVideoThreads,
|
|
16815
|
+
mediaCacheSizeInBytes
|
|
16781
16816
|
} = config ?? {};
|
|
16782
16817
|
const indent = false;
|
|
16783
16818
|
const logLevel = passedLogLevel ?? "info";
|
|
@@ -16806,7 +16841,8 @@ var getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
16806
16841
|
api: "getCompositions()"
|
|
16807
16842
|
}),
|
|
16808
16843
|
chromeMode: chromeMode ?? "headless-shell",
|
|
16809
|
-
offthreadVideoThreads: offthreadVideoThreads ?? null
|
|
16844
|
+
offthreadVideoThreads: offthreadVideoThreads ?? null,
|
|
16845
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
|
|
16810
16846
|
});
|
|
16811
16847
|
};
|
|
16812
16848
|
|
|
@@ -17135,7 +17171,7 @@ var validPixelFormatsForCodec = (codec) => {
|
|
|
17135
17171
|
if (codec === "vp8" || codec === "vp9") {
|
|
17136
17172
|
return validPixelFormats;
|
|
17137
17173
|
}
|
|
17138
|
-
return validPixelFormats.filter((
|
|
17174
|
+
return validPixelFormats.filter((format2) => format2 !== "yuva420p");
|
|
17139
17175
|
};
|
|
17140
17176
|
var validateSelectedPixelFormatAndCodecCombination = (pixelFormat, codec) => {
|
|
17141
17177
|
if (typeof pixelFormat === "undefined") {
|
|
@@ -17771,7 +17807,8 @@ var makePage = async ({
|
|
|
17771
17807
|
imageFormat,
|
|
17772
17808
|
serializedResolvedPropsWithCustomSchema,
|
|
17773
17809
|
pageIndex,
|
|
17774
|
-
isMainTab
|
|
17810
|
+
isMainTab,
|
|
17811
|
+
mediaCacheSizeInBytes
|
|
17775
17812
|
}) => {
|
|
17776
17813
|
const page = await browserReplacer.getBrowser().newPage({ context, logLevel, indent, pageIndex, onBrowserLog });
|
|
17777
17814
|
pagesArray.push(page);
|
|
@@ -17796,7 +17833,9 @@ var makePage = async ({
|
|
|
17796
17833
|
onServeUrlVisited: () => {
|
|
17797
17834
|
return;
|
|
17798
17835
|
},
|
|
17799
|
-
isMainTab
|
|
17836
|
+
isMainTab,
|
|
17837
|
+
mediaCacheSizeInBytes,
|
|
17838
|
+
initialMemoryAvailable: getAvailableMemory(logLevel)
|
|
17800
17839
|
});
|
|
17801
17840
|
await puppeteerEvaluateWithCatch({
|
|
17802
17841
|
pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat) => {
|
|
@@ -18059,7 +18098,7 @@ import * as assert2 from "node:assert";
|
|
|
18059
18098
|
// src/screenshot-task.ts
|
|
18060
18099
|
import fs13 from "node:fs";
|
|
18061
18100
|
var screenshotTask = async ({
|
|
18062
|
-
format,
|
|
18101
|
+
format: format2,
|
|
18063
18102
|
height,
|
|
18064
18103
|
omitBackground,
|
|
18065
18104
|
page,
|
|
@@ -18081,7 +18120,7 @@ var screenshotTask = async ({
|
|
|
18081
18120
|
const cap = startPerfMeasure("capture");
|
|
18082
18121
|
try {
|
|
18083
18122
|
let result;
|
|
18084
|
-
if (
|
|
18123
|
+
if (format2 === "pdf") {
|
|
18085
18124
|
const res = await client.send("Page.printToPDF", {
|
|
18086
18125
|
paperWidth: width / 96,
|
|
18087
18126
|
paperHeight: height / 96,
|
|
@@ -18097,7 +18136,7 @@ var screenshotTask = async ({
|
|
|
18097
18136
|
const fromSurface = !process.env.DISABLE_FROM_SURFACE || height > 8192 || width > 8192;
|
|
18098
18137
|
const scaleFactor = fromSurface ? 1 : scale;
|
|
18099
18138
|
const { value } = await client.send("Page.captureScreenshot", {
|
|
18100
|
-
format,
|
|
18139
|
+
format: format2,
|
|
18101
18140
|
quality: jpegQuality,
|
|
18102
18141
|
clip: {
|
|
18103
18142
|
x: 0,
|
|
@@ -18750,7 +18789,8 @@ var innerRenderFrames = async ({
|
|
|
18750
18789
|
forSeamlessAacConcatenation,
|
|
18751
18790
|
onArtifact,
|
|
18752
18791
|
binariesDirectory,
|
|
18753
|
-
imageSequencePattern
|
|
18792
|
+
imageSequencePattern,
|
|
18793
|
+
mediaCacheSizeInBytes
|
|
18754
18794
|
}) => {
|
|
18755
18795
|
if (outputDir) {
|
|
18756
18796
|
if (!fs14.existsSync(outputDir)) {
|
|
@@ -18796,7 +18836,8 @@ var innerRenderFrames = async ({
|
|
|
18796
18836
|
serveUrl,
|
|
18797
18837
|
timeoutInMilliseconds,
|
|
18798
18838
|
pageIndex,
|
|
18799
|
-
isMainTab: pageIndex === 0
|
|
18839
|
+
isMainTab: pageIndex === 0,
|
|
18840
|
+
mediaCacheSizeInBytes
|
|
18800
18841
|
});
|
|
18801
18842
|
};
|
|
18802
18843
|
const getPool = async () => {
|
|
@@ -18938,7 +18979,8 @@ var internalRenderFramesRaw = ({
|
|
|
18938
18979
|
onArtifact,
|
|
18939
18980
|
chromeMode,
|
|
18940
18981
|
offthreadVideoThreads,
|
|
18941
|
-
imageSequencePattern
|
|
18982
|
+
imageSequencePattern,
|
|
18983
|
+
mediaCacheSizeInBytes
|
|
18942
18984
|
}) => {
|
|
18943
18985
|
validateDimension(composition.height, "height", "in the `config` object passed to `renderFrames()`");
|
|
18944
18986
|
validateDimension(composition.width, "width", "in the `config` object passed to `renderFrames()`");
|
|
@@ -19041,7 +19083,8 @@ var internalRenderFramesRaw = ({
|
|
|
19041
19083
|
onArtifact,
|
|
19042
19084
|
chromeMode,
|
|
19043
19085
|
offthreadVideoThreads,
|
|
19044
|
-
imageSequencePattern
|
|
19086
|
+
imageSequencePattern,
|
|
19087
|
+
mediaCacheSizeInBytes
|
|
19045
19088
|
});
|
|
19046
19089
|
})
|
|
19047
19090
|
]).then((res) => {
|
|
@@ -19110,7 +19153,8 @@ var renderFrames = (options) => {
|
|
|
19110
19153
|
onArtifact,
|
|
19111
19154
|
chromeMode,
|
|
19112
19155
|
offthreadVideoThreads,
|
|
19113
|
-
imageSequencePattern
|
|
19156
|
+
imageSequencePattern,
|
|
19157
|
+
mediaCacheSizeInBytes
|
|
19114
19158
|
} = options;
|
|
19115
19159
|
if (!composition) {
|
|
19116
19160
|
throw new Error("No `composition` option has been specified for renderFrames()");
|
|
@@ -19168,7 +19212,8 @@ var renderFrames = (options) => {
|
|
|
19168
19212
|
onArtifact: onArtifact ?? null,
|
|
19169
19213
|
chromeMode: chromeMode ?? "headless-shell",
|
|
19170
19214
|
offthreadVideoThreads: offthreadVideoThreads ?? null,
|
|
19171
|
-
imageSequencePattern: imageSequencePattern ?? null
|
|
19215
|
+
imageSequencePattern: imageSequencePattern ?? null,
|
|
19216
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
|
|
19172
19217
|
});
|
|
19173
19218
|
};
|
|
19174
19219
|
|
|
@@ -21287,7 +21332,8 @@ var internalRenderMediaRaw = ({
|
|
|
21287
21332
|
metadata,
|
|
21288
21333
|
hardwareAcceleration,
|
|
21289
21334
|
chromeMode,
|
|
21290
|
-
offthreadVideoThreads
|
|
21335
|
+
offthreadVideoThreads,
|
|
21336
|
+
mediaCacheSizeInBytes
|
|
21291
21337
|
}) => {
|
|
21292
21338
|
const pixelFormat = userPixelFormat ?? compositionWithPossibleUnevenDimensions.defaultPixelFormat ?? DEFAULT_PIXEL_FORMAT;
|
|
21293
21339
|
if (repro) {
|
|
@@ -21601,7 +21647,8 @@ var internalRenderMediaRaw = ({
|
|
|
21601
21647
|
onBrowserDownload,
|
|
21602
21648
|
onArtifact,
|
|
21603
21649
|
chromeMode,
|
|
21604
|
-
imageSequencePattern: null
|
|
21650
|
+
imageSequencePattern: null,
|
|
21651
|
+
mediaCacheSizeInBytes
|
|
21605
21652
|
});
|
|
21606
21653
|
return renderFramesProc;
|
|
21607
21654
|
}).then((renderFramesReturn) => {
|
|
@@ -21774,7 +21821,8 @@ var renderMedia = ({
|
|
|
21774
21821
|
hardwareAcceleration,
|
|
21775
21822
|
chromeMode,
|
|
21776
21823
|
offthreadVideoThreads,
|
|
21777
|
-
compositionStart
|
|
21824
|
+
compositionStart,
|
|
21825
|
+
mediaCacheSizeInBytes
|
|
21778
21826
|
}) => {
|
|
21779
21827
|
const indent = false;
|
|
21780
21828
|
const logLevel = verbose || dumpBrowserLogs ? "verbose" : passedLogLevel ?? "info";
|
|
@@ -21857,7 +21905,8 @@ var renderMedia = ({
|
|
|
21857
21905
|
metadata: metadata ?? null,
|
|
21858
21906
|
compositionStart: compositionStart ?? 0,
|
|
21859
21907
|
hardwareAcceleration: hardwareAcceleration ?? "disable",
|
|
21860
|
-
chromeMode: chromeMode ?? "headless-shell"
|
|
21908
|
+
chromeMode: chromeMode ?? "headless-shell",
|
|
21909
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
|
|
21861
21910
|
});
|
|
21862
21911
|
};
|
|
21863
21912
|
|
|
@@ -21890,7 +21939,8 @@ var innerRenderStill = async ({
|
|
|
21890
21939
|
serializedResolvedPropsWithCustomSchema,
|
|
21891
21940
|
onBrowserDownload,
|
|
21892
21941
|
onArtifact,
|
|
21893
|
-
chromeMode
|
|
21942
|
+
chromeMode,
|
|
21943
|
+
mediaCacheSizeInBytes
|
|
21894
21944
|
}) => {
|
|
21895
21945
|
validateDimension(composition.height, "height", "in the `config` object passed to `renderStill()`");
|
|
21896
21946
|
validateDimension(composition.width, "width", "in the `config` object passed to `renderStill()`");
|
|
@@ -21986,7 +22036,9 @@ var innerRenderStill = async ({
|
|
|
21986
22036
|
onServeUrlVisited: () => {
|
|
21987
22037
|
return;
|
|
21988
22038
|
},
|
|
21989
|
-
isMainTab: true
|
|
22039
|
+
isMainTab: true,
|
|
22040
|
+
mediaCacheSizeInBytes,
|
|
22041
|
+
initialMemoryAvailable: getAvailableMemory(logLevel)
|
|
21990
22042
|
});
|
|
21991
22043
|
await puppeteerEvaluateWithCatch({
|
|
21992
22044
|
pageFunction: (id, props, durationInFrames, fps, height, width, defaultCodec, defaultOutName, defaultVideoImageFormat, defaultPixelFormat) => {
|
|
@@ -22137,7 +22189,8 @@ var renderStill = (options) => {
|
|
|
22137
22189
|
onBrowserDownload,
|
|
22138
22190
|
onArtifact,
|
|
22139
22191
|
chromeMode,
|
|
22140
|
-
offthreadVideoThreads
|
|
22192
|
+
offthreadVideoThreads,
|
|
22193
|
+
mediaCacheSizeInBytes
|
|
22141
22194
|
} = options;
|
|
22142
22195
|
if (typeof jpegQuality !== "undefined" && imageFormat !== "jpeg") {
|
|
22143
22196
|
throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
|
|
@@ -22187,7 +22240,8 @@ var renderStill = (options) => {
|
|
|
22187
22240
|
}),
|
|
22188
22241
|
onArtifact: onArtifact ?? null,
|
|
22189
22242
|
chromeMode: chromeMode ?? "headless-shell",
|
|
22190
|
-
offthreadVideoThreads: offthreadVideoThreads ?? null
|
|
22243
|
+
offthreadVideoThreads: offthreadVideoThreads ?? null,
|
|
22244
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
|
|
22191
22245
|
});
|
|
22192
22246
|
};
|
|
22193
22247
|
|
|
@@ -22203,7 +22257,8 @@ var innerSelectComposition = async ({
|
|
|
22203
22257
|
id,
|
|
22204
22258
|
indent,
|
|
22205
22259
|
logLevel,
|
|
22206
|
-
onServeUrlVisited
|
|
22260
|
+
onServeUrlVisited,
|
|
22261
|
+
mediaCacheSizeInBytes
|
|
22207
22262
|
}) => {
|
|
22208
22263
|
validatePuppeteerTimeout(timeoutInMilliseconds);
|
|
22209
22264
|
await setPropsAndEnv({
|
|
@@ -22220,7 +22275,9 @@ var innerSelectComposition = async ({
|
|
|
22220
22275
|
indent,
|
|
22221
22276
|
logLevel,
|
|
22222
22277
|
onServeUrlVisited,
|
|
22223
|
-
isMainTab: true
|
|
22278
|
+
isMainTab: true,
|
|
22279
|
+
mediaCacheSizeInBytes,
|
|
22280
|
+
initialMemoryAvailable: getAvailableMemory(logLevel)
|
|
22224
22281
|
});
|
|
22225
22282
|
await puppeteerEvaluateWithCatch({
|
|
22226
22283
|
page,
|
|
@@ -22308,7 +22365,8 @@ var internalSelectCompositionRaw = async (options) => {
|
|
|
22308
22365
|
binariesDirectory,
|
|
22309
22366
|
onBrowserDownload,
|
|
22310
22367
|
onServeUrlVisited,
|
|
22311
|
-
chromeMode
|
|
22368
|
+
chromeMode,
|
|
22369
|
+
mediaCacheSizeInBytes
|
|
22312
22370
|
} = options;
|
|
22313
22371
|
const [{ page, cleanupPage }, serverUsed] = await Promise.all([
|
|
22314
22372
|
getPageAndCleanupFn({
|
|
@@ -22369,7 +22427,8 @@ var internalSelectCompositionRaw = async (options) => {
|
|
|
22369
22427
|
binariesDirectory,
|
|
22370
22428
|
onBrowserDownload,
|
|
22371
22429
|
onServeUrlVisited,
|
|
22372
|
-
chromeMode
|
|
22430
|
+
chromeMode,
|
|
22431
|
+
mediaCacheSizeInBytes
|
|
22373
22432
|
}).then((data) => {
|
|
22374
22433
|
return resolve2(data);
|
|
22375
22434
|
}).catch((err) => {
|
|
@@ -22402,7 +22461,8 @@ var selectComposition = async (options) => {
|
|
|
22402
22461
|
binariesDirectory,
|
|
22403
22462
|
onBrowserDownload,
|
|
22404
22463
|
chromeMode,
|
|
22405
|
-
offthreadVideoThreads
|
|
22464
|
+
offthreadVideoThreads,
|
|
22465
|
+
mediaCacheSizeInBytes
|
|
22406
22466
|
} = options;
|
|
22407
22467
|
const indent = false;
|
|
22408
22468
|
const logLevel = passedLogLevel ?? (verbose ? "verbose" : "info");
|
|
@@ -22435,7 +22495,8 @@ var selectComposition = async (options) => {
|
|
|
22435
22495
|
return;
|
|
22436
22496
|
},
|
|
22437
22497
|
chromeMode: chromeMode ?? "headless-shell",
|
|
22438
|
-
offthreadVideoThreads: offthreadVideoThreads ?? null
|
|
22498
|
+
offthreadVideoThreads: offthreadVideoThreads ?? null,
|
|
22499
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes ?? null
|
|
22439
22500
|
});
|
|
22440
22501
|
return data.metadata;
|
|
22441
22502
|
};
|
package/dist/format-logs.js
CHANGED
|
@@ -12,7 +12,7 @@ const formatRemoteObject = (remoteObject) => {
|
|
|
12
12
|
if (isDelayRenderClear) {
|
|
13
13
|
return chalk_1.chalk.gray(`${remoteObject.value}`);
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return `${remoteObject.value}`;
|
|
16
16
|
}
|
|
17
17
|
if (remoteObject.type === 'number') {
|
|
18
18
|
return chalk_1.chalk.yellow(`${remoteObject.value}`);
|
|
@@ -28,7 +28,7 @@ const formatRemoteObject = (remoteObject) => {
|
|
|
28
28
|
}
|
|
29
29
|
if (remoteObject.type === 'object') {
|
|
30
30
|
if (remoteObject.subtype === 'null') {
|
|
31
|
-
return
|
|
31
|
+
return `null`;
|
|
32
32
|
}
|
|
33
33
|
return chalk_1.chalk.reset(`Object`);
|
|
34
34
|
}
|
package/dist/get-compositions.js
CHANGED
|
@@ -7,6 +7,7 @@ const browser_download_progress_bar_1 = require("./browser/browser-download-prog
|
|
|
7
7
|
const handle_javascript_exception_1 = require("./error-handling/handle-javascript-exception");
|
|
8
8
|
const find_closest_package_json_1 = require("./find-closest-package-json");
|
|
9
9
|
const get_browser_instance_1 = require("./get-browser-instance");
|
|
10
|
+
const get_available_memory_1 = require("./memory/get-available-memory");
|
|
10
11
|
const offthreadvideo_threads_1 = require("./options/offthreadvideo-threads");
|
|
11
12
|
const prepare_server_1 = require("./prepare-server");
|
|
12
13
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
@@ -14,7 +15,7 @@ const seek_to_frame_1 = require("./seek-to-frame");
|
|
|
14
15
|
const set_props_and_env_1 = require("./set-props-and-env");
|
|
15
16
|
const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
|
|
16
17
|
const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
|
|
17
|
-
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, }) => {
|
|
18
|
+
const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, mediaCacheSizeInBytes, }) => {
|
|
18
19
|
(0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
|
|
19
20
|
await (0, set_props_and_env_1.setPropsAndEnv)({
|
|
20
21
|
serializedInputPropsWithCustomSchema,
|
|
@@ -31,6 +32,8 @@ const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCust
|
|
|
31
32
|
logLevel,
|
|
32
33
|
onServeUrlVisited: () => undefined,
|
|
33
34
|
isMainTab: true,
|
|
35
|
+
mediaCacheSizeInBytes,
|
|
36
|
+
initialMemoryAvailable: (0, get_available_memory_1.getAvailableMemory)(logLevel),
|
|
34
37
|
});
|
|
35
38
|
await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
36
39
|
page,
|
|
@@ -77,7 +80,7 @@ const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCust
|
|
|
77
80
|
};
|
|
78
81
|
});
|
|
79
82
|
};
|
|
80
|
-
const internalGetCompositionsRaw = async ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, chromeMode, offthreadVideoThreads, }) => {
|
|
83
|
+
const internalGetCompositionsRaw = async ({ browserExecutable, chromiumOptions, envVariables, indent, serializedInputPropsWithCustomSchema, onBrowserLog, port, puppeteerInstance, serveUrlOrWebpackUrl, server, timeoutInMilliseconds, logLevel, offthreadVideoCacheSizeInBytes, binariesDirectory, onBrowserDownload, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, }) => {
|
|
81
84
|
const { page, cleanupPage } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
82
85
|
passedInInstance: puppeteerInstance,
|
|
83
86
|
browserExecutable,
|
|
@@ -130,6 +133,7 @@ const internalGetCompositionsRaw = async ({ browserExecutable, chromiumOptions,
|
|
|
130
133
|
onBrowserDownload,
|
|
131
134
|
chromeMode,
|
|
132
135
|
offthreadVideoThreads,
|
|
136
|
+
mediaCacheSizeInBytes,
|
|
133
137
|
});
|
|
134
138
|
})
|
|
135
139
|
.then((comp) => {
|
|
@@ -154,7 +158,7 @@ const getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
154
158
|
if (!serveUrlOrWebpackUrl) {
|
|
155
159
|
throw new Error('No serve URL or webpack bundle directory was passed to getCompositions().');
|
|
156
160
|
}
|
|
157
|
-
const { browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, logLevel: passedLogLevel, onBrowserDownload, binariesDirectory, offthreadVideoCacheSizeInBytes, chromeMode, offthreadVideoThreads, } = config !== null && config !== void 0 ? config : {};
|
|
161
|
+
const { browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, logLevel: passedLogLevel, onBrowserDownload, binariesDirectory, offthreadVideoCacheSizeInBytes, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, } = config !== null && config !== void 0 ? config : {};
|
|
158
162
|
const indent = false;
|
|
159
163
|
const logLevel = passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : 'info';
|
|
160
164
|
return (0, exports.internalGetCompositions)({
|
|
@@ -183,6 +187,7 @@ const getCompositions = (serveUrlOrWebpackUrl, config) => {
|
|
|
183
187
|
}),
|
|
184
188
|
chromeMode: chromeMode !== null && chromeMode !== void 0 ? chromeMode : 'headless-shell',
|
|
185
189
|
offthreadVideoThreads: offthreadVideoThreads !== null && offthreadVideoThreads !== void 0 ? offthreadVideoThreads : null,
|
|
190
|
+
mediaCacheSizeInBytes: mediaCacheSizeInBytes !== null && mediaCacheSizeInBytes !== void 0 ? mediaCacheSizeInBytes : null,
|
|
186
191
|
});
|
|
187
192
|
};
|
|
188
193
|
exports.getCompositions = getCompositions;
|