@remotion/vercel 4.0.460 → 4.0.462

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 +254 -6
  2. package/package.json +4 -5
@@ -115,6 +115,23 @@ function checkInfiniteRange(name, arr) {
115
115
  }
116
116
  }
117
117
  }
118
+ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
119
+ if (easing === undefined) {
120
+ return;
121
+ }
122
+ if (typeof easing === "function") {
123
+ return;
124
+ }
125
+ const expectedLength = inputRangeLength - 1;
126
+ if (easing.length !== expectedLength) {
127
+ throw new Error(\`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = \${expectedLength}), but got length \${easing.length}\`);
128
+ }
129
+ for (let i = 0;i < easing.length; i++) {
130
+ if (typeof easing[i] !== "function") {
131
+ throw new Error(\`easing[\${i}] must be a function\`);
132
+ }
133
+ }
134
+ }
118
135
  function interpolate(input, inputRange, outputRange, options) {
119
136
  if (typeof input === "undefined") {
120
137
  throw new Error("input can not be undefined");
@@ -131,7 +148,18 @@ function interpolate(input, inputRange, outputRange, options) {
131
148
  checkInfiniteRange("inputRange", inputRange);
132
149
  checkInfiniteRange("outputRange", outputRange);
133
150
  checkValidInputRange(inputRange);
134
- const easing = options?.easing ?? ((num) => num);
151
+ assertValidInterpolateEasingOption(options?.easing, inputRange.length);
152
+ const easingOption = options?.easing;
153
+ const defaultEasing = (num) => num;
154
+ const resolveEasingForSegment = (segmentIndex) => {
155
+ if (easingOption === undefined) {
156
+ return defaultEasing;
157
+ }
158
+ if (typeof easingOption === "function") {
159
+ return easingOption;
160
+ }
161
+ return easingOption[segmentIndex];
162
+ };
135
163
  let extrapolateLeft = "extend";
136
164
  if (options?.extrapolateLeft !== undefined) {
137
165
  extrapolateLeft = options.extrapolateLeft;
@@ -145,7 +173,7 @@ function interpolate(input, inputRange, outputRange, options) {
145
173
  }
146
174
  const range = findRange(input, inputRange);
147
175
  return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
148
- easing,
176
+ easing: resolveEasingForSegment(range),
149
177
  extrapolateLeft,
150
178
  extrapolateRight
151
179
  });
@@ -164,6 +192,36 @@ var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
164
192
  var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
165
193
  var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
166
194
  var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
195
+ var findPropsToDelete = ({
196
+ schema,
197
+ key,
198
+ value
199
+ }) => {
200
+ const fieldSchema = schema[key];
201
+ if (!fieldSchema) {
202
+ throw new Error("Key " + JSON.stringify(key) + " not found in schema");
203
+ }
204
+ if (typeof value !== "string") {
205
+ throw new Error("Value must be a string, but is " + JSON.stringify(value));
206
+ }
207
+ if (fieldSchema.type !== "enum") {
208
+ throw new Error("Key " + JSON.stringify(key) + " is not an enum");
209
+ }
210
+ const currentVariant = fieldSchema.variants[value];
211
+ if (!currentVariant) {
212
+ throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
213
+ }
214
+ const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
215
+ const otherKeys = new Set;
216
+ for (const variant of otherVariants) {
217
+ const otherVariant = fieldSchema.variants[variant];
218
+ const keys = Object.keys(otherVariant);
219
+ for (const k of keys) {
220
+ otherKeys.add(k);
221
+ }
222
+ }
223
+ return [...otherKeys];
224
+ };
167
225
  var DATE_TOKEN = "remotion-date:";
168
226
  var FILE_TOKEN = "remotion-file:";
169
227
  var serializeJSONWithSpecialTypes = ({
@@ -669,6 +727,70 @@ var proResProfileOptions = [
669
727
  "light",
670
728
  "proxy"
671
729
  ];
730
+ var sequenceStyleSchema = {
731
+ "style.translate": {
732
+ type: "translate",
733
+ step: 1,
734
+ default: "0px 0px",
735
+ description: "Offset"
736
+ },
737
+ "style.scale": {
738
+ type: "number",
739
+ min: 0.05,
740
+ max: 100,
741
+ step: 0.01,
742
+ default: 1,
743
+ description: "Scale"
744
+ },
745
+ "style.rotate": {
746
+ type: "rotation",
747
+ step: 1,
748
+ default: "0deg",
749
+ description: "Rotation"
750
+ },
751
+ "style.opacity": {
752
+ type: "number",
753
+ min: 0,
754
+ max: 1,
755
+ step: 0.01,
756
+ default: 1,
757
+ description: "Opacity"
758
+ },
759
+ premountFor: {
760
+ type: "number",
761
+ default: 0,
762
+ description: "Premount For",
763
+ min: 0,
764
+ step: 1
765
+ },
766
+ postmountFor: {
767
+ type: "hidden"
768
+ },
769
+ styleWhilePremounted: {
770
+ type: "hidden"
771
+ },
772
+ styleWhilePostmounted: {
773
+ type: "hidden"
774
+ }
775
+ };
776
+ var sequenceSchema = {
777
+ layout: {
778
+ type: "enum",
779
+ default: "absolute-fill",
780
+ description: "Layout",
781
+ variants: {
782
+ "absolute-fill": sequenceStyleSchema,
783
+ none: {}
784
+ }
785
+ }
786
+ };
787
+ var sequenceSchemaDefaultLayoutNone = {
788
+ ...sequenceSchema,
789
+ layout: {
790
+ ...sequenceSchema.layout,
791
+ default: "none"
792
+ }
793
+ };
672
794
  var ENABLE_V5_BREAKING_CHANGES = false;
673
795
  var validateFrame = ({
674
796
  allowFloats,
@@ -831,7 +953,9 @@ var NoReactInternals = {
831
953
  DATE_TOKEN,
832
954
  FILE_TOKEN,
833
955
  validateCodec,
834
- proResProfileOptions
956
+ proResProfileOptions,
957
+ findPropsToDelete,
958
+ sequenceSchema
835
959
  };
836
960
 
837
961
  // src/scripts/render-still.ts
@@ -1008,6 +1132,23 @@ function checkInfiniteRange(name, arr) {
1008
1132
  }
1009
1133
  }
1010
1134
  }
1135
+ function assertValidInterpolateEasingOption(easing, inputRangeLength) {
1136
+ if (easing === undefined) {
1137
+ return;
1138
+ }
1139
+ if (typeof easing === "function") {
1140
+ return;
1141
+ }
1142
+ const expectedLength = inputRangeLength - 1;
1143
+ if (easing.length !== expectedLength) {
1144
+ throw new Error(\`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = \${expectedLength}), but got length \${easing.length}\`);
1145
+ }
1146
+ for (let i = 0;i < easing.length; i++) {
1147
+ if (typeof easing[i] !== "function") {
1148
+ throw new Error(\`easing[\${i}] must be a function\`);
1149
+ }
1150
+ }
1151
+ }
1011
1152
  function interpolate(input, inputRange, outputRange, options) {
1012
1153
  if (typeof input === "undefined") {
1013
1154
  throw new Error("input can not be undefined");
@@ -1024,7 +1165,18 @@ function interpolate(input, inputRange, outputRange, options) {
1024
1165
  checkInfiniteRange("inputRange", inputRange);
1025
1166
  checkInfiniteRange("outputRange", outputRange);
1026
1167
  checkValidInputRange(inputRange);
1027
- const easing = options?.easing ?? ((num) => num);
1168
+ assertValidInterpolateEasingOption(options?.easing, inputRange.length);
1169
+ const easingOption = options?.easing;
1170
+ const defaultEasing = (num) => num;
1171
+ const resolveEasingForSegment = (segmentIndex) => {
1172
+ if (easingOption === undefined) {
1173
+ return defaultEasing;
1174
+ }
1175
+ if (typeof easingOption === "function") {
1176
+ return easingOption;
1177
+ }
1178
+ return easingOption[segmentIndex];
1179
+ };
1028
1180
  let extrapolateLeft = "extend";
1029
1181
  if (options?.extrapolateLeft !== undefined) {
1030
1182
  extrapolateLeft = options.extrapolateLeft;
@@ -1038,7 +1190,7 @@ function interpolate(input, inputRange, outputRange, options) {
1038
1190
  }
1039
1191
  const range = findRange(input, inputRange);
1040
1192
  return interpolateFunction(input, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
1041
- easing,
1193
+ easing: resolveEasingForSegment(range),
1042
1194
  extrapolateLeft,
1043
1195
  extrapolateRight
1044
1196
  });
@@ -1057,6 +1209,36 @@ var DELAY_RENDER_CALLSTACK_TOKEN = "The delayRender was called:";
1057
1209
  var DELAY_RENDER_RETRIES_LEFT = "Retries left: ";
1058
1210
  var DELAY_RENDER_RETRY_TOKEN = "- Rendering the frame will be retried.";
1059
1211
  var DELAY_RENDER_CLEAR_TOKEN = "handle was cleared after";
1212
+ var findPropsToDelete = ({
1213
+ schema,
1214
+ key,
1215
+ value
1216
+ }) => {
1217
+ const fieldSchema = schema[key];
1218
+ if (!fieldSchema) {
1219
+ throw new Error("Key " + JSON.stringify(key) + " not found in schema");
1220
+ }
1221
+ if (typeof value !== "string") {
1222
+ throw new Error("Value must be a string, but is " + JSON.stringify(value));
1223
+ }
1224
+ if (fieldSchema.type !== "enum") {
1225
+ throw new Error("Key " + JSON.stringify(key) + " is not an enum");
1226
+ }
1227
+ const currentVariant = fieldSchema.variants[value];
1228
+ if (!currentVariant) {
1229
+ throw new Error("Value for " + JSON.stringify(key) + " must be one of " + Object.keys(fieldSchema.variants).map((v) => JSON.stringify(v)).join(", ") + ", got " + JSON.stringify(value));
1230
+ }
1231
+ const otherVariants = Object.keys(fieldSchema.variants).filter((v) => v !== value);
1232
+ const otherKeys = new Set;
1233
+ for (const variant of otherVariants) {
1234
+ const otherVariant = fieldSchema.variants[variant];
1235
+ const keys = Object.keys(otherVariant);
1236
+ for (const k of keys) {
1237
+ otherKeys.add(k);
1238
+ }
1239
+ }
1240
+ return [...otherKeys];
1241
+ };
1060
1242
  var DATE_TOKEN = "remotion-date:";
1061
1243
  var FILE_TOKEN = "remotion-file:";
1062
1244
  var serializeJSONWithSpecialTypes = ({
@@ -1562,6 +1744,70 @@ var proResProfileOptions = [
1562
1744
  "light",
1563
1745
  "proxy"
1564
1746
  ];
1747
+ var sequenceStyleSchema = {
1748
+ "style.translate": {
1749
+ type: "translate",
1750
+ step: 1,
1751
+ default: "0px 0px",
1752
+ description: "Offset"
1753
+ },
1754
+ "style.scale": {
1755
+ type: "number",
1756
+ min: 0.05,
1757
+ max: 100,
1758
+ step: 0.01,
1759
+ default: 1,
1760
+ description: "Scale"
1761
+ },
1762
+ "style.rotate": {
1763
+ type: "rotation",
1764
+ step: 1,
1765
+ default: "0deg",
1766
+ description: "Rotation"
1767
+ },
1768
+ "style.opacity": {
1769
+ type: "number",
1770
+ min: 0,
1771
+ max: 1,
1772
+ step: 0.01,
1773
+ default: 1,
1774
+ description: "Opacity"
1775
+ },
1776
+ premountFor: {
1777
+ type: "number",
1778
+ default: 0,
1779
+ description: "Premount For",
1780
+ min: 0,
1781
+ step: 1
1782
+ },
1783
+ postmountFor: {
1784
+ type: "hidden"
1785
+ },
1786
+ styleWhilePremounted: {
1787
+ type: "hidden"
1788
+ },
1789
+ styleWhilePostmounted: {
1790
+ type: "hidden"
1791
+ }
1792
+ };
1793
+ var sequenceSchema = {
1794
+ layout: {
1795
+ type: "enum",
1796
+ default: "absolute-fill",
1797
+ description: "Layout",
1798
+ variants: {
1799
+ "absolute-fill": sequenceStyleSchema,
1800
+ none: {}
1801
+ }
1802
+ }
1803
+ };
1804
+ var sequenceSchemaDefaultLayoutNone = {
1805
+ ...sequenceSchema,
1806
+ layout: {
1807
+ ...sequenceSchema.layout,
1808
+ default: "none"
1809
+ }
1810
+ };
1565
1811
  var ENABLE_V5_BREAKING_CHANGES = false;
1566
1812
  var validateFrame = ({
1567
1813
  allowFloats,
@@ -1724,7 +1970,9 @@ var NoReactInternals = {
1724
1970
  DATE_TOKEN,
1725
1971
  FILE_TOKEN,
1726
1972
  validateCodec,
1727
- proResProfileOptions
1973
+ proResProfileOptions,
1974
+ findPropsToDelete,
1975
+ sequenceSchema
1728
1976
  };
1729
1977
 
1730
1978
  // src/scripts/render-video.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/vercel",
3
- "version": "4.0.460",
3
+ "version": "4.0.462",
4
4
  "description": "Render Remotion videos on Vercel Sandbox",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,6 @@
8
8
  "repository": {
9
9
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/vercel"
10
10
  },
11
- "sideEffects": false,
12
11
  "type": "module",
13
12
  "scripts": {
14
13
  "formatting": "oxfmt src --check",
@@ -24,8 +23,8 @@
24
23
  "url": "https://github.com/remotion-dev/remotion/issues"
25
24
  },
26
25
  "dependencies": {
27
- "@remotion/renderer": "4.0.460",
28
- "remotion": "4.0.460"
26
+ "@remotion/renderer": "4.0.462",
27
+ "remotion": "4.0.462"
29
28
  },
30
29
  "peerDependencies": {
31
30
  "@vercel/sandbox": ">=1.0.0"
@@ -39,7 +38,7 @@
39
38
  "./package.json": "./package.json"
40
39
  },
41
40
  "devDependencies": {
42
- "@remotion/eslint-config-internal": "4.0.460",
41
+ "@remotion/eslint-config-internal": "4.0.462",
43
42
  "@vercel/blob": "2.3.0",
44
43
  "@vercel/sandbox": "1.6.0",
45
44
  "eslint": "9.19.0",