@remotion/renderer 4.0.496 → 4.0.497

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.
@@ -4023,17 +4023,13 @@ var publicPathOption = {
4023
4023
  children: [
4024
4024
  "The path of the URL where the bundle is going to be hosted. By default it is ",
4025
4025
  /* @__PURE__ */ jsx68("code", {
4026
- children: "/"
4026
+ children: "./"
4027
4027
  }),
4028
- ", meaning that the bundle is going to be hosted at the root of the domain (e.g. ",
4029
- /* @__PURE__ */ jsx68("code", {
4030
- children: "https://localhost:3000/"
4031
- }),
4032
- "). If you are deploying to a subdirectory (e.g. ",
4028
+ ", making the bundle relocatable. Set an absolute path such as ",
4033
4029
  /* @__PURE__ */ jsx68("code", {
4034
4030
  children: "/sites/my-site/"
4035
4031
  }),
4036
- "), you should set this to the subdirectory."
4032
+ " to host the bundle at a fixed location."
4037
4033
  ]
4038
4034
  });
4039
4035
  },
@@ -18605,6 +18605,19 @@ var wrapWithErrorHandling = (fn) => {
18605
18605
  };
18606
18606
 
18607
18607
  // src/get-compositions.ts
18608
+ var convertGetCompositionsArgumentsToOptions = (args) => {
18609
+ if (args.length === 0) {
18610
+ throw new Error("No serve URL or webpack bundle directory was passed to getCompositions().");
18611
+ }
18612
+ const firstArg = args[0];
18613
+ if (typeof firstArg === "string") {
18614
+ return {
18615
+ ...args[1] ?? {},
18616
+ serveUrl: firstArg
18617
+ };
18618
+ }
18619
+ return firstArg;
18620
+ };
18608
18621
  var innerGetCompositions = async ({
18609
18622
  envVariables,
18610
18623
  serializedInputPropsWithCustomSchema,
@@ -18790,8 +18803,9 @@ var internalGetCompositionsRaw = async ({
18790
18803
  });
18791
18804
  };
18792
18805
  var internalGetCompositions = wrapWithErrorHandling(internalGetCompositionsRaw);
18793
- var getCompositions = (serveUrlOrWebpackUrl, config) => {
18794
- if (!serveUrlOrWebpackUrl) {
18806
+ var getCompositions = (...args) => {
18807
+ const options2 = convertGetCompositionsArgumentsToOptions(args);
18808
+ if (typeof options2?.serveUrl !== "string" || !options2.serveUrl) {
18795
18809
  throw new Error("No serve URL or webpack bundle directory was passed to getCompositions().");
18796
18810
  }
18797
18811
  const {
@@ -18809,8 +18823,9 @@ var getCompositions = (serveUrlOrWebpackUrl, config) => {
18809
18823
  offthreadVideoCacheSizeInBytes,
18810
18824
  chromeMode,
18811
18825
  offthreadVideoThreads,
18812
- mediaCacheSizeInBytes
18813
- } = config ?? {};
18826
+ mediaCacheSizeInBytes,
18827
+ serveUrl
18828
+ } = options2;
18814
18829
  const indent = false;
18815
18830
  const logLevel = passedLogLevel ?? "info";
18816
18831
  return internalGetCompositions({
@@ -18826,7 +18841,7 @@ var getCompositions = (serveUrlOrWebpackUrl, config) => {
18826
18841
  onBrowserLog: onBrowserLog ?? null,
18827
18842
  port: port ?? null,
18828
18843
  puppeteerInstance: puppeteerInstance ?? undefined,
18829
- serveUrlOrWebpackUrl,
18844
+ serveUrlOrWebpackUrl: serveUrl,
18830
18845
  server: undefined,
18831
18846
  timeoutInMilliseconds: timeoutInMilliseconds ?? DEFAULT_TIMEOUT,
18832
18847
  logLevel,
@@ -25240,12 +25255,25 @@ var extractAudio = async (options2) => {
25240
25255
  binariesDirectory: options2.binariesDirectory ?? null,
25241
25256
  extraThreads: 0
25242
25257
  });
25243
- await compositor.executeCommand("ExtractAudio", {
25244
- input_path: options2.videoSource,
25245
- output_path: options2.audioOutput
25246
- });
25247
- await compositor.finishCommands();
25248
- await compositor.waitForDone();
25258
+ let executeError;
25259
+ try {
25260
+ await compositor.executeCommand("ExtractAudio", {
25261
+ input_path: options2.videoSource,
25262
+ output_path: options2.audioOutput
25263
+ });
25264
+ } catch (error) {
25265
+ executeError = error;
25266
+ }
25267
+ try {
25268
+ await compositor.shutDownOrKill();
25269
+ } catch (shutdownError) {
25270
+ if (!executeError) {
25271
+ throw shutdownError;
25272
+ }
25273
+ }
25274
+ if (executeError) {
25275
+ throw executeError;
25276
+ }
25249
25277
  };
25250
25278
  // src/get-silent-parts.ts
25251
25279
  var getSilentParts = async ({
@@ -15,11 +15,26 @@ const extractAudio = async (options) => {
15
15
  binariesDirectory: (_b = options.binariesDirectory) !== null && _b !== void 0 ? _b : null,
16
16
  extraThreads: 0,
17
17
  });
18
- await compositor.executeCommand('ExtractAudio', {
19
- input_path: options.videoSource,
20
- output_path: options.audioOutput,
21
- });
22
- await compositor.finishCommands();
23
- await compositor.waitForDone();
18
+ let executeError;
19
+ try {
20
+ await compositor.executeCommand('ExtractAudio', {
21
+ input_path: options.videoSource,
22
+ output_path: options.audioOutput,
23
+ });
24
+ }
25
+ catch (error) {
26
+ executeError = error;
27
+ }
28
+ try {
29
+ await compositor.shutDownOrKill();
30
+ }
31
+ catch (shutdownError) {
32
+ if (!executeError) {
33
+ throw shutdownError;
34
+ }
35
+ }
36
+ if (executeError) {
37
+ throw executeError;
38
+ }
24
39
  };
25
40
  exports.extractAudio = extractAudio;
@@ -21,7 +21,7 @@ type InternalGetCompositionsOptions = {
21
21
  serveUrlOrWebpackUrl: string;
22
22
  onLog: OnLog;
23
23
  } & ToOptions<typeof optionsMap.getCompositions>;
24
- export type GetCompositionsOptions = RequiredInputPropsInV5 & {
24
+ export type LegacyGetCompositionsOptions = RequiredInputPropsInV5 & {
25
25
  envVariables?: Record<string, string>;
26
26
  puppeteerInstance?: HeadlessBrowser;
27
27
  onBrowserLog?: (log: BrowserLog) => void;
@@ -29,6 +29,10 @@ export type GetCompositionsOptions = RequiredInputPropsInV5 & {
29
29
  chromiumOptions?: ChromiumOptions;
30
30
  port?: number | null;
31
31
  } & Partial<ToOptions<typeof optionsMap.getCompositions>>;
32
+ export type GetCompositionsOptions = LegacyGetCompositionsOptions & {
33
+ serveUrl: string;
34
+ };
35
+ type GetCompositionsArguments = [options: GetCompositionsOptions] | [serveUrlOrWebpackUrl: string, config?: LegacyGetCompositionsOptions];
32
36
  export declare const internalGetCompositions: (args_0: InternalGetCompositionsOptions) => Promise<VideoConfig[]>;
33
- export declare const getCompositions: (serveUrlOrWebpackUrl: string, config?: GetCompositionsOptions | undefined) => Promise<VideoConfig[]>;
37
+ export declare const getCompositions: (...args: GetCompositionsArguments) => Promise<VideoConfig[]>;
34
38
  export {};
@@ -16,6 +16,20 @@ const seek_to_frame_1 = require("./seek-to-frame");
16
16
  const set_props_and_env_1 = require("./set-props-and-env");
17
17
  const validate_puppeteer_timeout_1 = require("./validate-puppeteer-timeout");
18
18
  const wrap_with_error_handling_1 = require("./wrap-with-error-handling");
19
+ const convertGetCompositionsArgumentsToOptions = (args) => {
20
+ var _a;
21
+ if (args.length === 0) {
22
+ throw new Error('No serve URL or webpack bundle directory was passed to getCompositions().');
23
+ }
24
+ const firstArg = args[0];
25
+ if (typeof firstArg === 'string') {
26
+ return {
27
+ ...((_a = args[1]) !== null && _a !== void 0 ? _a : {}),
28
+ serveUrl: firstArg,
29
+ };
30
+ }
31
+ return firstArg;
32
+ };
19
33
  const innerGetCompositions = async ({ envVariables, serializedInputPropsWithCustomSchema, page, proxyPort, serveUrl, timeoutInMilliseconds, indent, logLevel, mediaCacheSizeInBytes, darkMode, }) => {
20
34
  (0, validate_puppeteer_timeout_1.validatePuppeteerTimeout)(timeoutInMilliseconds);
21
35
  await (0, set_props_and_env_1.setPropsAndEnv)({
@@ -163,11 +177,12 @@ exports.internalGetCompositions = (0, wrap_with_error_handling_1.wrapWithErrorHa
163
177
  * @description Gets a list of compositions defined in a Remotion project based on a Remotion Bundle by evaluating the Remotion Root.
164
178
  * @see [Documentation](https://www.remotion.dev/docs/renderer/get-compositions)
165
179
  */
166
- const getCompositions = (serveUrlOrWebpackUrl, config) => {
167
- if (!serveUrlOrWebpackUrl) {
180
+ const getCompositions = (...args) => {
181
+ const options = convertGetCompositionsArgumentsToOptions(args);
182
+ if (typeof (options === null || options === void 0 ? void 0 : options.serveUrl) !== 'string' || !options.serveUrl) {
168
183
  throw new Error('No serve URL or webpack bundle directory was passed to getCompositions().');
169
184
  }
170
- const { browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, logLevel: passedLogLevel, onBrowserDownload, binariesDirectory, offthreadVideoCacheSizeInBytes, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, } = config !== null && config !== void 0 ? config : {};
185
+ const { browserExecutable, chromiumOptions, envVariables, inputProps, onBrowserLog, port, puppeteerInstance, timeoutInMilliseconds, logLevel: passedLogLevel, onBrowserDownload, binariesDirectory, offthreadVideoCacheSizeInBytes, chromeMode, offthreadVideoThreads, mediaCacheSizeInBytes, serveUrl, } = options;
171
186
  const indent = false;
172
187
  const logLevel = passedLogLevel !== null && passedLogLevel !== void 0 ? passedLogLevel : 'info';
173
188
  return (0, exports.internalGetCompositions)({
@@ -183,7 +198,7 @@ const getCompositions = (serveUrlOrWebpackUrl, config) => {
183
198
  onBrowserLog: onBrowserLog !== null && onBrowserLog !== void 0 ? onBrowserLog : null,
184
199
  port: port !== null && port !== void 0 ? port : null,
185
200
  puppeteerInstance: puppeteerInstance !== null && puppeteerInstance !== void 0 ? puppeteerInstance : undefined,
186
- serveUrlOrWebpackUrl,
201
+ serveUrlOrWebpackUrl: serveUrl,
187
202
  server: undefined,
188
203
  timeoutInMilliseconds: timeoutInMilliseconds !== null && timeoutInMilliseconds !== void 0 ? timeoutInMilliseconds : TimeoutSettings_1.DEFAULT_TIMEOUT,
189
204
  logLevel,
package/dist/index.d.ts CHANGED
@@ -19,7 +19,7 @@ export { extractAudio } from './extract-audio';
19
19
  export type { FfmpegOverrideFn } from './ffmpeg-override';
20
20
  export { FileExtension } from './file-extensions';
21
21
  export { FrameRange } from './frame-range';
22
- export { GetCompositionsOptions, getCompositions } from './get-compositions';
22
+ export { GetCompositionsOptions, getCompositions, LegacyGetCompositionsOptions, } from './get-compositions';
23
23
  export { SilentPart, getSilentParts } from './get-silent-parts';
24
24
  export { VideoMetadata, getVideoMetadata } from './get-video-metadata';
25
25
  export { ImageFormat, StillImageFormat, VideoImageFormat, validateSelectedPixelFormatAndImageFormatCombination, } from './image-format';
@@ -9,12 +9,10 @@ exports.publicPathOption = {
9
9
  cliFlag,
10
10
  description: () => {
11
11
  return (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: ["The path of the URL where the bundle is going to be hosted. By default it is ",
12
- jsx_runtime_1.jsx("code", { children: "/" }),
13
- ", meaning that the bundle is going to be hosted at the root of the domain (e.g. ",
14
- jsx_runtime_1.jsx("code", { children: "https://localhost:3000/" }),
15
- "). If you are deploying to a subdirectory (e.g. ",
12
+ jsx_runtime_1.jsx("code", { children: "./" }),
13
+ ", making the bundle relocatable. Set an absolute path such as ",
16
14
  jsx_runtime_1.jsx("code", { children: "/sites/my-site/" }),
17
- "), you should set this to the subdirectory."] }));
15
+ " to host the bundle at a fixed location."] }));
18
16
  },
19
17
  ssrName: 'publicPath',
20
18
  docLink: 'https://www.remotion.dev/docs/renderer',
@@ -166,6 +166,11 @@ const innerSetPropsAndEnv = async ({ serializedInputPropsWithCustomSchema, envVa
166
166
  page,
167
167
  timeoutInMilliseconds: actualTimeout,
168
168
  });
169
+ // Increment this value when the generated bundle format or behavior changes
170
+ // in a backwards-incompatible way. It is not the Remotion package version and
171
+ // should not be bumped for every generated HTML change. Keep it synchronized
172
+ // with window.siteVersion in packages/studio-shared/src/studio-html.ts by
173
+ // incrementing both values.
169
174
  const requiredVersion = '11';
170
175
  if (siteVersion !== requiredVersion) {
171
176
  throw new Error([
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.496",
6
+ "version": "4.0.497",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "execa": "5.1.1",
25
- "remotion": "4.0.496",
26
- "@remotion/streaming": "4.0.496",
25
+ "remotion": "4.0.497",
26
+ "@remotion/streaming": "4.0.497",
27
27
  "source-map": "0.8.0-beta.0",
28
28
  "ws": "8.21.0",
29
- "@remotion/licensing": "4.0.496"
29
+ "@remotion/licensing": "4.0.497"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=16.8.0",
@@ -40,19 +40,19 @@
40
40
  "react-dom": "19.2.3",
41
41
  "@typescript/native-preview": "7.0.0-dev.20260217.1",
42
42
  "@types/ws": "8.5.10",
43
- "@remotion/example-videos": "4.0.496",
44
- "@remotion/eslint-config-internal": "4.0.496",
43
+ "@remotion/example-videos": "4.0.497",
44
+ "@remotion/eslint-config-internal": "4.0.497",
45
45
  "eslint": "9.19.0",
46
46
  "@types/node": "20.12.14"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@remotion/compositor-darwin-arm64": "4.0.496",
50
- "@remotion/compositor-darwin-x64": "4.0.496",
51
- "@remotion/compositor-linux-arm64-gnu": "4.0.496",
52
- "@remotion/compositor-linux-arm64-musl": "4.0.496",
53
- "@remotion/compositor-linux-x64-gnu": "4.0.496",
54
- "@remotion/compositor-linux-x64-musl": "4.0.496",
55
- "@remotion/compositor-win32-x64-msvc": "4.0.496"
49
+ "@remotion/compositor-darwin-arm64": "4.0.497",
50
+ "@remotion/compositor-darwin-x64": "4.0.497",
51
+ "@remotion/compositor-linux-arm64-gnu": "4.0.497",
52
+ "@remotion/compositor-linux-arm64-musl": "4.0.497",
53
+ "@remotion/compositor-linux-x64-gnu": "4.0.497",
54
+ "@remotion/compositor-linux-x64-musl": "4.0.497",
55
+ "@remotion/compositor-win32-x64-msvc": "4.0.497"
56
56
  },
57
57
  "keywords": [
58
58
  "remotion",