@remotion/renderer 3.3.8 → 3.3.10

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.
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.redirectStatusCodes = void 0;
4
- exports.redirectStatusCodes = [301, 302, 303, 304, 307, 308];
4
+ // Don't handle 304 status code (Not Modified) as a redirect,
5
+ // since the browser will display the right page.
6
+ exports.redirectStatusCodes = [301, 302, 303, 307, 308];
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { SmallTCompMetadata } from 'remotion';
2
3
  import type { RenderMediaOnDownload } from './assets/download-and-map-assets-to-file';
3
4
  import type { DownloadMap } from './assets/download-map';
@@ -10,7 +11,7 @@ import type { CancelSignal } from './make-cancel-signal';
10
11
  import type { ChromiumOptions } from './open-browser';
11
12
  declare type InnerStillOptions = {
12
13
  composition: SmallTCompMetadata;
13
- output: string;
14
+ output?: string | null;
14
15
  frame?: number;
15
16
  inputProps?: unknown;
16
17
  imageFormat?: StillImageFormat;
@@ -32,6 +33,9 @@ declare type InnerStillOptions = {
32
33
  */
33
34
  downloadMap?: DownloadMap;
34
35
  };
36
+ declare type RenderStillReturnValue = {
37
+ buffer: Buffer | null;
38
+ };
35
39
  export declare type RenderStillOptions = InnerStillOptions & ServeUrlOrWebpackBundle & {
36
40
  port?: number | null;
37
41
  };
@@ -40,5 +44,5 @@ export declare type RenderStillOptions = InnerStillOptions & ServeUrlOrWebpackBu
40
44
  * @description Render a still frame from a composition
41
45
  * @link https://www.remotion.dev/docs/renderer/render-still
42
46
  */
43
- export declare const renderStill: (options: RenderStillOptions) => Promise<void>;
47
+ export declare const renderStill: (options: RenderStillOptions) => Promise<RenderStillReturnValue>;
44
48
  export {};
@@ -61,24 +61,24 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
61
61
  });
62
62
  (0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
63
63
  (0, validate_scale_1.validateScale)(scale);
64
- if (typeof output !== 'string') {
65
- throw new TypeError('`output` parameter was not passed or is not a string');
66
- }
67
- output = path_1.default.resolve(process.cwd(), output);
64
+ output =
65
+ typeof output === 'string' ? path_1.default.resolve(process.cwd(), output) : null;
68
66
  if (quality !== undefined && imageFormat !== 'jpeg') {
69
67
  throw new Error("You can only pass the `quality` option if `imageFormat` is 'jpeg'.");
70
68
  }
71
69
  (0, quality_1.validateQuality)(quality);
72
- if (fs_1.default.existsSync(output)) {
73
- if (!overwrite) {
74
- throw new Error(`Cannot render still - "overwrite" option was set to false, but the output destination ${output} already exists.`);
75
- }
76
- const stat = (0, fs_1.statSync)(output);
77
- if (!stat.isFile()) {
78
- throw new Error(`The output location ${output} already exists, but is not a file, but something else (e.g. folder). Cannot save to it.`);
70
+ if (output) {
71
+ if (fs_1.default.existsSync(output)) {
72
+ if (!overwrite) {
73
+ throw new Error(`Cannot render still - "overwrite" option was set to false, but the output destination ${output} already exists.`);
74
+ }
75
+ const stat = (0, fs_1.statSync)(output);
76
+ if (!stat.isFile()) {
77
+ throw new Error(`The output location ${output} already exists, but is not a file, but something else (e.g. folder). Cannot save to it.`);
78
+ }
79
79
  }
80
+ (0, ensure_output_directory_1.ensureOutputDirectory)(output);
80
81
  }
81
- (0, ensure_output_directory_1.ensureOutputDirectory)(output);
82
82
  const browserInstance = puppeteerInstance !== null && puppeteerInstance !== void 0 ? puppeteerInstance : (await (0, open_browser_1.openBrowser)(browser_1.DEFAULT_BROWSER, {
83
83
  browserExecutable,
84
84
  shouldDumpIo: dumpBrowserLogs,
@@ -151,7 +151,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
151
151
  page,
152
152
  });
153
153
  await (0, seek_to_frame_1.seekToFrame)({ frame: stillFrame, page });
154
- await (0, provide_screenshot_1.provideScreenshot)({
154
+ const buffer = await (0, provide_screenshot_1.provideScreenshot)({
155
155
  page,
156
156
  imageFormat,
157
157
  quality,
@@ -163,6 +163,7 @@ const innerRenderStill = async ({ composition, quality, imageFormat = 'png', ser
163
163
  width: composition.width,
164
164
  });
165
165
  await cleanup();
166
+ return { buffer: output ? null : buffer };
166
167
  };
167
168
  /**
168
169
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.3.8",
3
+ "version": "3.3.10",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,7 +22,7 @@
22
22
  "dependencies": {
23
23
  "execa": "5.1.1",
24
24
  "extract-zip": "2.0.1",
25
- "remotion": "3.3.8",
25
+ "remotion": "3.3.10",
26
26
  "source-map": "^0.8.0-beta.0",
27
27
  "ws": "8.7.0"
28
28
  },
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "4d4c78cf83b5fd085f24d5fd19f4507815e200a7"
60
+ "gitHead": "4909df63b9663ecc0294f186d5fe7efd59eee143"
61
61
  }