@remotion/renderer 3.3.43 → 3.3.45

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.
@@ -0,0 +1,2 @@
1
+ import type { SpecialVCodecForTransparency } from './assets/download-map';
2
+ export declare const determineVcodecFfmepgFlags: (vcodecFlag: SpecialVCodecForTransparency) => string[];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.determineVcodecFfmepgFlags = void 0;
4
+ const truthy_1 = require("./truthy");
5
+ const determineVcodecFfmepgFlags = (vcodecFlag) => {
6
+ return [
7
+ vcodecFlag === 'vp9' ? '-vcodec' : null,
8
+ vcodecFlag === 'vp9' ? 'libvpx-vp9' : null,
9
+ vcodecFlag === 'vp8' ? '-vcodec' : null,
10
+ vcodecFlag === 'vp8' ? 'libvpx' : null,
11
+ ].filter(truthy_1.truthy);
12
+ };
13
+ exports.determineVcodecFfmepgFlags = determineVcodecFfmepgFlags;
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.symbolicateError = void 0;
4
4
  const symbolicate_stacktrace_1 = require("../symbolicate-stacktrace");
5
+ const truthy_1 = require("../truthy");
5
6
  const handle_javascript_exception_1 = require("./handle-javascript-exception");
6
7
  const symbolicateError = async (symbolicateableError) => {
7
8
  const { delayRenderCall, stackFrame } = symbolicateableError;
8
9
  const [mainErrorFrames, delayRenderFrames] = await Promise.all([
9
10
  stackFrame ? (0, symbolicate_stacktrace_1.symbolicateStackTrace)(stackFrame) : null,
10
11
  delayRenderCall ? (0, symbolicate_stacktrace_1.symbolicateStackTrace)(delayRenderCall) : null,
11
- ]);
12
+ ].filter(truthy_1.truthy));
12
13
  const symbolicatedErr = new handle_javascript_exception_1.ErrorWithStackFrame({
13
14
  message: symbolicateableError.message,
14
15
  symbolicatedStackFrames: mainErrorFrames,
@@ -0,0 +1,3 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { TCompMetadata } from 'remotion';
3
+ export declare const getCompositionsFromMarkup: (Comp: ComponentType) => TCompMetadata[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionsFromMarkup = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const server_1 = require("react-dom/server");
6
+ const getCompositionsFromMarkup = (Comp) => {
7
+ process.env.REMOTION_SERVER_RENDERING = 'true';
8
+ const str = (0, server_1.renderToString)((0, jsx_runtime_1.jsx)(Comp, {}));
9
+ const matches = str.matchAll(/<div>(.*?)<\/div>/g);
10
+ const metadata = [];
11
+ for (const match of matches) {
12
+ const json = JSON.parse(match[1]);
13
+ metadata.push(json);
14
+ }
15
+ return metadata;
16
+ };
17
+ exports.getCompositionsFromMarkup = getCompositionsFromMarkup;
@@ -0,0 +1,3 @@
1
+ import type { ComponentType } from 'react';
2
+ import type { TCompMetadata } from 'remotion';
3
+ export declare const getCompositionsFromMarkup: (Comp: ComponentType) => TCompMetadata[];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCompositionsFromMarkup = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const server_1 = require("react-dom/server");
6
+ const getCompositionsFromMarkup = (Comp) => {
7
+ process.env.REMOTION_SERVER_RENDERING = 'true';
8
+ const str = (0, server_1.renderToString)((0, jsx_runtime_1.jsx)(Comp, {}));
9
+ console.log({ str }, (0, jsx_runtime_1.jsx)(Comp, {}));
10
+ const matches = str.matchAll(/<div>(.*?)<\/div>/g);
11
+ const metadata = [];
12
+ for (const match of matches) {
13
+ const json = JSON.parse(match[1]);
14
+ metadata.push(json);
15
+ }
16
+ return metadata;
17
+ };
18
+ exports.getCompositionsFromMarkup = getCompositionsFromMarkup;
package/dist/index.d.ts CHANGED
@@ -119,8 +119,8 @@ export declare const RenderInternals: {
119
119
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
120
120
  DEFAULT_BROWSER: import("./browser").Browser;
121
121
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
122
- DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
123
- validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
122
+ DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
123
+ validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
124
124
  validImageFormats: readonly ["png", "jpeg", "none"];
125
125
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
126
126
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
@@ -130,7 +130,7 @@ export declare const RenderInternals: {
130
130
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
131
131
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
132
132
  logLevels: readonly ["verbose", "info", "warn", "error"];
133
- isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
133
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
134
134
  isValidLogLevel: (level: string) => boolean;
135
135
  perf: typeof perf;
136
136
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
@@ -0,0 +1,2 @@
1
+ export declare const lockPortSelection: () => void;
2
+ export declare const unlockPortSelection: () => void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.unlockPortSelection = exports.lockPortSelection = void 0;
4
+ const locks = [];
5
+ const waitForPortSelection = () => { };
6
+ const lockPortSelection = () => {
7
+ locks.push();
8
+ };
9
+ exports.lockPortSelection = lockPortSelection;
10
+ const unlockPortSelection = () => { };
11
+ exports.unlockPortSelection = unlockPortSelection;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import type { SmallTCompMetadata, TAsset } from 'remotion';
2
3
  import type { DownloadMap } from './assets/download-map';
3
4
  import type { BrowserExecutable } from './browser-executable';
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.seekToFrame = exports.waitForReady = void 0;
4
+ const symbolicateable_error_1 = require("./error-handling/symbolicateable-error");
5
+ const parse_browser_error_stack_1 = require("./parse-browser-error-stack");
4
6
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
5
7
  const waitForReady = (page) => {
6
8
  return Promise.race([
@@ -20,6 +22,29 @@ const waitForReady = (page) => {
20
22
  .catch((err) => {
21
23
  throw err;
22
24
  }),
25
+ page
26
+ .mainFrame()
27
+ ._mainWorld.waitForFunction(page.browser, 'window.remotion_cancelledError !== undefined')
28
+ .then(() => {
29
+ return (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
30
+ pageFunction: () => window.remotion_cancelledError,
31
+ args: [],
32
+ frame: null,
33
+ page,
34
+ });
35
+ })
36
+ .then((val) => {
37
+ if (typeof val !== 'string') {
38
+ throw val;
39
+ }
40
+ throw new symbolicateable_error_1.SymbolicateableError({
41
+ frame: null,
42
+ stack: val,
43
+ name: 'CancelledError',
44
+ message: val.split('\n')[0],
45
+ stackFrame: (0, parse_browser_error_stack_1.parseStack)(val.split('\n')),
46
+ });
47
+ }),
23
48
  ]);
24
49
  };
25
50
  exports.waitForReady = waitForReady;
@@ -9,8 +9,6 @@ const get_port_1 = require("./get-port");
9
9
  const offthread_video_server_1 = require("./offthread-video-server");
10
10
  const serve_handler_1 = require("./serve-handler");
11
11
  const serveStatic = async (path, options) => {
12
- var _a;
13
- const { port, didUsePort } = await (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100);
14
12
  const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
15
13
  ffmpegExecutable: options.ffmpegExecutable,
16
14
  ffprobeExecutable: options.ffprobeExecutable,
@@ -19,65 +17,86 @@ const serveStatic = async (path, options) => {
19
17
  downloadMap: options.downloadMap,
20
18
  remotionRoot: options.remotionRoot,
21
19
  });
22
- try {
23
- const connections = {};
24
- const server = http_1.default
25
- .createServer((request, response) => {
26
- var _a;
27
- if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('/proxy')) {
28
- return offthreadRequest(request, response);
29
- }
30
- if (path === null) {
31
- response.writeHead(404);
32
- response.end('Server only supports /proxy');
33
- return;
34
- }
35
- (0, serve_handler_1.serveHandler)(request, response, {
36
- public: path,
37
- }).catch(() => {
38
- response.statusCode = 500;
39
- response.end('Error serving file');
40
- });
41
- })
42
- .listen(port);
43
- server.on('connection', (conn) => {
44
- const key = conn.remoteAddress + ':' + conn.remotePort;
45
- connections[key] = conn;
46
- conn.on('close', () => {
47
- delete connections[key];
48
- });
20
+ const connections = {};
21
+ const server = http_1.default.createServer((request, response) => {
22
+ var _a;
23
+ if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('/proxy')) {
24
+ return offthreadRequest(request, response);
25
+ }
26
+ if (path === null) {
27
+ response.writeHead(404);
28
+ response.end('Server only supports /proxy');
29
+ return;
30
+ }
31
+ (0, serve_handler_1.serveHandler)(request, response, {
32
+ public: path,
33
+ }).catch(() => {
34
+ response.statusCode = 500;
35
+ response.end('Error serving file');
49
36
  });
50
- server.on('listening', () => {
51
- didUsePort();
37
+ });
38
+ server.on('connection', (conn) => {
39
+ const key = conn.remoteAddress + ':' + conn.remotePort;
40
+ connections[key] = conn;
41
+ conn.on('close', () => {
42
+ delete connections[key];
52
43
  });
53
- const destroyConnections = function () {
54
- for (const key in connections)
55
- connections[key].destroy();
56
- };
57
- const close = () => {
58
- return new Promise((resolve, reject) => {
59
- destroyConnections();
60
- server.close((err) => {
61
- if (err) {
62
- if (err.code === 'ERR_SERVER_NOT_RUNNING') {
63
- return resolve();
64
- }
44
+ });
45
+ let selectedPort = null;
46
+ const maxTries = 5;
47
+ for (let i = 0; i < maxTries; i++) {
48
+ try {
49
+ selectedPort = await new Promise((resolve, reject) => {
50
+ var _a;
51
+ (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100)
52
+ .then(({ port, didUsePort }) => {
53
+ server.listen(port);
54
+ server.on('listening', () => {
55
+ resolve(port);
56
+ return didUsePort();
57
+ });
58
+ server.on('error', (err) => {
65
59
  reject(err);
66
- }
67
- else {
68
- resolve();
69
- }
70
- });
60
+ });
61
+ })
62
+ .catch((err) => reject(err));
71
63
  });
72
- };
73
- return { port, close };
74
- }
75
- catch (err) {
76
- console.log({ err, msg: err.message });
77
- if (err.message.includes('EADDRINUSE')) {
78
- return (0, exports.serveStatic)(path, options);
64
+ const destroyConnections = function () {
65
+ for (const key in connections)
66
+ connections[key].destroy();
67
+ };
68
+ const close = () => {
69
+ return new Promise((resolve, reject) => {
70
+ destroyConnections();
71
+ server.close((err) => {
72
+ if (err) {
73
+ if (err.code ===
74
+ 'ERR_SERVER_NOT_RUNNING') {
75
+ return resolve();
76
+ }
77
+ reject(err);
78
+ }
79
+ else {
80
+ resolve();
81
+ }
82
+ });
83
+ });
84
+ };
85
+ return { port: selectedPort, close };
86
+ }
87
+ catch (err) {
88
+ if (!(err instanceof Error)) {
89
+ throw err;
90
+ }
91
+ const codedError = err;
92
+ if (codedError.code === 'EADDRINUSE') {
93
+ // Already in use, try another port
94
+ }
95
+ else {
96
+ throw err;
97
+ }
79
98
  }
80
- throw err;
81
99
  }
100
+ throw new Error(`Tried ${maxTries} times to find a free port. Giving up.`);
82
101
  };
83
102
  exports.serveStatic = serveStatic;
@@ -16,6 +16,9 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
16
16
  await page.evaluateOnNewDocument((timeout) => {
17
17
  window.remotion_puppeteerTimeout = timeout;
18
18
  }, actualTimeout);
19
+ if (typeof inputProps === 'string') {
20
+ throw new Error('Input props should be an object, not a string.');
21
+ }
19
22
  if (inputProps) {
20
23
  await page.evaluateOnNewDocument((input) => {
21
24
  window.remotion_inputProps = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.3.43",
3
+ "version": "3.3.45",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "execa": "5.1.1",
26
26
  "extract-zip": "2.0.1",
27
- "remotion": "3.3.43",
27
+ "remotion": "3.3.45",
28
28
  "source-map": "^0.8.0-beta.0",
29
29
  "ws": "8.7.0"
30
30
  },
@@ -49,13 +49,13 @@
49
49
  "vitest": "0.24.3"
50
50
  },
51
51
  "optionalDependencies": {
52
- "@remotion/compositor-darwin-arm64": "3.3.43",
53
- "@remotion/compositor-darwin-x64": "3.3.43",
54
- "@remotion/compositor-linux-arm64-gnu": "3.3.43",
55
- "@remotion/compositor-linux-arm64-musl": "3.3.43",
56
- "@remotion/compositor-linux-x64-gnu": "3.3.43",
57
- "@remotion/compositor-linux-x64-musl": "3.3.43",
58
- "@remotion/compositor-win32-x64-msvc": "3.3.43"
52
+ "@remotion/compositor-darwin-arm64": "3.3.45",
53
+ "@remotion/compositor-darwin-x64": "3.3.45",
54
+ "@remotion/compositor-linux-arm64-gnu": "3.3.45",
55
+ "@remotion/compositor-linux-arm64-musl": "3.3.45",
56
+ "@remotion/compositor-linux-x64-gnu": "3.3.45",
57
+ "@remotion/compositor-linux-x64-musl": "3.3.45",
58
+ "@remotion/compositor-win32-x64-msvc": "3.3.45"
59
59
  },
60
60
  "keywords": [
61
61
  "remotion",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "3585e437a30ba001e983539728eb1914172b729c"
70
+ "gitHead": "75c028236b43ff2fd0f3f3772f9f79cfde069e36"
71
71
  }