@remotion/renderer 4.0.501 → 4.0.502

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.
@@ -1914,6 +1914,45 @@ var forceNewStudioOption = {
1914
1914
  };
1915
1915
 
1916
1916
  // src/frame-range.ts
1917
+ var isMultipleFrameRanges = (frameRange) => {
1918
+ return Array.isArray(frameRange) && Array.isArray(frameRange[0]);
1919
+ };
1920
+ var validateFrameRangeTuple = (frameRange) => {
1921
+ if (frameRange.length !== 2) {
1922
+ throw new TypeError("Frame range must be a tuple, got an array with length " + frameRange.length);
1923
+ }
1924
+ const [first, second] = frameRange;
1925
+ if (typeof first !== "number") {
1926
+ throw new Error(`The first value of frame range must be a number, but got ${typeof first} (${JSON.stringify(first)})`);
1927
+ }
1928
+ if (!Number.isFinite(first)) {
1929
+ throw new TypeError("The first value of frame range must be finite, but got " + first);
1930
+ }
1931
+ if (!Number.isInteger(first)) {
1932
+ throw new Error(`The first value of frame range must be an integer, but got a float (${first})`);
1933
+ }
1934
+ if (first < 0) {
1935
+ throw new Error(`The first value of frame range must be non-negative, but got ${first}`);
1936
+ }
1937
+ if (second === null) {
1938
+ return;
1939
+ }
1940
+ if (typeof second !== "number") {
1941
+ throw new Error(`The second value of frame range must be a number or null, but got ${typeof second} (${JSON.stringify(second)})`);
1942
+ }
1943
+ if (!Number.isFinite(second)) {
1944
+ throw new TypeError("The second value of frame range must be finite, but got " + second);
1945
+ }
1946
+ if (!Number.isInteger(second)) {
1947
+ throw new Error(`The second value of frame range must be an integer, but got a float (${second})`);
1948
+ }
1949
+ if (second < 0) {
1950
+ throw new Error(`The second value of frame range must be non-negative, but got ${second}`);
1951
+ }
1952
+ if (second < first) {
1953
+ throw new Error("The second value of frame range must be not smaller than the first one, but got " + frameRange.join("-"));
1954
+ }
1955
+ };
1917
1956
  var validateFrameRange = (frameRange) => {
1918
1957
  if (frameRange === null) {
1919
1958
  return;
@@ -1930,50 +1969,69 @@ var validateFrameRange = (frameRange) => {
1930
1969
  }
1931
1970
  return;
1932
1971
  }
1933
- if (Array.isArray(frameRange)) {
1934
- if (frameRange.length !== 2) {
1935
- throw new TypeError("Frame range must be a tuple, got an array with length " + frameRange.length);
1936
- }
1937
- const [first, second] = frameRange;
1938
- if (typeof first !== "number") {
1939
- throw new Error(`The first value of frame range must be a number, but got ${typeof first} (${JSON.stringify(first)})`);
1940
- }
1941
- if (!Number.isFinite(first)) {
1942
- throw new TypeError("The first value of frame range must be finite, but got " + first);
1943
- }
1944
- if (!Number.isInteger(first)) {
1945
- throw new Error(`The first value of frame range must be an integer, but got a float (${first})`);
1946
- }
1947
- if (first < 0) {
1948
- throw new Error(`The first value of frame range must be non-negative, but got ${first}`);
1949
- }
1950
- if (second === null) {
1951
- return;
1972
+ if (isMultipleFrameRanges(frameRange)) {
1973
+ if (frameRange.length === 0) {
1974
+ throw new TypeError("Multiple frame ranges must not be empty.");
1975
+ }
1976
+ for (let index = 0;index < frameRange.length; index++) {
1977
+ const range = frameRange[index];
1978
+ validateFrameRangeTuple(range);
1979
+ if (range[1] === null && index !== frameRange.length - 1) {
1980
+ throw new Error("An open-ended frame range must be the last range.");
1981
+ }
1982
+ const previous = frameRange[index - 1];
1983
+ if (previous && previous[1] !== null && range[0] <= previous[1]) {
1984
+ throw new Error(`Frame ranges must be ordered and non-overlapping, but got ${previous.join("-")} followed by ${range.join("-")}.`);
1985
+ }
1952
1986
  }
1953
- if (typeof second !== "number") {
1954
- throw new Error(`The second value of frame range must be a number or null, but got ${typeof second} (${JSON.stringify(second)})`);
1987
+ return;
1988
+ }
1989
+ if (Array.isArray(frameRange)) {
1990
+ validateFrameRangeTuple(frameRange);
1991
+ return;
1992
+ }
1993
+ throw new TypeError("Frame range must be a number or a tuple of numbers, but got object of type " + typeof frameRange);
1994
+ };
1995
+
1996
+ // src/validate-selected-frames.ts
1997
+ var validateSelectedFrames = ({
1998
+ frames,
1999
+ durationInFrames
2000
+ }) => {
2001
+ if (!Array.isArray(frames)) {
2002
+ throw new TypeError("The `frames` option must be an array of frame numbers.");
2003
+ }
2004
+ if (frames.length === 0) {
2005
+ throw new TypeError("The `frames` option must contain at least one frame.");
2006
+ }
2007
+ for (const frame of frames) {
2008
+ if (typeof frame !== "number") {
2009
+ throw new TypeError(`The \`frames\` option must contain only numbers, but got ${typeof frame}.`);
1955
2010
  }
1956
- if (!Number.isFinite(second)) {
1957
- throw new TypeError("The second value of frame range must be finite, but got " + second);
2011
+ if (!Number.isFinite(frame)) {
2012
+ throw new TypeError(`The \`frames\` option must contain only finite numbers, but got ${frame}.`);
1958
2013
  }
1959
- if (!Number.isInteger(second)) {
1960
- throw new Error(`The second value of frame range must be an integer, but got a float (${second})`);
2014
+ if (!Number.isInteger(frame)) {
2015
+ throw new TypeError(`The \`frames\` option must contain only integers, but got ${frame}.`);
1961
2016
  }
1962
- if (second < 0) {
1963
- throw new Error(`The second value of frame range must be non-negative, but got ${second}`);
2017
+ if (frame < 0) {
2018
+ throw new TypeError(`The \`frames\` option must contain only non-negative numbers, but got ${frame}.`);
1964
2019
  }
1965
- if (second < first) {
1966
- throw new Error("The second value of frame range must be not smaller than the first one, but got " + frameRange.join("-"));
2020
+ if (durationInFrames !== null && frame >= durationInFrames) {
2021
+ throw new RangeError(`Frame ${frame} is out of range, must be between 0 and ${durationInFrames - 1}.`);
1967
2022
  }
1968
- return;
1969
2023
  }
1970
- throw new TypeError("Frame range must be a number or a tuple of numbers, but got object of type " + typeof frameRange);
2024
+ const uniqueFrames = new Set(frames);
2025
+ if (uniqueFrames.size !== frames.length) {
2026
+ throw new TypeError("The `frames` option must not contain duplicate frames.");
2027
+ }
2028
+ return [...frames].sort((a, b) => a - b);
1971
2029
  };
1972
2030
 
1973
2031
  // src/options/frames.tsx
1974
2032
  import { jsx as jsx30, jsxs as jsxs21, Fragment as Fragment30 } from "react/jsx-runtime";
1975
2033
  var cliFlag33 = "frames";
1976
- var frameRange = null;
2034
+ var frameSelection = null;
1977
2035
  var parseFrameRangeFromCli = (newFrameRange) => {
1978
2036
  if (typeof newFrameRange === "number") {
1979
2037
  if (newFrameRange < 0) {
@@ -1985,6 +2043,35 @@ var parseFrameRangeFromCli = (newFrameRange) => {
1985
2043
  if (newFrameRange.trim() === "") {
1986
2044
  throw new Error("--frames flag must be a single number, or 2 numbers separated by `-`");
1987
2045
  }
2046
+ if (newFrameRange.includes(",")) {
2047
+ const selectors = newFrameRange.split(",").map((selector) => selector.trim());
2048
+ if (selectors.some((selector) => selector === "")) {
2049
+ throw new TypeError("--frames must contain a frame or frame range between commas.");
2050
+ }
2051
+ const onlyFrames = selectors.every((selector) => !selector.includes("-"));
2052
+ if (onlyFrames) {
2053
+ const frames = validateSelectedFrames({
2054
+ frames: selectors.map((frame) => Number(frame)),
2055
+ durationInFrames: null
2056
+ });
2057
+ return { type: "frames", frames };
2058
+ }
2059
+ const ranges = selectors.map((selector) => {
2060
+ if (!selector.includes("-")) {
2061
+ const frame = Number(selector);
2062
+ return [frame, frame];
2063
+ }
2064
+ const rangeParts = selector.split("-");
2065
+ if (rangeParts.length !== 2 || rangeParts[0] === "") {
2066
+ throw new Error(`Invalid frame selector "${selector}". Use a frame number, a range such as 0-9, or an open-ended range such as 100-.`);
2067
+ }
2068
+ const start = Number(rangeParts[0]);
2069
+ const end = rangeParts[1] === "" ? null : Number(rangeParts[1]);
2070
+ return [start, end];
2071
+ });
2072
+ validateFrameRange(ranges);
2073
+ return ranges;
2074
+ }
1988
2075
  const parts = newFrameRange.split("-");
1989
2076
  if (parts.length > 2 || parts.length <= 0) {
1990
2077
  throw new Error(`--frames flag must be a number or 2 numbers separated by '-', instead got ${parts.length} numbers`);
@@ -1992,7 +2079,7 @@ var parseFrameRangeFromCli = (newFrameRange) => {
1992
2079
  if (parts.length === 1) {
1993
2080
  const value = Number(parts[0]);
1994
2081
  if (isNaN(value)) {
1995
- throw new Error("--frames flag must be a single number, or 2 numbers separated by `-`");
2082
+ throw new Error("--frames flag must be a frame number, range, or comma-separated selection");
1996
2083
  }
1997
2084
  return value;
1998
2085
  }
@@ -2000,7 +2087,7 @@ var parseFrameRangeFromCli = (newFrameRange) => {
2000
2087
  if (secondPart === "" && firstPart !== "") {
2001
2088
  const start = Number(firstPart);
2002
2089
  if (isNaN(start)) {
2003
- throw new Error("--frames flag must be a single number, or 2 numbers separated by `-`");
2090
+ throw new Error("--frames flag must be a frame number, range, or comma-separated selection");
2004
2091
  }
2005
2092
  return [start, null];
2006
2093
  }
@@ -2008,7 +2095,7 @@ var parseFrameRangeFromCli = (newFrameRange) => {
2008
2095
  const [first, second] = parsed;
2009
2096
  for (const value of parsed) {
2010
2097
  if (isNaN(value)) {
2011
- throw new Error("--frames flag must be a single number, or 2 numbers separated by `-`");
2098
+ throw new Error("--frames flag must be a frame number, range, or comma-separated selection");
2012
2099
  }
2013
2100
  }
2014
2101
  if (second < first) {
@@ -2041,7 +2128,14 @@ var framesOption = {
2041
2128
  getValue: ({ commandLine }) => {
2042
2129
  if (commandLine[cliFlag33] !== undefined) {
2043
2130
  const value = parseFrameRangeFromCli(commandLine[cliFlag33]);
2044
- validateFrameRange(value);
2131
+ if (typeof value === "object" && !Array.isArray(value)) {
2132
+ validateSelectedFrames({
2133
+ frames: value.frames,
2134
+ durationInFrames: null
2135
+ });
2136
+ } else {
2137
+ validateFrameRange(value);
2138
+ }
2045
2139
  return {
2046
2140
  source: "cli",
2047
2141
  value
@@ -2049,14 +2143,16 @@ var framesOption = {
2049
2143
  }
2050
2144
  return {
2051
2145
  source: "config",
2052
- value: frameRange
2146
+ value: frameSelection
2053
2147
  };
2054
2148
  },
2055
2149
  setConfig: (value) => {
2056
- if (value !== null) {
2150
+ if (value !== null && typeof value === "object" && !Array.isArray(value)) {
2151
+ validateSelectedFrames({ frames: value.frames, durationInFrames: null });
2152
+ } else if (value !== null) {
2057
2153
  validateFrameRange(value);
2058
2154
  }
2059
- frameRange = value;
2155
+ frameSelection = value;
2060
2156
  },
2061
2157
  id: cliFlag33
2062
2158
  };
@@ -4114,9 +4210,9 @@ var reproOption = {
4114
4210
  // src/options/rspack.tsx
4115
4211
  import { jsx as jsx70, Fragment as Fragment70 } from "react/jsx-runtime";
4116
4212
  var rspackEnabled = false;
4117
- var cliFlag74 = "experimental-rspack";
4213
+ var cliFlag74 = "rspack";
4118
4214
  var rspackOption = {
4119
- name: "Experimental Rspack",
4215
+ name: "Rspack",
4120
4216
  cliFlag: cliFlag74,
4121
4217
  description: () => /* @__PURE__ */ jsx70(Fragment70, {
4122
4218
  children: "Uses Rspack instead of Webpack as the bundler for the Studio or bundle."
@@ -4125,8 +4221,7 @@ var rspackOption = {
4125
4221
  docLink: null,
4126
4222
  type: false,
4127
4223
  getValue: ({ commandLine }) => {
4128
- if (commandLine[cliFlag74] !== undefined) {
4129
- rspackEnabled = true;
4224
+ if (commandLine[cliFlag74] !== undefined && commandLine[cliFlag74] !== null) {
4130
4225
  return {
4131
4226
  value: commandLine[cliFlag74],
4132
4227
  source: "cli"