@remotion/gif 4.0.0-fastlambda.7 → 4.0.0-forcepublish.6

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/Gif.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { RemotionGifProps } from './props';
1
+ import type { RemotionGifProps } from './props';
2
2
  export declare const Gif: (props: RemotionGifProps) => JSX.Element;
package/dist/Gif.js CHANGED
@@ -7,8 +7,8 @@ const GifForDevelopment_1 = require("./GifForDevelopment");
7
7
  const GifForRendering_1 = require("./GifForRendering");
8
8
  const Gif = (props) => {
9
9
  if (remotion_1.Internals.getRemotionEnvironment() === 'rendering') {
10
- return (0, jsx_runtime_1.jsx)(GifForRendering_1.GifForRendering, { ...props }, void 0);
10
+ return (0, jsx_runtime_1.jsx)(GifForRendering_1.GifForRendering, { ...props });
11
11
  }
12
- return (0, jsx_runtime_1.jsx)(GifForDevelopment_1.GifForDevelopment, { ...props }, void 0);
12
+ return (0, jsx_runtime_1.jsx)(GifForDevelopment_1.GifForDevelopment, { ...props });
13
13
  };
14
14
  exports.Gif = Gif;
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import { RemotionGifProps } from './props';
3
- export declare const GifForDevelopment: React.ForwardRefExoticComponent<RemotionGifProps & React.RefAttributes<HTMLCanvasElement>>;
1
+ /// <reference types="react" />
2
+ import type { RemotionGifProps } from './props';
3
+ export declare const GifForDevelopment: import("react").ForwardRefExoticComponent<RemotionGifProps & import("react").RefAttributes<HTMLCanvasElement>>;
@@ -38,5 +38,5 @@ exports.GifForDevelopment = (0, react_1.forwardRef)(({ src, width, height, onErr
38
38
  }
39
39
  });
40
40
  const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays);
41
- return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }, void 0));
41
+ return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }));
42
42
  });
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import { RemotionGifProps } from './props';
3
- export declare const GifForRendering: React.ForwardRefExoticComponent<RemotionGifProps & React.RefAttributes<HTMLCanvasElement>>;
1
+ /// <reference types="react" />
2
+ import type { RemotionGifProps } from './props';
3
+ export declare const GifForRendering: import("react").ForwardRefExoticComponent<RemotionGifProps & import("react").RefAttributes<HTMLCanvasElement>>;
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const tools_1 = require("@react-gifs/tools");
6
6
  const react_1 = require("react");
7
7
  const remotion_1 = require("remotion");
8
+ const is_cors_error_1 = require("./is-cors-error");
8
9
  const useCurrentGifIndex_1 = require("./useCurrentGifIndex");
9
10
  exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad, onError, fit = 'fill', ...props }, ref) => {
10
11
  const resolvedSrc = new URL(src, window.location.origin).href;
@@ -14,6 +15,7 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
14
15
  width: 0,
15
16
  height: 0,
16
17
  });
18
+ const [error, setError] = (0, react_1.useState)(null);
17
19
  const [id] = (0, react_1.useState)(() => (0, remotion_1.delayRender)(`Rendering <Gif/> with src="${resolvedSrc}"`));
18
20
  const index = (0, useCurrentGifIndex_1.useCurrentGifIndex)(state.delays);
19
21
  (0, tools_1.useParser)(resolvedSrc, (info) => {
@@ -22,7 +24,7 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
22
24
  onError(info.error);
23
25
  }
24
26
  else {
25
- console.error('Error loading GIF:', info.error, 'Handle the event using the onError() prop to make this message disappear.');
27
+ setError(info.error);
26
28
  }
27
29
  }
28
30
  else {
@@ -31,5 +33,12 @@ exports.GifForRendering = (0, react_1.forwardRef)(({ src, width, height, onLoad,
31
33
  }
32
34
  (0, remotion_1.continueRender)(id);
33
35
  });
34
- return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }, void 0));
36
+ if (error) {
37
+ console.error(error.stack);
38
+ if ((0, is_cors_error_1.isCorsError)(error)) {
39
+ throw new Error(`Failed to render GIF with source ${src}: "${error.message}". You must enable CORS for this URL.`);
40
+ }
41
+ throw new Error(`Failed to render GIF with source ${src}: "${error.message}". Render with --log=verbose to see the full stack.`);
42
+ }
43
+ return ((0, jsx_runtime_1.jsx)(tools_1.Canvas, { fit: fit, index: index, frames: state.frames, width: width !== null && width !== void 0 ? width : state.width, height: height !== null && height !== void 0 ? height : state.height, ...props, ref: ref }));
35
44
  });
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -0,0 +1 @@
1
+ export declare const isCorsError: (error: Error) => boolean;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isCorsError = void 0;
4
+ const isCorsError = (error) => {
5
+ return (
6
+ // Chrome
7
+ error.message.includes('Failed to fetch') ||
8
+ // Safari
9
+ error.message.includes('Load failed') ||
10
+ // Firefox
11
+ error.message.includes('NetworkError when attempting to fetch resource'));
12
+ };
13
+ exports.isCorsError = isCorsError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/gif",
3
- "version": "4.0.0-fastlambda.7+85d0ed68b",
3
+ "version": "4.0.0-forcepublish.6+4957f53c8",
4
4
  "description": "Gif component for remotion",
