@remotion/renderer 4.0.289 → 4.0.290

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.
@@ -43,6 +43,7 @@ export declare class HeadlessBrowser extends EventEmitter {
43
43
  indent: boolean;
44
44
  }): Promise<HeadlessBrowser>;
45
45
  connection: Connection;
46
+ id: string;
46
47
  runner: BrowserRunner;
47
48
  get _targets(): Map<string, Target>;
48
49
  constructor({ connection, defaultViewport, runner, }: {
@@ -63,6 +63,7 @@ class HeadlessBrowser extends EventEmitter_1.EventEmitter {
63
63
  _HeadlessBrowser_targets.set(this, void 0);
64
64
  __classPrivateFieldSet(this, _HeadlessBrowser_defaultViewport, defaultViewport, "f");
65
65
  this.connection = connection;
66
+ this.id = Math.random().toString(36).substring(2, 15);
66
67
  __classPrivateFieldSet(this, _HeadlessBrowser_defaultContext, new BrowserContext(this), "f");
67
68
  __classPrivateFieldSet(this, _HeadlessBrowser_contexts, new Map(), "f");
68
69
  __classPrivateFieldSet(this, _HeadlessBrowser_targets, new Map(), "f");
@@ -16,16 +16,22 @@ const collectAssets = async ({ frame, freePage, timeoutInMilliseconds, }) => {
16
16
  if (asset.type !== 'artifact') {
17
17
  return asset;
18
18
  }
19
- if (typeof asset.content !== 'string') {
20
- throw new Error(`Expected string content for artifact ${asset.id}, but got ${asset.content}`);
19
+ if (asset.contentType === 'binary' || asset.contentType === 'text') {
20
+ if (typeof asset.content !== 'string') {
21
+ throw new Error(`Expected string content for artifact ${asset.id}, but got ${asset.content}`);
22
+ }
23
+ const stringOrUintArray = asset.contentType === 'binary'
24
+ ? new TextEncoder().encode(atob(asset.content))
25
+ : asset.content;
26
+ return {
27
+ ...asset,
28
+ content: stringOrUintArray,
29
+ };
21
30
  }
22
- const stringOrUintArray = asset.binary
23
- ? new TextEncoder().encode(atob(asset.content))
24
- : asset.content;
25
- return {
26
- ...asset,
27
- content: stringOrUintArray,
28
- };
31
+ if (asset.contentType === 'thumbnail') {
32
+ return asset;
33
+ }
34
+ return asset;
29
35
  });
30
36
  return fixedArtifacts;
31
37
  };
@@ -3569,6 +3569,7 @@ class HeadlessBrowser extends EventEmitter {
3569
3569
  #defaultContext;
3570
3570
  #contexts;
3571
3571
  #targets;
3572
+ id;
3572
3573
  runner;
3573
3574
  get _targets() {
3574
3575
  return this.#targets;
@@ -3581,6 +3582,7 @@ class HeadlessBrowser extends EventEmitter {
3581
3582
  super();
3582
3583
  this.#defaultViewport = defaultViewport;
3583
3584
  this.connection = connection;
3585
+ this.id = Math.random().toString(36).substring(2, 15);
3584
3586
  this.#defaultContext = new BrowserContext(this);
3585
3587
  this.#contexts = new Map;
3586
3588
  this.#targets = new Map;
@@ -16832,9 +16834,7 @@ __export(exports_perf, {
16832
16834
  getPerf: () => getPerf
16833
16835
  });
16834
16836
  var perf = {
16835
- "activate-target": [],
16836
16837
  capture: [],
16837
- save: [],
16838
16838
  "extract-frame": [],
16839
16839
  piping: []
16840
16840
  };
@@ -17717,8 +17717,31 @@ import path19 from "path";
17717
17717
  var onlyAudioAndVideoAssets = (assets) => {
17718
17718
  return assets.filter((asset) => asset.type === "audio" || asset.type === "video");
17719
17719
  };
17720
- var onlyArtifact = (assets) => {
17721
- return assets.filter((asset) => asset.type === "artifact");
17720
+ var onlyArtifact = ({
17721
+ assets,
17722
+ frameBuffer
17723
+ }) => {
17724
+ const artifacts = assets.filter((asset) => asset.type === "artifact");
17725
+ return artifacts.map((artifact) => {
17726
+ if (artifact.contentType === "binary" || artifact.contentType === "text") {
17727
+ return {
17728
+ frame: artifact.frame,
17729
+ content: artifact.content,
17730
+ filename: artifact.filename
17731
+ };
17732
+ }
17733
+ if (artifact.contentType === "thumbnail") {
17734
+ if (frameBuffer === null) {
17735
+ return null;
17736
+ }
17737
+ return {
17738
+ frame: artifact.frame,
17739
+ content: new Uint8Array(frameBuffer),
17740
+ filename: artifact.filename
17741
+ };
17742
+ }
17743
+ throw new Error("Unknown artifact type: " + artifact);
17744
+ }).filter(truthy);
17722
17745
  };
17723
17746
 
17724
17747
  // src/collect-assets.ts
@@ -17740,14 +17763,20 @@ var collectAssets = async ({
17740
17763
  if (asset.type !== "artifact") {
17741
17764
  return asset;
17742
17765
  }
17743
- if (typeof asset.content !== "string") {
17744
- throw new Error(`Expected string content for artifact ${asset.id}, but got ${asset.content}`);
17766
+ if (asset.contentType === "binary" || asset.contentType === "text") {
17767
+ if (typeof asset.content !== "string") {
17768
+ throw new Error(`Expected string content for artifact ${asset.id}, but got ${asset.content}`);
17769
+ }
17770
+ const stringOrUintArray = asset.contentType === "binary" ? new TextEncoder().encode(atob(asset.content)) : asset.content;
17771
+ return {
17772
+ ...asset,
17773
+ content: stringOrUintArray
17774
+ };
17775
+ }
17776
+ if (asset.contentType === "thumbnail") {
17777
+ return asset;
17745
17778
  }
17746
- const stringOrUintArray = asset.binary ? new TextEncoder().encode(atob(asset.content)) : asset.content;
17747
- return {
17748
- ...asset,
17749
- content: stringOrUintArray
17750
- };
17779
+ return asset;
17751
17780
  });
17752
17781
  return fixedArtifacts;
17753
17782
  };
@@ -17769,16 +17798,14 @@ var screenshotTask = async ({
17769
17798
  }) => {
17770
17799
  const client = page._client();
17771
17800
  const target = page.target();
17772
- const perfTarget = startPerfMeasure("activate-target");
17773
17801
  await client.send("Target.activateTarget", {
17774
17802
  targetId: target._targetId
17775
17803
  });
17776
- stopPerfMeasure(perfTarget);
17777
- const shouldSetDefaultBackground = omitBackground;
17778
- if (shouldSetDefaultBackground)
17804
+ if (omitBackground) {
17779
17805
  await client.send("Emulation.setDefaultBackgroundColorOverride", {
17780
17806
  color: { r: 0, g: 0, b: 0, a: 0 }
17781
17807
  });
17808
+ }
17782
17809
  const cap = startPerfMeasure("capture");
17783
17810
  try {
17784
17811
  let result;
@@ -17814,13 +17841,13 @@ var screenshotTask = async ({
17814
17841
  result = value;
17815
17842
  }
17816
17843
  stopPerfMeasure(cap);
17817
- if (shouldSetDefaultBackground)
17844
+ if (omitBackground) {
17818
17845
  await client.send("Emulation.setDefaultBackgroundColorOverride");
17819
- const saveMarker = startPerfMeasure("save");
17846
+ }
17820
17847
  const buffer = Buffer.from(result.data, "base64");
17821
- if (path19)
17848
+ if (path19) {
17822
17849
  await fs12.promises.writeFile(path19, buffer);
17823
- stopPerfMeasure(saveMarker);
17850
+ }
17824
17851
  return buffer;
17825
17852
  } catch (err) {
17826
17853
  if (err.message.includes("Unable to capture screenshot")) {
@@ -17853,18 +17880,27 @@ var screenshot = (options) => {
17853
17880
  }));
17854
17881
  };
17855
17882
 
17856
- // src/screenshot-dom-element.ts
17857
- var screenshotDOMElement = async ({
17858
- page,
17883
+ // src/take-frame.ts
17884
+ var takeFrame = async ({
17885
+ freePage,
17859
17886
  imageFormat,
17860
17887
  jpegQuality,
17861
- opts,
17862
- height,
17888
+ frame,
17863
17889
  width,
17864
- timeoutInMilliseconds,
17865
- scale
17890
+ height,
17891
+ output,
17892
+ scale,
17893
+ wantsBuffer,
17894
+ timeoutInMilliseconds
17866
17895
  }) => {
17867
- const { path: path19 } = opts;
17896
+ const collectedAssets = await collectAssets({
17897
+ frame,
17898
+ freePage,
17899
+ timeoutInMilliseconds
17900
+ });
17901
+ if (imageFormat === "none") {
17902
+ return { buffer: null, collectedAssets };
17903
+ }
17868
17904
  if (imageFormat === "png" || imageFormat === "pdf" || imageFormat === "webp") {
17869
17905
  await puppeteerEvaluateWithCatch({
17870
17906
  pageFunction: () => {
@@ -17872,7 +17908,7 @@ var screenshotDOMElement = async ({
17872
17908
  },
17873
17909
  args: [],
17874
17910
  frame: null,
17875
- page,
17911
+ page: freePage,
17876
17912
  timeoutInMilliseconds
17877
17913
  });
17878
17914
  } else {
@@ -17882,93 +17918,21 @@ var screenshotDOMElement = async ({
17882
17918
  },
17883
17919
  args: [],
17884
17920
  frame: null,
17885
- page,
17921
+ page: freePage,
17886
17922
  timeoutInMilliseconds
17887
17923
  });
17888
17924
  }
17889
- if (imageFormat === "none") {
17890
- throw new TypeError('Tried to make a screenshot with format "none"');
17891
- }
17892
17925
  const buf = await screenshot({
17893
- page,
17926
+ page: freePage,
17894
17927
  omitBackground: imageFormat === "png",
17895
- path: path19 ?? undefined,
17928
+ path: (wantsBuffer ? undefined : output) ?? undefined,
17896
17929
  type: imageFormat,
17897
17930
  jpegQuality,
17898
17931
  width,
17899
17932
  height,
17900
17933
  scale
17901
17934
  });
17902
- if (typeof buf === "string") {
17903
- throw new TypeError("Expected a buffer");
17904
- }
17905
- return buf;
17906
- };
17907
-
17908
- // src/provide-screenshot.ts
17909
- var provideScreenshot = ({
17910
- page,
17911
- imageFormat,
17912
- options,
17913
- jpegQuality,
17914
- height,
17915
- width,
17916
- timeoutInMilliseconds,
17917
- scale
17918
- }) => {
17919
- return screenshotDOMElement({
17920
- page,
17921
- opts: {
17922
- path: options.output
17923
- },
17924
- imageFormat,
17925
- jpegQuality,
17926
- height,
17927
- width,
17928
- timeoutInMilliseconds,
17929
- scale
17930
- });
17931
- };
17932
-
17933
- // src/take-frame.ts
17934
- var takeFrame = async ({
17935
- freePage,
17936
- imageFormat,
17937
- jpegQuality,
17938
- frame,
17939
- width,
17940
- height,
17941
- output,
17942
- scale,
17943
- wantsBuffer,
17944
- timeoutInMilliseconds
17945
- }) => {
17946
- const collectedAssets = await collectAssets({
17947
- frame,
17948
- freePage,
17949
- timeoutInMilliseconds
17950
- });
17951
- if (imageFormat === "none") {
17952
- return { buffer: null, collectedAssets };
17953
- }
17954
- const shouldMakeBuffer = wantsBuffer;
17955
- const buf = await provideScreenshot({
17956
- page: freePage,
17957
- imageFormat,
17958
- jpegQuality,
17959
- options: {
17960
- frame,
17961
- output: wantsBuffer ? null : output
17962
- },
17963
- height,
17964
- width,
17965
- timeoutInMilliseconds,
17966
- scale
17967
- });
17968
- if (shouldMakeBuffer) {
17969
- return { buffer: buf, collectedAssets };
17970
- }
17971
- return { buffer: null, collectedAssets };
17935
+ return { buffer: buf, collectedAssets };
17972
17936
  };
17973
17937
 
17974
17938
  // src/render-frame-with-option-to-reject.ts
@@ -18038,7 +18002,6 @@ var renderFrameWithOptionToReject = async ({
18038
18002
  if (outputDir && onFrameBuffer && imageFormat !== "none") {
18039
18003
  throw new Error("Pass either `outputDir` or `onFrameBuffer` to renderFrames(), not both.");
18040
18004
  }
18041
- const id = startPerfMeasure("save");
18042
18005
  const { buffer, collectedAssets } = await takeFrame({
18043
18006
  frame,
18044
18007
  freePage: page,
@@ -18064,12 +18027,14 @@ var renderFrameWithOptionToReject = async ({
18064
18027
  }
18065
18028
  onFrameBuffer(buffer, frame);
18066
18029
  }
18067
- stopPerfMeasure(id);
18068
18030
  const onlyAvailableAssets = assets.filter(truthy);
18069
18031
  const previousAudioRenderAssets = onlyAvailableAssets.map((a) => a.audioAndVideoAssets).flat(2);
18070
18032
  const previousArtifactAssets = onlyAvailableAssets.map((a) => a.artifactAssets).flat(2);
18071
18033
  const audioAndVideoAssets = onlyAudioAndVideoAssets(collectedAssets);
18072
- const artifactAssets = onlyArtifact(collectedAssets);
18034
+ const artifactAssets = onlyArtifact({
18035
+ assets: collectedAssets,
18036
+ frameBuffer: buffer
18037
+ });
18073
18038
  for (const artifact of artifactAssets) {
18074
18039
  for (const previousArtifact of previousArtifactAssets) {
18075
18040
  if (artifact.filename === previousArtifact.filename) {
@@ -21695,7 +21660,10 @@ var innerRenderStill = async ({
21695
21660
  wantsBuffer: !output,
21696
21661
  timeoutInMilliseconds
21697
21662
  });
21698
- const artifactAssets = onlyArtifact(collectedAssets);
21663
+ const artifactAssets = onlyArtifact({
21664
+ assets: collectedAssets,
21665
+ frameBuffer: buffer
21666
+ });
21699
21667
  const previousArtifactAssets = [];
21700
21668
  for (const artifact of artifactAssets) {
21701
21669
  for (const previousArtifact of previousArtifactAssets) {
@@ -1,3 +1,7 @@
1
- import type { ArtifactAsset, AudioOrVideoAsset, TRenderAsset } from 'remotion/no-react';
1
+ import type { AudioOrVideoAsset, TRenderAsset } from 'remotion/no-react';
2
+ import type { EmittedArtifact } from './serialize-artifact';
2
3
  export declare const onlyAudioAndVideoAssets: (assets: TRenderAsset[]) => AudioOrVideoAsset[];
3
- export declare const onlyArtifact: (assets: TRenderAsset[]) => ArtifactAsset[];
4
+ export declare const onlyArtifact: ({ assets, frameBuffer, }: {
5
+ assets: TRenderAsset[];
6
+ frameBuffer: Buffer | null;
7
+ }) => EmittedArtifact[];
@@ -1,11 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onlyArtifact = exports.onlyAudioAndVideoAssets = void 0;
4
+ const truthy_1 = require("./truthy");
4
5
  const onlyAudioAndVideoAssets = (assets) => {
5
6
  return assets.filter((asset) => asset.type === 'audio' || asset.type === 'video');
6
7
  };
7
8
  exports.onlyAudioAndVideoAssets = onlyAudioAndVideoAssets;
8
- const onlyArtifact = (assets) => {
9
- return assets.filter((asset) => asset.type === 'artifact');
9
+ const onlyArtifact = ({ assets, frameBuffer, }) => {
10
+ const artifacts = assets.filter((asset) => asset.type === 'artifact');
11
+ return artifacts
12
+ .map((artifact) => {
13
+ if (artifact.contentType === 'binary' ||
14
+ artifact.contentType === 'text') {
15
+ return {
16
+ frame: artifact.frame,
17
+ content: artifact.content,
18
+ filename: artifact.filename,
19
+ };
20
+ }
21
+ if (artifact.contentType === 'thumbnail') {
22
+ if (frameBuffer === null) {
23
+ // A thumbnail artifact was defined to be emitted, but the output was not a video.
24
+ // Also, in Lambda, there are extra frames which are not video frames.
25
+ // This could happen if a thumbnail is unconditionally emitted.
26
+ return null;
27
+ }
28
+ return {
29
+ frame: artifact.frame,
30
+ content: new Uint8Array(frameBuffer),
31
+ filename: artifact.filename,
32
+ };
33
+ }
34
+ throw new Error('Unknown artifact type: ' + artifact);
35
+ })
36
+ .filter(truthy_1.truthy);
10
37
  };
11
38
  exports.onlyArtifact = onlyArtifact;
package/dist/perf.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- type PerfId = 'activate-target' | 'capture' | 'save' | 'extract-frame' | 'piping';
1
+ type PerfId = 'capture' | 'extract-frame' | 'piping';
2
2
  export declare const startPerfMeasure: (marker: PerfId) => number;
3
3
  export declare const stopPerfMeasure: (id: number) => void;
4
4
  export declare const getPerf: () => string[];
package/dist/perf.js CHANGED
@@ -2,9 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getPerf = exports.stopPerfMeasure = exports.startPerfMeasure = void 0;
4
4
  const perf = {
5
- 'activate-target': [],
6
5
  capture: [],
7
- save: [],
8
6
  'extract-frame': [],
9
7
  piping: [],
10
8
  };
@@ -9,4 +9,4 @@ export declare const screenshot: (options: {
9
9
  width: number;
10
10
  height: number;
11
11
  scale: number;
12
- }) => Promise<Buffer | string>;
12
+ }) => Promise<Buffer>;
@@ -11,7 +11,6 @@ const handle_javascript_exception_1 = require("./error-handling/handle-javascrip
11
11
  const filter_asset_types_1 = require("./filter-asset-types");
12
12
  const get_frame_padded_index_1 = require("./get-frame-padded-index");
13
13
  const logger_1 = require("./logger");
14
- const perf_1 = require("./perf");
15
14
  const seek_to_frame_1 = require("./seek-to-frame");
16
15
  const take_frame_1 = require("./take-frame");
17
16
  const truthy_1 = require("./truthy");
@@ -51,7 +50,6 @@ const renderFrameWithOptionToReject = async ({ reject, width, height, compId, at
51
50
  if (outputDir && onFrameBuffer && imageFormat !== 'none') {
52
51
  throw new Error('Pass either `outputDir` or `onFrameBuffer` to renderFrames(), not both.');
53
52
  }
54
- const id = (0, perf_1.startPerfMeasure)('save');
55
53
  const { buffer, collectedAssets } = await (0, take_frame_1.takeFrame)({
56
54
  frame,
57
55
  freePage: page,
@@ -79,7 +77,6 @@ const renderFrameWithOptionToReject = async ({ reject, width, height, compId, at
79
77
  }
80
78
  onFrameBuffer(buffer, frame);
81
79
  }
82
- (0, perf_1.stopPerfMeasure)(id);
83
80
  const onlyAvailableAssets = assets.filter(truthy_1.truthy);
84
81
  const previousAudioRenderAssets = onlyAvailableAssets
85
82
  .map((a) => a.audioAndVideoAssets)
@@ -88,7 +85,10 @@ const renderFrameWithOptionToReject = async ({ reject, width, height, compId, at
88
85
  .map((a) => a.artifactAssets)
89
86
  .flat(2);
90
87
  const audioAndVideoAssets = (0, filter_asset_types_1.onlyAudioAndVideoAssets)(collectedAssets);
91
- const artifactAssets = (0, filter_asset_types_1.onlyArtifact)(collectedAssets);
88
+ const artifactAssets = (0, filter_asset_types_1.onlyArtifact)({
89
+ assets: collectedAssets,
90
+ frameBuffer: buffer,
91
+ });
92
92
  for (const artifact of artifactAssets) {
93
93
  for (const previousArtifact of previousArtifactAssets) {
94
94
  if (artifact.filename === previousArtifact.filename) {
@@ -209,7 +209,10 @@ const innerRenderStill = async ({ composition, imageFormat = image_format_1.DEFA
209
209
  wantsBuffer: !output,
210
210
  timeoutInMilliseconds,
211
211
  });
212
- const artifactAssets = (0, filter_asset_types_1.onlyArtifact)(collectedAssets);
212
+ const artifactAssets = (0, filter_asset_types_1.onlyArtifact)({
213
+ assets: collectedAssets,
214
+ frameBuffer: buffer,
215
+ });
213
216
  const previousArtifactAssets = [];
214
217
  for (const artifact of artifactAssets) {
215
218
  for (const previousArtifact of previousArtifactAssets) {
@@ -9,4 +9,4 @@ export declare const screenshotTask: ({ format, height, omitBackground, page, wi
9
9
  width: number;
10
10
  height: number;
11
11
  scale: number;
12
- }) => Promise<Buffer | string>;
12
+ }) => Promise<Buffer>;
@@ -10,16 +10,14 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
10
10
  var _a;
11
11
  const client = page._client();
12
12
  const target = page.target();
13
- const perfTarget = (0, perf_1.startPerfMeasure)('activate-target');
14
13
  await client.send('Target.activateTarget', {
15
14
  targetId: target._targetId,
16
15
  });
17
- (0, perf_1.stopPerfMeasure)(perfTarget);
18
- const shouldSetDefaultBackground = omitBackground;
19
- if (shouldSetDefaultBackground)
16
+ if (omitBackground) {
20
17
  await client.send('Emulation.setDefaultBackgroundColorOverride', {
21
18
  color: { r: 0, g: 0, b: 0, a: 0 },
22
19
  });
20
+ }
23
21
  const cap = (0, perf_1.startPerfMeasure)('capture');
24
22
  try {
25
23
  let result;
@@ -63,13 +61,13 @@ const screenshotTask = async ({ format, height, omitBackground, page, width, pat
63
61
  result = value;
64
62
  }
65
63
  (0, perf_1.stopPerfMeasure)(cap);
66
- if (shouldSetDefaultBackground)
64
+ if (omitBackground) {
67
65
  await client.send('Emulation.setDefaultBackgroundColorOverride');
68
- const saveMarker = (0, perf_1.startPerfMeasure)('save');
66
+ }
69
67
  const buffer = Buffer.from(result.data, 'base64');
70
- if (path)
68
+ if (path) {
71
69
  await node_fs_1.default.promises.writeFile(path, buffer);
72
- (0, perf_1.stopPerfMeasure)(saveMarker);
70
+ }
73
71
  return buffer;
74
72
  }
75
73
  catch (err) {
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.takeFrame = void 0;
4
4
  const collect_assets_1 = require("./collect-assets");
5
- const provide_screenshot_1 = require("./provide-screenshot");
5
+ const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
6
+ const puppeteer_screenshot_1 = require("./puppeteer-screenshot");
6
7
  const takeFrame = async ({ freePage, imageFormat, jpegQuality, frame, width, height, output, scale, wantsBuffer, timeoutInMilliseconds, }) => {
8
+ var _a;
7
9
  const collectedAssets = await (0, collect_assets_1.collectAssets)({
8
10
  frame,
9
11
  freePage,
@@ -12,23 +14,40 @@ const takeFrame = async ({ freePage, imageFormat, jpegQuality, frame, width, hei
12
14
  if (imageFormat === 'none') {
13
15
  return { buffer: null, collectedAssets };
14
16
  }
15
- const shouldMakeBuffer = wantsBuffer;
16
- const buf = await (0, provide_screenshot_1.provideScreenshot)({
17
+ if (imageFormat === 'png' ||
18
+ imageFormat === 'pdf' ||
19
+ imageFormat === 'webp') {
20
+ await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
21
+ pageFunction: () => {
22
+ document.body.style.background = 'transparent';
23
+ },
24
+ args: [],
25
+ frame: null,
26
+ page: freePage,
27
+ timeoutInMilliseconds,
28
+ });
29
+ }
30
+ else {
31
+ await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
32
+ pageFunction: () => {
33
+ document.body.style.background = 'black';
34
+ },
35
+ args: [],
36
+ frame: null,
37
+ page: freePage,
38
+ timeoutInMilliseconds,
39
+ });
40
+ }
41
+ const buf = await (0, puppeteer_screenshot_1.screenshot)({
17
42
  page: freePage,
18
- imageFormat,
43
+ omitBackground: imageFormat === 'png',
44
+ path: (_a = (wantsBuffer ? undefined : output)) !== null && _a !== void 0 ? _a : undefined,
45
+ type: imageFormat,
19
46
  jpegQuality,
20
- options: {
21
- frame,
22
- output: wantsBuffer ? null : output,
23
- },
24
- height,
25
47
  width,
26
- timeoutInMilliseconds,
48
+ height,
27
49
  scale,
28
50
  });
29
- if (shouldMakeBuffer) {
30
- return { buffer: buf, collectedAssets };
31
- }
32
- return { buffer: null, collectedAssets };
51
+ return { buffer: buf, collectedAssets };
33
52
  };
34
53
  exports.takeFrame = takeFrame;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.289",
6
+ "version": "4.0.290",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.17.1",
21
- "remotion": "4.0.289",
22
- "@remotion/streaming": "4.0.289"
21
+ "remotion": "4.0.290",
22
+ "@remotion/streaming": "4.0.290"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": ">=16.8.0",
@@ -33,17 +33,17 @@
33
33
  "react-dom": "19.0.0",
34
34
  "@types/ws": "8.5.10",
35
35
  "eslint": "9.19.0",
36
- "@remotion/example-videos": "4.0.289",
37
- "@remotion/eslint-config-internal": "4.0.289"
36
+ "@remotion/example-videos": "4.0.290",
37
+ "@remotion/eslint-config-internal": "4.0.290"
38
38
  },
39
39
  "optionalDependencies": {
40
- "@remotion/compositor-darwin-arm64": "4.0.289",
41
- "@remotion/compositor-linux-arm64-musl": "4.0.289",
42
- "@remotion/compositor-linux-x64-gnu": "4.0.289",
43
- "@remotion/compositor-darwin-x64": "4.0.289",
44
- "@remotion/compositor-linux-x64-musl": "4.0.289",
45
- "@remotion/compositor-win32-x64-msvc": "4.0.289",
46
- "@remotion/compositor-linux-arm64-gnu": "4.0.289"
40
+ "@remotion/compositor-darwin-x64": "4.0.290",
41
+ "@remotion/compositor-darwin-arm64": "4.0.290",
42
+ "@remotion/compositor-linux-arm64-gnu": "4.0.290",
43
+ "@remotion/compositor-linux-x64-musl": "4.0.290",
44
+ "@remotion/compositor-linux-arm64-musl": "4.0.290",
45
+ "@remotion/compositor-linux-x64-gnu": "4.0.290",
46
+ "@remotion/compositor-win32-x64-msvc": "4.0.290"
47
47
  },
48
48
  "keywords": [
49
49
  "remotion",
@@ -1,8 +0,0 @@
1
- const out = await Bun.build({
2
- entrypoints: ['src/ensure-browser.ts'],
3
- target: 'node',
4
- });
5
-
6
- Bun.write('ensure-browser.mjs', await out.outputs[0].arrayBuffer());
7
-
8
- export {};
package/bundle.ts DELETED
@@ -1,27 +0,0 @@
1
- import {buildPackage} from '../.monorepo/builder';
2
-
3
- await buildPackage({
4
- formats: {
5
- cjs: 'use-tsc',
6
- esm: 'build',
7
- },
8
- external: 'dependencies',
9
- entrypoints: [
10
- {
11
- path: 'src/index.ts',
12
- target: 'node',
13
- },
14
- {
15
- path: 'src/client.ts',
16
- target: 'node',
17
- },
18
- {
19
- path: 'src/pure.ts',
20
- target: 'browser',
21
- },
22
- {
23
- path: 'src/error-handling.ts',
24
- target: 'node',
25
- },
26
- ],
27
- });
package/eslint.config.mjs DELETED
@@ -1,25 +0,0 @@
1
- import {remotionFlatConfig} from '@remotion/eslint-config-internal';
2
-
3
- const config = remotionFlatConfig({react: false});
4
-
5
- export default [
6
- {
7
- ...config,
8
- rules: {
9
- ...config.rules,
10
- '@typescript-eslint/no-use-before-define': 'off',
11
- 'no-restricted-imports': [
12
- 'error',
13
- {
14
- patterns: ['@remotion/*/src/*', 'remotion/src/*'],
15
- paths: ['remotion', 'react', 'react-dom'],
16
- },
17
- ],
18
- },
19
- ignores: ['src/browser/**'],
20
- },
21
- {
22
- ...config,
23
- files: ['src/test/**'],
24
- },
25
- ];