remotion 4.0.515 → 4.0.516

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.
@@ -2,9 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAssetDisplayName = void 0;
4
4
  const getAssetDisplayName = (filename) => {
5
- if (/data:|blob:/.test(filename.substring(0, 5))) {
5
+ var _a;
6
+ if (filename.startsWith('data:')) {
6
7
  return 'Data URL';
7
8
  }
9
+ if (filename.startsWith('blob:')) {
10
+ const staticFile = typeof window === 'undefined'
11
+ ? undefined
12
+ : (_a = window.remotion_staticFiles) === null || _a === void 0 ? void 0 : _a.find((file) => file.src === filename);
13
+ return staticFile ? (0, exports.getAssetDisplayName)(staticFile.name) : 'Blob URL';
14
+ }
8
15
  const splitted = filename
9
16
  .split('/')
10
17
  .map((s) => s.split('\\'))
@@ -12,6 +12,7 @@ export declare const serializeJSONWithSpecialTypes: ({ data, indent, staticBase,
12
12
  indent: number | undefined;
13
13
  staticBase: string | null;
14
14
  }) => SerializedJSONWithCustomFields;
15
+ export declare const resolveFileTokenToUrl: (value: string) => string;
15
16
  export declare const deserializeJSONWithSpecialTypes: <T = Record<string, unknown>>(data: string) => T;
16
17
  export declare const serializeThenDeserialize: (props: Record<string, unknown>) => Record<string, unknown>;
17
18
  export declare const serializeThenDeserializeInStudio: (props: Record<string, unknown>) => Record<string, unknown>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // Must keep this file in sync with the one in packages/lambda/src/shared/serialize-props.ts!
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.serializeThenDeserializeInStudio = exports.serializeThenDeserialize = exports.deserializeJSONWithSpecialTypes = exports.serializeJSONWithSpecialTypes = exports.FILE_TOKEN = exports.DATE_TOKEN = void 0;
4
+ exports.serializeThenDeserializeInStudio = exports.serializeThenDeserialize = exports.deserializeJSONWithSpecialTypes = exports.resolveFileTokenToUrl = exports.serializeJSONWithSpecialTypes = exports.FILE_TOKEN = exports.DATE_TOKEN = void 0;
5
5
  const get_remotion_environment_js_1 = require("./get-remotion-environment.js");
6
6
  exports.DATE_TOKEN = 'remotion-date:';
7
7
  exports.FILE_TOKEN = 'remotion-file:';
@@ -27,6 +27,7 @@ const serializeJSONWithSpecialTypes = ({ data, indent, staticBase, }) => {
27
27
  }
28
28
  if (typeof item === 'string' &&
29
29
  staticBase !== null &&
30
+ staticBase !== '' &&
30
31
  item.startsWith(staticBase)) {
31
32
  customFileUsed = true;
32
33
  return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
@@ -41,13 +42,30 @@ const serializeJSONWithSpecialTypes = ({ data, indent, staticBase, }) => {
41
42
  }
42
43
  };
43
44
  exports.serializeJSONWithSpecialTypes = serializeJSONWithSpecialTypes;
45
+ const resolveFileTokenToUrl = (value) => {
46
+ var _a;
47
+ const encodedName = value.replace(exports.FILE_TOKEN, '');
48
+ let name = encodedName;
49
+ try {
50
+ name = encodedName.split('/').map(decodeURIComponent).join('/');
51
+ }
52
+ catch (_b) {
53
+ // Keep the encoded name if it contains an invalid escape sequence.
54
+ }
55
+ const matchingStaticFile = (_a = window.remotion_staticFiles) === null || _a === void 0 ? void 0 : _a.find((file) => file.name === name);
56
+ if (matchingStaticFile) {
57
+ return matchingStaticFile.src;
58
+ }
59
+ return `${window.remotion_staticBase}/${encodedName}`;
60
+ };
61
+ exports.resolveFileTokenToUrl = resolveFileTokenToUrl;
44
62
  const deserializeJSONWithSpecialTypes = (data) => {
45
63
  return JSON.parse(data, (_, value) => {
46
64
  if (typeof value === 'string' && value.startsWith(exports.DATE_TOKEN)) {
47
65
  return new Date(value.replace(exports.DATE_TOKEN, ''));
48
66
  }
49
67
  if (typeof value === 'string' && value.startsWith(exports.FILE_TOKEN)) {
50
- return `${window.remotion_staticBase}/${value.replace(exports.FILE_TOKEN, '')}`;
68
+ return (0, exports.resolveFileTokenToUrl)(value);
51
69
  }
52
70
  return value;
53
71
  });
@@ -136,7 +136,7 @@ const computeEffectiveSchemaValuesDotNotation = ({ schema, currentValue, overrid
136
136
  if ((field === null || field === void 0 ? void 0 : field.type) === 'asset' &&
137
137
  typeof value === 'string' &&
138
138
  value.startsWith(input_props_serialization_js_1.FILE_TOKEN)) {
139
- value = `${window.remotion_staticBase}/${value.slice(input_props_serialization_js_1.FILE_TOKEN.length)}`;
139
+ value = (0, input_props_serialization_js_1.resolveFileTokenToUrl)(value);
140
140
  }
141
141
  if (value === undefined) {
142
142
  propsToDelete.add(key);
@@ -3,4 +3,4 @@
3
3
  * @see [Documentation](https://remotion.dev/docs/version)
4
4
  * @returns {string} The current version of the remotion package
5
5
  */
6
- export declare const VERSION = "4.0.515";
6
+ export declare const VERSION = "4.0.516";
@@ -7,4 +7,4 @@ exports.VERSION = void 0;
7
7
  * @see [Documentation](https://remotion.dev/docs/version)
8
8
  * @returns {string} The current version of the remotion package
9
9
  */
10
- exports.VERSION = '4.0.515';
10
+ exports.VERSION = '4.0.516';
@@ -305,7 +305,7 @@ var serializeJSONWithSpecialTypes = ({
305
305
  setUsed = true;
306
306
  return value;
307
307
  }
308
- if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
308
+ if (typeof item === "string" && staticBase !== null && staticBase !== "" && item.startsWith(staticBase)) {
309
309
  customFileUsed = true;
310
310
  return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
311
311
  }
@@ -316,13 +316,25 @@ var serializeJSONWithSpecialTypes = ({
316
316
  throw new Error("Could not serialize the passed input props to JSON: " + err.message);
317
317
  }
318
318
  };
319
+ var resolveFileTokenToUrl = (value) => {
320
+ const encodedName = value.replace(FILE_TOKEN, "");
321
+ let name = encodedName;
322
+ try {
323
+ name = encodedName.split("/").map(decodeURIComponent).join("/");
324
+ } catch {}
325
+ const matchingStaticFile = window.remotion_staticFiles?.find((file) => file.name === name);
326
+ if (matchingStaticFile) {
327
+ return matchingStaticFile.src;
328
+ }
329
+ return `${window.remotion_staticBase}/${encodedName}`;
330
+ };
319
331
  var deserializeJSONWithSpecialTypes = (data) => {
320
332
  return JSON.parse(data, (_, value) => {
321
333
  if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
322
334
  return new Date(value.replace(DATE_TOKEN, ""));
323
335
  }
324
336
  if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
325
- return `${window.remotion_staticBase}/${value.replace(FILE_TOKEN, "")}`;
337
+ return resolveFileTokenToUrl(value);
326
338
  }
327
339
  return value;
328
340
  });
@@ -1352,7 +1364,7 @@ var getSingleChildComponent = (children) => {
1352
1364
  };
1353
1365
 
1354
1366
  // src/version.ts
1355
- var VERSION = "4.0.515";
1367
+ var VERSION = "4.0.516";
1356
1368
 
1357
1369
  // src/multiple-versions-warning.ts
1358
1370
  var checkMultipleRemotionVersions = () => {
@@ -4809,7 +4821,7 @@ var computeEffectiveSchemaValuesDotNotation = ({
4809
4821
  });
4810
4822
  }
4811
4823
  if (field?.type === "asset" && typeof value === "string" && value.startsWith(FILE_TOKEN)) {
4812
- value = `${window.remotion_staticBase}/${value.slice(FILE_TOKEN.length)}`;
4824
+ value = resolveFileTokenToUrl(value);
4813
4825
  }
4814
4826
  if (value === undefined) {
4815
4827
  propsToDelete.add(key);
@@ -8157,9 +8169,13 @@ var useFrameForVolumeProp = (behavior) => {
8157
8169
 
8158
8170
  // src/get-asset-file-name.ts
8159
8171
  var getAssetDisplayName = (filename) => {
8160
- if (/data:|blob:/.test(filename.substring(0, 5))) {
8172
+ if (filename.startsWith("data:")) {
8161
8173
  return "Data URL";
8162
8174
  }
8175
+ if (filename.startsWith("blob:")) {
8176
+ const staticFile = typeof window === "undefined" ? undefined : window.remotion_staticFiles?.find((file) => file.src === filename);
8177
+ return staticFile ? getAssetDisplayName(staticFile.name) : "Blob URL";
8178
+ }
8163
8179
  const splitted = filename.split("/").map((s) => s.split("\\")).flat(1);
8164
8180
  return splitted[splitted.length - 1];
8165
8181
  };
@@ -1348,7 +1348,7 @@ var serializeJSONWithSpecialTypes = ({
1348
1348
  setUsed = true;
1349
1349
  return value;
1350
1350
  }
1351
- if (typeof item === "string" && staticBase !== null && item.startsWith(staticBase)) {
1351
+ if (typeof item === "string" && staticBase !== null && staticBase !== "" && item.startsWith(staticBase)) {
1352
1352
  customFileUsed = true;
1353
1353
  return `${FILE_TOKEN}${item.replace(staticBase + "/", "")}`;
1354
1354
  }
@@ -1359,13 +1359,25 @@ var serializeJSONWithSpecialTypes = ({
1359
1359
  throw new Error("Could not serialize the passed input props to JSON: " + err.message);
1360
1360
  }
1361
1361
  };
1362
+ var resolveFileTokenToUrl = (value) => {
1363
+ const encodedName = value.replace(FILE_TOKEN, "");
1364
+ let name = encodedName;
1365
+ try {
1366
+ name = encodedName.split("/").map(decodeURIComponent).join("/");
1367
+ } catch {}
1368
+ const matchingStaticFile = window.remotion_staticFiles?.find((file) => file.name === name);
1369
+ if (matchingStaticFile) {
1370
+ return matchingStaticFile.src;
1371
+ }
1372
+ return `${window.remotion_staticBase}/${encodedName}`;
1373
+ };
1362
1374
  var deserializeJSONWithSpecialTypes = (data) => {
1363
1375
  return JSON.parse(data, (_, value) => {
1364
1376
  if (typeof value === "string" && value.startsWith(DATE_TOKEN)) {
1365
1377
  return new Date(value.replace(DATE_TOKEN, ""));
1366
1378
  }
1367
1379
  if (typeof value === "string" && value.startsWith(FILE_TOKEN)) {
1368
- return `${window.remotion_staticBase}/${value.replace(FILE_TOKEN, "")}`;
1380
+ return resolveFileTokenToUrl(value);
1369
1381
  }
1370
1382
  return value;
1371
1383
  });
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var VERSION = "4.0.515";
2
+ var VERSION = "4.0.516";
3
3
  export {
4
4
  VERSION
5
5
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/core"
4
4
  },
5
5
  "name": "remotion",
6
- "version": "4.0.515",
6
+ "version": "4.0.516",
7
7
  "description": "Make videos programmatically",
8
8
  "main": "dist/cjs/index.js",
9
9
  "types": "dist/cjs/index.d.ts",
@@ -35,7 +35,7 @@
35
35
  "react-dom": "19.2.3",
36
36
  "webpack": "5.105.0",
37
37
  "zod": "4.4.3",
38
- "@remotion/eslint-config-internal": "4.0.515",
38
+ "@remotion/eslint-config-internal": "4.0.516",
39
39
  "eslint": "9.19.0",
40
40
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
41
41
  },