@remotion/cli 3.3.44 → 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.
@@ -214,6 +214,6 @@ const Canvas = () => {
214
214
  zoomOut.unregister();
215
215
  };
216
216
  }, [keybindings, onReset, onZoomIn, onZoomOut]);
217
- return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
217
+ return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, style: container, children: [size ? (0, jsx_runtime_1.jsx)(Preview_1.VideoPreview, { canvasSize: size }) : null, isFit ? null : ((0, jsx_runtime_1.jsx)("div", { style: resetZoom, className: "css-reset", children: (0, jsx_runtime_1.jsx)(ResetZoomButton_1.ResetZoomButton, { onClick: onReset }) }))] }));
218
218
  };
219
219
  exports.Canvas = Canvas;
@@ -1,4 +1,4 @@
1
- import type { WebpackOverrideFn } from 'remotion';
1
+ import type { WebpackOverrideFn } from '@remotion/bundler';
2
2
  import type { LiveEventsServer } from './live-events';
3
3
  export declare const startServer: (options: {
4
4
  entry: string;
@@ -79,9 +79,38 @@ const startServer = async (options) => {
79
79
  });
80
80
  });
81
81
  const desiredPort = (_d = options === null || options === void 0 ? void 0 : options.port) !== null && _d !== void 0 ? _d : undefined;
82
- const { port, didUsePort } = await renderer_1.RenderInternals.getDesiredPort(desiredPort, 3000, 3100);
83
- server.listen(port);
84
- server.on('listening', () => didUsePort());
85
- return { port, liveEventsServer };
82
+ const maxTries = 5;
83
+ for (let i = 0; i < maxTries; i++) {
84
+ try {
85
+ const selectedPort = await new Promise((resolve, reject) => {
86
+ renderer_1.RenderInternals.getDesiredPort(desiredPort, 3000, 3100)
87
+ .then(({ port, didUsePort }) => {
88
+ server.listen(port);
89
+ server.on('listening', () => {
90
+ resolve(port);
91
+ return didUsePort();
92
+ });
93
+ server.on('error', (err) => {
94
+ reject(err);
95
+ });
96
+ })
97
+ .catch((err) => reject(err));
98
+ });
99
+ return { port: selectedPort, liveEventsServer };
100
+ }
101
+ catch (err) {
102
+ if (!(err instanceof Error)) {
103
+ throw err;
104
+ }
105
+ const codedError = err;
106
+ if (codedError.code === 'EADDRINUSE') {
107
+ log_1.Log.error(`Port ${codedError.port} is already in use. Trying another port...`);
108
+ }
109
+ else {
110
+ throw err;
111
+ }
112
+ }
113
+ }
114
+ throw new Error(`Tried ${maxTries} times to find a free port. Giving up.`);
86
115
  };
87
116
  exports.startServer = startServer;
@@ -0,0 +1,2 @@
1
+ export declare const ENV_VARIABLES_ENV_NAME: "ENV_VARIABLES";
2
+ export declare const setupEnvVariables: () => void;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupEnvVariables = exports.ENV_VARIABLES_ENV_NAME = void 0;
4
+ const get_environment_1 = require("remotion/src/get-environment");
5
+ exports.ENV_VARIABLES_ENV_NAME = 'ENV_VARIABLES';
6
+ const getEnvVariables = () => {
7
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'rendering') {
8
+ const param = window.remotion_envVariables;
9
+ if (!param) {
10
+ return {};
11
+ }
12
+ return { ...JSON.parse(param), NODE_ENV: process.env.NODE_ENV };
13
+ }
14
+ if ((0, get_environment_1.getRemotionEnvironment)() === 'preview') {
15
+ // Webpack will convert this to an object at compile time.
16
+ // Don't convert this syntax to a computed property.
17
+ return {
18
+ ...process.env.ENV_VARIABLES,
19
+ NODE_ENV: process.env.NODE_ENV,
20
+ };
21
+ }
22
+ throw new Error('Can only call getEnvVariables() if environment is `rendering` or `preview`');
23
+ };
24
+ const setupEnvVariables = () => {
25
+ const env = getEnvVariables();
26
+ if (!window.process) {
27
+ window.process = {};
28
+ }
29
+ if (!window.process.env) {
30
+ window.process.env = {};
31
+ }
32
+ Object.keys(env).forEach((key) => {
33
+ window.process.env[key] = env[key];
34
+ });
35
+ };
36
+ exports.setupEnvVariables = setupEnvVariables;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/cli",
3
- "version": "3.3.44",
3
+ "version": "3.3.45",
4
4
  "description": "CLI for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -22,16 +22,16 @@
22
22
  "author": "Jonny Burger <jonny@remotion.dev>",
23
23
  "license": "SEE LICENSE IN LICENSE.md",
24
24
  "dependencies": {
25
- "@remotion/bundler": "3.3.44",
26
- "@remotion/media-utils": "3.3.44",
27
- "@remotion/player": "3.3.44",
28
- "@remotion/renderer": "3.3.44",
25
+ "@remotion/bundler": "3.3.45",
26
+ "@remotion/media-utils": "3.3.45",
27
+ "@remotion/player": "3.3.45",
28
+ "@remotion/renderer": "3.3.45",
29
29
  "better-opn": "2.1.1",
30
30
  "dotenv": "9.0.2",
31
31
  "memfs": "3.4.3",
32
32
  "minimist": "1.2.6",
33
33
  "prompts": "2.4.1",
34
- "remotion": "3.3.44",
34
+ "remotion": "3.3.45",
35
35
  "semver": "7.3.5",
36
36
  "source-map": "0.6.1"
37
37
  },
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "7ba7bbdacbda1499ecdb92f1d9581d5db458edf8"
74
+ "gitHead": "75c028236b43ff2fd0f3f3772f9f79cfde069e36"
75
75
  }