@remotion/gif 3.2.23 → 3.2.25

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.
@@ -31,6 +31,7 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
31
31
  currentOnError.current = onError;
32
32
  (0, react_1.useEffect)(() => {
33
33
  let done = false;
34
+ let aborted = false;
34
35
  const { prom, cancel } = (0, react_tools_1.parseWithWorker)(resolvedSrc);
35
36
  const newHandle = (0, remotion_1.delayRender)('Loading <Gif /> with src=' + resolvedSrc);
36
37
  prom
@@ -44,6 +45,10 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
44
45
  (0, remotion_1.continueRender)(id);
45
46
  })
46
47
  .catch((err) => {
48
+ if (aborted) {
49
+ (0, remotion_1.continueRender)(newHandle);
50
+ return;
51
+ }
47
52
  if (currentOnError.current) {
48
53
  currentOnError.current(err);
49
54
  }
@@ -53,6 +58,7 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
53
58
  });
54
59
  return () => {
55
60
  if (!done) {
61
+ aborted = true;
56
62
  cancel();
57
63
  }
58
64
  (0, remotion_1.continueRender)(newHandle);
@@ -63,7 +69,7 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
63
69
  if ((0, is_cors_error_1.isCorsError)(error)) {
64
70
  throw new Error(`Failed to render GIF with source ${src}: "${error.message}". You must enable CORS for this URL.`);
65
71
  }
66
- throw new Error(`Failed to render GIF with source ${src}: "${error.message}". Render with --log=verbose to see the full stack.`);
72
+ throw new Error(`Failed to render GIF with source ${src}: "${error.message}".`);
67
73
  }
68
74
  const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays);
69
75
  return ((0, jsx_runtime_1.jsx)(canvas_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width, height: height, ...props, ref: ref }));
@@ -33,6 +33,7 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
33
33
  (0, react_1.useEffect)(() => {
34
34
  const controller = new AbortController();
35
35
  let done = false;
36
+ let aborted = false;
36
37
  const newHandle = (0, remotion_1.delayRender)('Loading <Gif /> with src=' + resolvedSrc);
37
38
  (0, react_tools_1.parseGif)({ controller, src: resolvedSrc })
38
39
  .then((parsed) => {
@@ -45,6 +46,10 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
45
46
  (0, remotion_1.continueRender)(id);
46
47
  })
47
48
  .catch((err) => {
49
+ if (aborted) {
50
+ (0, remotion_1.continueRender)(newHandle);
51
+ return;
52
+ }
48
53
  if (currentOnError.current) {
49
54
  currentOnError.current(err);
50
55
  }
@@ -54,6 +59,7 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
54
59
  });
55
60
  return () => {
56
61
  if (!done) {
62
+ aborted = true;
57
63
  controller.abort();
58
64
  }
59
65
  (0, remotion_1.continueRender)(newHandle);
@@ -8,11 +8,8 @@ const parseGif = async ({ src, controller, }) => {
8
8
  return (0, parse_generate_1.generate)(raw);
9
9
  };
10
10
  exports.parseGif = parseGif;
11
- let worker = null;
12
11
  const parseWithWorker = (src) => {
13
- if (!worker) {
14
- worker = (0, worker_1.makeWorker)();
15
- }
12
+ const worker = (0, worker_1.makeWorker)();
16
13
  let handler = null;
17
14
  const prom = new Promise((resolve, reject) => {
18
15
  handler = (e) => {
@@ -35,6 +32,7 @@ const parseWithWorker = (src) => {
35
32
  cancel: () => {
36
33
  worker.postMessage({ src, type: 'cancel' });
37
34
  worker.removeEventListener('message', handler);
35
+ worker.terminate();
38
36
  },
39
37
  };
40
38
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/gif",
3
- "version": "3.2.23",
3
+ "version": "3.2.25",
4
4
  "description": "Gif component for remotion",
5
5
  "sideEffects": false,
6
6
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "gifuct-js": "2.1.2",
25
25
  "lru_map": "0.4.1",
26
- "remotion": "3.2.23"
26
+ "remotion": "3.2.25"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@jonny/eslint-config": "3.0.266",
@@ -37,7 +37,7 @@
37
37
  "react": "18.0.0",
38
38
  "react-dom": "18.0.0",
39
39
  "typescript": "^4.7.0",
40
- "webpack": "5.72.0"
40
+ "webpack": "5.74.0"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": ">=16.8.0",
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "34a407a825ded88c9058bcf0e9ec4fe04024b7ce"
57
+ "gitHead": "8e51d998e16f062336d65469cbfc9266068b7701"
58
58
  }