@remotion/serverless-client 4.0.468 → 4.0.470

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.
Files changed (2) hide show
  1. package/dist/esm/index.mjs +18 -5
  2. package/package.json +5 -5
@@ -51,8 +51,8 @@ function checkValidInputRange(arr) {
51
51
  }
52
52
  }
53
53
  function checkInfiniteRange(name, arr) {
54
- if (arr.length < 2) {
55
- throw new Error(name + " must have at least 2 elements");
54
+ if (arr.length < 1) {
55
+ throw new Error(name + " must have at least 1 element");
56
56
  }
57
57
  for (const element of arr) {
58
58
  if (typeof element !== "number") {
@@ -80,6 +80,14 @@ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
80
80
  }
81
81
  }
82
82
  }
83
+ function assertValidInterpolatePosterizeOption(posterize) {
84
+ if (posterize === undefined) {
85
+ return;
86
+ }
87
+ if (typeof posterize !== "number" || !Number.isFinite(posterize) || posterize <= 0) {
88
+ throw new Error(`posterize must be a positive finite number, but got ${posterize}`);
89
+ }
90
+ }
83
91
  function interpolate(input, inputRange, outputRange, options) {
84
92
  if (typeof input === "undefined") {
85
93
  throw new Error("input can not be undefined");
@@ -97,6 +105,7 @@ function interpolate(input, inputRange, outputRange, options) {
97
105
  checkInfiniteRange("outputRange", outputRange);
98
106
  checkValidInputRange(inputRange);
99
107
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
108
+ assertValidInterpolatePosterizeOption(options?.posterize);
100
109
  const easingOption = options?.easing;
101
110
  const defaultEasing = (num) => num;
102
111
  const resolveEasingForSegment = (segmentIndex) => {
@@ -119,8 +128,12 @@ function interpolate(input, inputRange, outputRange, options) {
119
128
  if (typeof input !== "number") {
120
129
  throw new TypeError("Cannot interpolate an input which is not a number");
121
130
  }
122
- const range = findRange(input, inputRange);
123
- return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
131
+ if (inputRange.length === 1) {
132
+ return outputRange[0];
133
+ }
134
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
135
+ const range = findRange(posterizedInput, inputRange);
136
+ return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
124
137
  easing: resolveEasingForSegment(range),
125
138
  extrapolateLeft,
126
139
  extrapolateRight
@@ -1136,7 +1149,7 @@ var validateFramesPerFunction = ({
1136
1149
  import * as tty from "tty";
1137
1150
 
1138
1151
  // ../core/dist/esm/version.mjs
1139
- var VERSION = "4.0.468";
1152
+ var VERSION = "4.0.470";
1140
1153
 
1141
1154
  // ../renderer/dist/esm/error-handling.mjs
1142
1155
  var isColorSupported = () => {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/serverless-client"
4
4
  },
5
5
  "name": "@remotion/serverless-client",
6
- "version": "4.0.468",
6
+ "version": "4.0.470",
7
7
  "main": "dist",
8
8
  "scripts": {
9
9
  "lint": "eslint src",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "dependencies": {},
25
25
  "devDependencies": {
26
- "remotion": "4.0.468",
27
- "@remotion/streaming": "4.0.468",
28
- "@remotion/renderer": "4.0.468",
29
- "@remotion/eslint-config-internal": "4.0.468",
26
+ "remotion": "4.0.470",
27
+ "@remotion/streaming": "4.0.470",
28
+ "@remotion/renderer": "4.0.470",
29
+ "@remotion/eslint-config-internal": "4.0.470",
30
30
  "eslint": "9.19.0",
31
31
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
32
32
  },