5
5
  "sideEffects": false,
6
6
  "repository": {
@@ -23,10 +23,10 @@
23
23
  "dependencies": {
24
24
  "@react-gifs/tools": "0.1.2",
25
25
  "lru_map": "0.4.1",
26
- "remotion": "4.0.0-fastlambda.7+85d0ed68b"
26
+ "remotion": "4.0.0-forcepublish.6+4957f53c8"
27
27
  },
28
28
  "devDependencies": {
29
- "@jonny/eslint-config": "3.0.259",
29
+ "@jonny/eslint-config": "3.0.266",
30
30
  "@types/node": "^16.7.5",
31
31
  "@types/react": "18.0.1",
32
32
  "@types/react-dom": "18.0.0",
@@ -36,7 +36,7 @@
36
36
  "prettier-plugin-organize-imports": "^2.3.4",
37
37
  "react": "18.0.0",
38
38
  "react-dom": "18.0.0",
39
- "typescript": "^4.5.5",
39
+ "typescript": "^4.7.0",
40
40
  "webpack": "5.72.0"
41
41
  },
42
42
  "peerDependencies": {
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "85d0ed68b731bae20dbc07b68bb3e7087beedebf"
57
+ "gitHead": "4957f53c89a3d1404798c67420465b81f36019c9"
58
58
  }
package/dist/Gif.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Gif.d.ts","sourceRoot":"","sources":["../src/Gif.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAEzC,eAAO,MAAM,GAAG,UAAW,gBAAgB,gBAM1C,CAAC"}
package/dist/Gif.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Gif.js","sourceRoot":"","sources":["../src/Gif.tsx"],"names":[],"mappings":";;;;AACA,uCAAmC;AACnC,2DAAsD;AACtD,uDAAkD;AAG3C,MAAM,GAAG,GAAG,CAAC,KAAuB,EAAE,EAAE;IAC9C,IAAI,oBAAS,CAAC,sBAAsB,EAAE,KAAK,WAAW,EAAE;QACvD,OAAO,uBAAC,iCAAe,OAAK,KAAK,WAAI,CAAC;KACtC;IAED,OAAO,uBAAC,qCAAiB,OAAK,KAAK,WAAI,CAAC;AACzC,CAAC,CAAC;AANW,QAAA,GAAG,OAMd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GifForDevelopment.d.ts","sourceRoot":"","sources":["../src/GifForDevelopment.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA6B,MAAM,OAAO,CAAC;AAClD,OAAO,EAAW,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAKnD,eAAO,MAAM,iBAAiB,4FAoD5B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"GifForDevelopment.js","sourceRoot":"","sources":["../src/GifForDevelopment.tsx"],"names":[],"mappings":";;;;AAAA,6CAA0D;AAC1D,qCAA+B;AAC/B,iCAAkD;AAElD,6DAAwD;AAExD,MAAM,KAAK,GAAG,IAAI,gBAAM,CAAmB,EAAE,CAAC,CAAC;AAElC,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAGzC,CAAC,EAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,KAAK,EAAC,EAAE,GAAG,EAAE,EAAE;IACxE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAW,GAAG,EAAE;QAC/C,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEjC,IAAI,SAAS,KAAK,SAAS,EAAE;YAC5B,OAAO;gBACN,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,KAAK,EAAE,CAAC;gBACR,MAAM,EAAE,CAAC;aACT,CAAC;SACF;QAED,OAAO,SAAq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,EACZ,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,CAAC,KAAK,EAC3B,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,KAAK,CAAC,MAAM,KAC1B,KAAK,EACT,GAAG,EAAE,GAAG,WACP,CACF,CAAC;AACH,CAAC,CACD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":";AAAA,oBAAY,gBAAgB,GAAG;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QACf,MAAM,EAAE,IAAI,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,MAAM,EAAE,SAAS,EAAE,CAAC;KACpB,KAAK,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,GAAG,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACnC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC5B,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CACf,CAAC"}
package/dist/props.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"props.js","sourceRoot":"","sources":["../src/props.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCurrentGifIndex.d.ts","sourceRoot":"","sources":["../src/useCurrentGifIndex.tsx"],"names":[],"mappings":"AAGA,iBAAS,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CA2BpD;AAED,OAAO,EAAC,kBAAkB,EAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCurrentGifIndex.js","sourceRoot":"","sources":["../src/useCurrentGifIndex.tsx"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,uCAAoD;AAEpD,SAAS,kBAAkB,CAAC,MAAgB;IAC3C,MAAM,YAAY,GAAG,IAAA,0BAAe,GAAE,CAAC;IACvC,MAAM,WAAW,GAAG,oBAAS,CAAC,oBAAoB,EAAE,CAAC;IAErD,MAAM,QAAQ,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACxB,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAW,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;SACrE;QAED,OAAO,CAAC,CAAC;IACV,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvC,IAAI,WAAW,GAAG,CAAC,CAAC,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC;YAEvE,KAAK,MAAM,CAAC,CAA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