remotion 4.0.147 → 4.0.149

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/bundle.ts ADDED
@@ -0,0 +1,35 @@
1
+ import {build} from 'bun';
2
+
3
+ const output = await build({
4
+ entrypoints: ['src/index.ts'],
5
+ naming: '[name].mjs',
6
+ target: 'browser',
7
+ external: ['remotion', 'remotion/no-react', 'react', 'react-dom'],
8
+ });
9
+
10
+ const [file] = output.outputs;
11
+ const text = (await file.text())
12
+ .replace(/jsxDEV/g, 'jsx')
13
+ .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
14
+
15
+ await Bun.write('dist/esm/index.mjs', text);
16
+
17
+ const versionOutput = await build({
18
+ entrypoints: ['src/version.ts'],
19
+ naming: '[name].mjs',
20
+ target: 'browser',
21
+ });
22
+
23
+ const [versionFile] = versionOutput.outputs;
24
+ await Bun.write('dist/esm/version.mjs', await versionFile.text());
25
+
26
+ const noReactOutput = await build({
27
+ entrypoints: ['src/no-react.ts'],
28
+ naming: '[name].mjs',
29
+ target: 'browser',
30
+ external: ['remotion', 'react', 'react-dom'],
31
+ });
32
+ const [noReactFile] = noReactOutput.outputs;
33
+ await Bun.write('dist/esm/no-react.mjs', await noReactFile.text());
34
+
35
+ export {};
package/dist/cjs/Img.js CHANGED
@@ -68,7 +68,8 @@ const ImgRefForwarding = ({ onError, maxRetries = 2, src, pauseWhenLoading, dela
68
68
  const isPremounting = Boolean(sequenceContext === null || sequenceContext === void 0 ? void 0 : sequenceContext.premounting);
69
69
  // eslint-disable-next-line react-hooks/rules-of-hooks
70
70
  (0, react_1.useLayoutEffect)(() => {
71
- if (process.env.NODE_ENV === 'test') {
71
+ var _a, _b;
72
+ if (((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'test') {
72
73
  return;
73
74
  }
74
75
  const newHandle = (0, delay_render_js_1.delayRender)('Loading <Img> with src=' + actualSrc, {
@@ -89,7 +89,8 @@ const AudioForRenderingRefForwardingFunction = (props, ref) => {
89
89
  const needsToRenderAudioTag = ref || _remotionInternalNeedsDurationCalculation;
90
90
  // If audio source switches, make new handle
91
91
  (0, react_1.useLayoutEffect)(() => {
92
- if (process.env.NODE_ENV === 'test') {
92
+ var _a, _b;
93
+ if (((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'test') {
93
94
  return;
94
95
  }
95
96
  if (!needsToRenderAudioTag) {
@@ -7,10 +7,13 @@ exports.getRemotionEnvironment = void 0;
7
7
  */
8
8
  const getRemotionEnvironment = () => {
9
9
  const isPlayer = typeof window !== 'undefined' && window.remotion_isPlayer;
10
- const isRendering = process.env.NODE_ENV === 'test' ||
11
- (process.env.NODE_ENV === 'production' &&
12
- typeof window !== 'undefined' &&
13
- typeof window.remotion_puppeteerTimeout !== 'undefined');
10
+ const isRendering = typeof window !== 'undefined' &&
11
+ typeof window.process !== 'undefined' &&
12
+ typeof window.process.env !== 'undefined' &&
13
+ (window.process.env.NODE_ENV === 'test' ||
14
+ (window.process.env.NODE_ENV === 'production' &&
15
+ typeof window !== 'undefined' &&
16
+ typeof window.remotion_puppeteerTimeout !== 'undefined'));
14
17
  const isStudio = typeof window !== 'undefined' && window.remotion_isStudio;
15
18
  return {
16
19
  isStudio,
@@ -1,18 +1,23 @@
1
1
  import type { FC, PropsWithChildren } from 'react';
2
+ import React from 'react';
2
3
  import type { LayoutAndStyle, SequenceProps } from '../Sequence.js';
4
+ import { ENABLE_V5_BREAKING_CHANGES } from '../v5-flag.js';
3
5
  type SeriesSequenceProps = PropsWithChildren<{
4
- durationInFrames: number;
5
- offset?: number;
6
- className?: string;
6
+ readonly durationInFrames: number;
7
+ readonly offset?: number;
8
+ readonly className?: string;
7
9
  } & Pick<SequenceProps, 'layout' | 'name'> & LayoutAndStyle>;
8
- declare const SeriesSequence: import("react").ForwardRefExoticComponent<SeriesSequenceProps & import("react").RefAttributes<HTMLDivElement>>;
10
+ declare const SeriesSequence: React.ForwardRefExoticComponent<SeriesSequenceProps & React.RefAttributes<HTMLDivElement>>;
11
+ type V4Props = {
12
+ children: React.ReactNode;
13
+ };
14
+ type V5Props = SequenceProps;
15
+ type SeriesProps = true extends typeof ENABLE_V5_BREAKING_CHANGES ? V5Props : V4Props;
9
16
  /**
10
17
  * @description with this component, you can easily stitch together scenes that should play sequentially after another.
11
18
  * @see [Documentation](https://www.remotion.dev/docs/series)
12
19
  */
13
- declare const Series: FC<{
14
- children: React.ReactNode;
15
- }> & {
20
+ declare const Series: FC<SeriesProps> & {
16
21
  Sequence: typeof SeriesSequence;
17
22
  };
18
23
  export { Series };
@@ -5,6 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const Sequence_js_1 = require("../Sequence.js");
7
7
  const enable_sequence_stack_traces_js_1 = require("../enable-sequence-stack-traces.js");
8
+ const v5_flag_js_1 = require("../v5-flag.js");
8
9
  const validate_duration_in_frames_js_1 = require("../validation/validate-duration-in-frames.js");
9
10
  const flatten_children_js_1 = require("./flatten-children.js");
10
11
  const is_inside_series_js_1 = require("./is-inside-series.js");
@@ -19,10 +20,10 @@ const SeriesSequence = (0, react_1.forwardRef)(SeriesSequenceRefForwardingFuncti
19
20
  * @description with this component, you can easily stitch together scenes that should play sequentially after another.
20
21
  * @see [Documentation](https://www.remotion.dev/docs/series)
21
22
  */
22
- const Series = ({ children }) => {
23
+ const Series = (props) => {
23
24
  const childrenValue = (0, react_1.useMemo)(() => {
24
25
  let startFrame = 0;
25
- const flattenedChildren = (0, flatten_children_js_1.flattenChildren)(children);
26
+ const flattenedChildren = (0, flatten_children_js_1.flattenChildren)(props.children);
26
27
  return react_1.Children.map(flattenedChildren, (child, i) => {
27
28
  var _a;
28
29
  const castedChild = child;
@@ -63,7 +64,10 @@ const Series = ({ children }) => {
63
64
  startFrame += durationInFramesProp + offset;
64
65
  return ((0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { name: name || '<Series.Sequence>', from: currentStartFrame, durationInFrames: durationInFramesProp, ...passedProps, ref: castedChild.ref, children: child }));
65
66
  });
66
- }, [children]);
67
+ }, [props.children]);
68
+ if (v5_flag_js_1.ENABLE_V5_BREAKING_CHANGES) {
69
+ return ((0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: (0, jsx_runtime_1.jsx)(Sequence_js_1.Sequence, { ...props, children: childrenValue }) }));
70
+ }
67
71
  return (0, jsx_runtime_1.jsx)(is_inside_series_js_1.IsInsideSeriesContainer, { children: childrenValue });
68
72
  };
69
73
  exports.Series = Series;
@@ -11,6 +11,9 @@ const advanceCache = {};
11
11
  function advance({ animation, now, config, }) {
12
12
  const { toValue, lastTimestamp, current, velocity } = animation;
13
13
  const deltaTime = Math.min(now - lastTimestamp, 64);
14
+ if (config.damping <= 0) {
15
+ throw new Error('Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.');
16
+ }
14
17
  const c = config.damping;
15
18
  const m = config.mass;
16
19
  const k = config.stiffness;
@@ -59,14 +59,15 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
59
59
  }
60
60
  }, [initialVolume, mediaType, src, volume]);
61
61
  (0, react_1.useEffect)(() => {
62
- var _a;
62
+ var _a, _b, _c;
63
63
  if (!mediaRef.current) {
64
64
  return;
65
65
  }
66
66
  if (!src) {
67
67
  throw new Error('No src passed');
68
68
  }
69
- if (!(0, get_remotion_environment_js_1.getRemotionEnvironment)().isStudio && process.env.NODE_ENV !== 'test') {
69
+ if (!(0, get_remotion_environment_js_1.getRemotionEnvironment)().isStudio &&
70
+ ((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) !== 'test') {
70
71
  return;
71
72
  }
72
73
  if (!showInTimeline) {
@@ -78,7 +79,7 @@ const useMediaInTimeline = ({ volume, mediaVolume, mediaRef, src, mediaType, pla
78
79
  id,
79
80
  duration,
80
81
  from: 0,
81
- parent: (_a = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _a !== void 0 ? _a : null,
82
+ parent: (_c = parentSequence === null || parentSequence === void 0 ? void 0 : parentSequence.id) !== null && _c !== void 0 ? _c : null,
82
83
  displayName: displayName !== null && displayName !== void 0 ? displayName : (0, get_asset_file_name_js_1.getAssetDisplayName)(src),
83
84
  rootId,
84
85
  volume: volumes,
@@ -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.147";
6
+ export declare const VERSION = "4.0.149";
@@ -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.147';
10
+ exports.VERSION = '4.0.149';
@@ -92,6 +92,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
92
92
  return videoRef.current;
93
93
  }, []);
94
94
  (0, react_1.useEffect)(() => {
95
+ var _a, _b;
95
96
  if (!window.remotion_videoEnabled) {
96
97
  return;
97
98
  }
@@ -109,7 +110,7 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
109
110
  retries: delayRenderRetries !== null && delayRenderRetries !== void 0 ? delayRenderRetries : undefined,
110
111
  timeoutInMilliseconds: delayRenderTimeoutInMilliseconds !== null && delayRenderTimeoutInMilliseconds !== void 0 ? delayRenderTimeoutInMilliseconds : undefined,
111
112
  });
112
- if (process.env.NODE_ENV === 'test') {
113
+ if (((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'test') {
113
114
  (0, delay_render_js_1.continueRender)(handle);
114
115
  return;
115
116
  }
@@ -173,7 +174,8 @@ const VideoForRenderingForwardFunction = ({ onError, volume: volumeProp, allowAm
173
174
  if (environment.isRendering) {
174
175
  // eslint-disable-next-line react-hooks/rules-of-hooks
175
176
  (0, react_1.useLayoutEffect)(() => {
176
- if (process.env.NODE_ENV === 'test') {
177
+ var _a, _b;
178
+ if (((_b = (_a = window.process) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.NODE_ENV) === 'test') {
177
179
  return;
178
180
  }
179
181
  const newHandle = (0, delay_render_js_1.delayRender)('Loading <Video> duration with src=' + src, {