remotion 4.0.448 → 4.0.449
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.
- package/dist/cjs/Img.d.ts +1 -0
- package/dist/cjs/Img.js +14 -4
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +11 -5
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/dist/cjs/Img.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare function truncateSrcForLabel(src: string): string;
|
|
2
3
|
type NativeImgProps = Omit<React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, 'src'>;
|
|
3
4
|
export type ImgProps = NativeImgProps & {
|
|
4
5
|
readonly maxRetries?: number;
|
package/dist/cjs/Img.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Img = void 0;
|
|
4
|
+
exports.truncateSrcForLabel = truncateSrcForLabel;
|
|
4
5
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const enable_sequence_stack_traces_js_1 = require("./enable-sequence-stack-traces.js");
|
|
@@ -15,6 +16,14 @@ const wrap_in_schema_js_1 = require("./wrap-in-schema.js");
|
|
|
15
16
|
function exponentialBackoff(errorCount) {
|
|
16
17
|
return 1000 * 2 ** (errorCount - 1);
|
|
17
18
|
}
|
|
19
|
+
// Data URLs like the ones from canvas.toDataURL() can be many megabytes, which makes the delayRender() label
|
|
20
|
+
// unreadable and bloats log output
|
|
21
|
+
function truncateSrcForLabel(src) {
|
|
22
|
+
if (src.startsWith('data:') && src.length > 100) {
|
|
23
|
+
return src.slice(0, 60) + '...[' + src.length + ' chars total]';
|
|
24
|
+
}
|
|
25
|
+
return src;
|
|
26
|
+
}
|
|
18
27
|
const imgSchema = {
|
|
19
28
|
'style.translate': {
|
|
20
29
|
type: 'translate',
|
|
@@ -110,12 +119,13 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
|
|
|
110
119
|
if (((_g = errors.current[(_f = imageRef.current) === null || _f === void 0 ? void 0 : _f.src]) !== null && _g !== void 0 ? _g : 0) <= maxRetries) {
|
|
111
120
|
const backoff = exponentialBackoff((_j = errors.current[(_h = imageRef.current) === null || _h === void 0 ? void 0 : _h.src]) !== null && _j !== void 0 ? _j : 0);
|
|
112
121
|
// eslint-disable-next-line no-console
|
|
113
|
-
console.warn(`Could not load image with source ${(_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src}, retrying again in ${backoff}ms`);
|
|
122
|
+
console.warn(`Could not load image with source ${truncateSrcForLabel((_k = imageRef.current) === null || _k === void 0 ? void 0 : _k.src)}, retrying again in ${backoff}ms`);
|
|
114
123
|
retryIn(backoff);
|
|
115
124
|
return;
|
|
116
125
|
}
|
|
117
126
|
try {
|
|
118
|
-
cancelRender('Error loading image with src: ' +
|
|
127
|
+
cancelRender('Error loading image with src: ' +
|
|
128
|
+
truncateSrcForLabel((_l = imageRef.current) === null || _l === void 0 ? void 0 : _l.src));
|
|
119
129
|
}
|
|
120
130
|
catch (_m) {
|
|
121
131
|
// cancelRender() intentionally throws after storing the error in scope.
|
|
@@ -138,7 +148,7 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
|
|
|
138
148
|
if (!current) {
|
|
139
149
|
return;
|
|
140
150
|
}
|
|
141
|
-
const newHandle = delayRender('Loading <Img> with src=' + actualSrc, {
|
|
151
|
+
const newHandle = delayRender('Loading <Img> with src=' + truncateSrcForLabel(actualSrc), {
|
|
142
152
|
retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
|
|
143
153
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
|
|
144
154
|
});
|
|
@@ -156,7 +166,7 @@ const ImgInner = ({ onError, maxRetries = 2, src, pauseWhenLoading, delayRenderR
|
|
|
156
166
|
if (((_b = errors.current[(_a = imageRef.current) === null || _a === void 0 ? void 0 : _a.src]) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
157
167
|
delete errors.current[(_c = imageRef.current) === null || _c === void 0 ? void 0 : _c.src];
|
|
158
168
|
// eslint-disable-next-line no-console
|
|
159
|
-
console.info(`Retry successful - ${(_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src} is now loaded`);
|
|
169
|
+
console.info(`Retry successful - ${truncateSrcForLabel((_d = imageRef.current) === null || _d === void 0 ? void 0 : _d.src)} is now loaded`);
|
|
160
170
|
}
|
|
161
171
|
if (current) {
|
|
162
172
|
onImageFrame === null || onImageFrame === void 0 ? void 0 : onImageFrame(current);
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
package/dist/esm/index.mjs
CHANGED
|
@@ -1238,7 +1238,7 @@ var addSequenceStackTraces = (component) => {
|
|
|
1238
1238
|
};
|
|
1239
1239
|
|
|
1240
1240
|
// src/version.ts
|
|
1241
|
-
var VERSION = "4.0.
|
|
1241
|
+
var VERSION = "4.0.449";
|
|
1242
1242
|
|
|
1243
1243
|
// src/multiple-versions-warning.ts
|
|
1244
1244
|
var checkMultipleRemotionVersions = () => {
|
|
@@ -5837,6 +5837,12 @@ import { jsx as jsx24 } from "react/jsx-runtime";
|
|
|
5837
5837
|
function exponentialBackoff(errorCount) {
|
|
5838
5838
|
return 1000 * 2 ** (errorCount - 1);
|
|
5839
5839
|
}
|
|
5840
|
+
function truncateSrcForLabel(src) {
|
|
5841
|
+
if (src.startsWith("data:") && src.length > 100) {
|
|
5842
|
+
return src.slice(0, 60) + "...[" + src.length + " chars total]";
|
|
5843
|
+
}
|
|
5844
|
+
return src;
|
|
5845
|
+
}
|
|
5840
5846
|
var imgSchema = {
|
|
5841
5847
|
"style.translate": {
|
|
5842
5848
|
type: "translate",
|
|
@@ -5939,12 +5945,12 @@ var ImgInner = ({
|
|
|
5939
5945
|
}
|
|
5940
5946
|
if ((errors.current[imageRef.current?.src] ?? 0) <= maxRetries) {
|
|
5941
5947
|
const backoff = exponentialBackoff(errors.current[imageRef.current?.src] ?? 0);
|
|
5942
|
-
console.warn(`Could not load image with source ${imageRef.current?.src}, retrying again in ${backoff}ms`);
|
|
5948
|
+
console.warn(`Could not load image with source ${truncateSrcForLabel(imageRef.current?.src)}, retrying again in ${backoff}ms`);
|
|
5943
5949
|
retryIn(backoff);
|
|
5944
5950
|
return;
|
|
5945
5951
|
}
|
|
5946
5952
|
try {
|
|
5947
|
-
cancelRender2("Error loading image with src: " + imageRef.current?.src);
|
|
5953
|
+
cancelRender2("Error loading image with src: " + truncateSrcForLabel(imageRef.current?.src));
|
|
5948
5954
|
} catch {}
|
|
5949
5955
|
}, [cancelRender2, maxRetries, onError, retryIn]);
|
|
5950
5956
|
if (typeof window !== "undefined") {
|
|
@@ -5961,7 +5967,7 @@ var ImgInner = ({
|
|
|
5961
5967
|
if (!current) {
|
|
5962
5968
|
return;
|
|
5963
5969
|
}
|
|
5964
|
-
const newHandle = delayRender2("Loading <Img> with src=" + actualSrc, {
|
|
5970
|
+
const newHandle = delayRender2("Loading <Img> with src=" + truncateSrcForLabel(actualSrc), {
|
|
5965
5971
|
retries: delayRenderRetries ?? undefined,
|
|
5966
5972
|
timeoutInMilliseconds: delayRenderTimeoutInMilliseconds ?? undefined
|
|
5967
5973
|
});
|
|
@@ -5976,7 +5982,7 @@ var ImgInner = ({
|
|
|
5976
5982
|
}
|
|
5977
5983
|
if ((errors.current[imageRef.current?.src] ?? 0) > 0) {
|
|
5978
5984
|
delete errors.current[imageRef.current?.src];
|
|
5979
|
-
console.info(`Retry successful - ${imageRef.current?.src} is now loaded`);
|
|
5985
|
+
console.info(`Retry successful - ${truncateSrcForLabel(imageRef.current?.src)} is now loaded`);
|
|
5980
5986
|
}
|
|
5981
5987
|
if (current) {
|
|
5982
5988
|
onImageFrame?.(current);
|
package/dist/esm/version.mjs
CHANGED
package/package.json
CHANGED