@remotion/studio 4.0.439 → 4.0.440

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.
@@ -208,7 +208,7 @@ var renderContent = (Root) => {
208
208
  renderToDOM(/* @__PURE__ */ jsx("div", {
209
209
  children: /* @__PURE__ */ jsx(DelayedSpinner, {})
210
210
  }));
211
- import("./chunk-nnz9f1vq.js").then(({ StudioInternals }) => {
211
+ import("./chunk-1x2ychmc.js").then(({ StudioInternals }) => {
212
212
  window.remotion_isStudio = true;
213
213
  window.remotion_isReadOnlyStudio = true;
214
214
  window.remotion_inputProps = "{}";
@@ -63,7 +63,7 @@ const PreviewServerConnection = ({ children, readOnlyStudio }) => {
63
63
  const openEventSource = (0, react_1.useCallback)(() => {
64
64
  const source = new EventSource('/events');
65
65
  source.addEventListener('message', (event) => {
66
- var _a, _b;
66
+ var _a, _b, _c;
67
67
  const newEvent = JSON.parse(event.data);
68
68
  if (newEvent.type === 'new-input-props' ||
69
69
  newEvent.type === 'new-env-variables') {
@@ -108,6 +108,9 @@ const PreviewServerConnection = ({ children, readOnlyStudio }) => {
108
108
  detail: payload,
109
109
  }));
110
110
  }
111
+ if (newEvent.type === 'hmr') {
112
+ (_c = window.__remotion_processHmrEvent) === null || _c === void 0 ? void 0 : _c.call(window, newEvent.hmrEvent);
113
+ }
111
114
  listeners.current.forEach((l) => {
112
115
  if (l.type === newEvent.type) {
113
116
  l.listener(newEvent);
@@ -1,6 +1,6 @@
1
1
  import type { RenderType } from '../components/RenderModal/RenderModalAdvanced';
2
2
  type Section = 'general' | 'picture' | 'advanced' | 'data' | 'gif' | 'audio';
3
- export declare const useRenderModalSections: (renderMode: RenderType, codec: "aac" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav") => {
3
+ export declare const useRenderModalSections: (renderMode: RenderType, codec: "aac" | "av1" | "gif" | "h264" | "h264-mkv" | "h264-ts" | "h265" | "mp3" | "prores" | "vp8" | "vp9" | "wav") => {
4
4
  tab: Section;
5
5
  setTab: import("react").Dispatch<import("react").SetStateAction<Section>>;
6
6
  shownTabs: Section[];
@@ -16,4 +16,4 @@ export type SchemaFieldInfo = {
16
16
  };
17
17
  export declare const getSchemaFields: (controls: SequenceControls | null) => SchemaFieldInfo[] | null;
18
18
  export declare const getExpandedTrackHeight: (controls: SequenceControls | null) => number;
19
- export declare const getTimelineLayerHeight: (type: "other" | "video") => 25 | 50;
19
+ export declare const getTimelineLayerHeight: (type: "audio" | "image" | "other" | "sequence" | "video") => 25 | 50;
@@ -44,7 +44,7 @@ const getExpandedTrackHeight = (controls) => {
44
44
  };
45
45
  exports.getExpandedTrackHeight = getExpandedTrackHeight;
46
46
  const getTimelineLayerHeight = (type) => {
47
- if (type === 'video') {
47
+ if (type === 'video' || type === 'image') {
48
48
  return 50;
49
49
  }
50
50
  return 25;
@@ -4,15 +4,10 @@
4
4
  * and rewritten in TypeScript. This file is MIT licensed
5
5
  */
6
6
  import type { HotMiddlewareMessage } from '@remotion/studio-shared';
7
- declare function eventSourceWrapper(): {
8
- addMessageListener(fn: (msg: MessageEvent<any>) => void): void;
9
- };
10
7
  declare global {
11
8
  interface Window {
12
- __whmEventSourceWrapper: {
13
- [key: string]: ReturnType<typeof eventSourceWrapper>;
14
- };
15
9
  __webpack_hot_middleware_reporter__: Reporter;
10
+ __remotion_processHmrEvent?: (hmrEvent: HotMiddlewareMessage) => void;
16
11
  }
17
12
  }
18
13
  type Reporter = ReturnType<typeof createReporter>;
@@ -5,70 +5,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.enableHotMiddleware = void 0;
6
6
  const studio_shared_1 = require("@remotion/studio-shared");
7
7
  const process_update_1 = require("./process-update");
8
- function eventSourceWrapper() {
9
- let source;
10
- let lastActivity = Date.now();
11
- const listeners = [];
12
- init();
13
- const timer = setInterval(() => {
14
- if (Date.now() - lastActivity > studio_shared_1.hotMiddlewareOptions.timeout) {
15
- handleDisconnect();
16
- }
17
- }, studio_shared_1.hotMiddlewareOptions.timeout / 2);
18
- function init() {
19
- source = new window.EventSource(studio_shared_1.hotMiddlewareOptions.path);
20
- source.onopen = handleOnline;
21
- source.onerror = handleDisconnect;
22
- source.onmessage = handleMessage;
23
- }
24
- function handleOnline() {
25
- lastActivity = Date.now();
26
- }
27
- function handleMessage(event) {
28
- lastActivity = Date.now();
29
- for (let i = 0; i < listeners.length; i++) {
30
- listeners[i](event);
31
- }
32
- }
33
- function handleDisconnect() {
34
- clearInterval(timer);
35
- source.close();
36
- setTimeout(init, 1000);
37
- }
38
- return {
39
- addMessageListener(fn) {
40
- listeners.push(fn);
41
- },
42
- };
43
- }
44
- function getEventSourceWrapper() {
45
- if (!window.__whmEventSourceWrapper) {
46
- window.__whmEventSourceWrapper = {};
47
- }
48
- if (!window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path]) {
49
- // cache the wrapper for other entries loaded on
50
- // the same page with the same hotMiddlewareOptions.path
51
- window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path] =
52
- eventSourceWrapper();
53
- }
54
- return window.__whmEventSourceWrapper[studio_shared_1.hotMiddlewareOptions.path];
55
- }
56
- function connect() {
57
- getEventSourceWrapper().addMessageListener(handleMessage);
58
- function handleMessage(event) {
59
- if (event.data === '\uD83D\uDC93') {
60
- return;
61
- }
62
- try {
63
- processMessage(JSON.parse(event.data));
64
- }
65
- catch (ex) {
66
- if (studio_shared_1.hotMiddlewareOptions.warn) {
67
- console.warn('Invalid HMR message: ' + event.data + '\n' + ex);
68
- }
69
- }
70
- }
71
- }
72
8
  function createReporter() {
73
9
  const styles = {
74
10
  errors: 'color: #ff0000;',
@@ -153,20 +89,33 @@ function processMessage(obj) {
153
89
  let reporter;
154
90
  const singletonKey = '__webpack_hot_middleware_reporter__';
155
91
  const enableHotMiddleware = () => {
156
- if (typeof window === 'undefined') {
157
- // do nothing
158
- }
159
- else if (typeof window.EventSource === 'undefined') {
160
- console.warn('Unsupported browser: You need a browser that supports EventSource ');
161
- }
162
- else {
163
- connect();
164
- }
165
92
  if (typeof window !== 'undefined') {
166
93
  if (!window[singletonKey]) {
167
94
  window[singletonKey] = createReporter();
168
95
  }
169
96
  reporter = window[singletonKey];
170
97
  }
98
+ window.__remotion_processHmrEvent = (hmrEvent) => {
99
+ processMessage(hmrEvent);
100
+ };
101
+ // Create a standalone SSE listener for HMR events immediately.
102
+ // This is needed because lazy-compiled modules require HMR updates
103
+ // to deliver compiled code, but the React-managed /events SSE
104
+ // (in PreviewServerConnection) only connects after React mounts —
105
+ // which itself depends on lazy modules loading first.
106
+ if (typeof window !== 'undefined' && typeof EventSource !== 'undefined') {
107
+ const source = new EventSource('/events');
108
+ source.addEventListener('message', (event) => {
109
+ try {
110
+ const parsed = JSON.parse(event.data);
111
+ if (parsed.type === 'hmr') {
112
+ processMessage(parsed.hmrEvent);
113
+ }
114
+ }
115
+ catch (_a) {
116
+ // Ignore parse errors
117
+ }
118
+ });
119
+ }
171
120
  };
172
121
  exports.enableHotMiddleware = enableHotMiddleware;
@@ -10,9 +10,7 @@
10
10
  */
11
11
  import type { ModuleMap } from '@remotion/studio-shared';
12
12
  export declare const processUpdate: (hash: string | undefined, moduleMap: ModuleMap, options: {
13
- path: string;
14
13
  timeout: number;
15
14
  reload: boolean;
16
15
  warn: boolean;
17
- heartbeat: number;
18
16
  }) => void;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio"
4
4
  },
5
5
  "name": "@remotion/studio",
6
- "version": "4.0.439",
6
+ "version": "4.0.440",
7
7
  "description": "APIs for interacting with the Remotion Studio",
8
8
  "main": "dist",
9
9
  "sideEffects": false,
@@ -26,13 +26,13 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "semver": "7.5.3",
29
- "remotion": "4.0.439",
30
- "@remotion/player": "4.0.439",
31
- "@remotion/media-utils": "4.0.439",
32
- "@remotion/renderer": "4.0.439",
33
- "@remotion/web-renderer": "4.0.439",
34
- "@remotion/studio-shared": "4.0.439",
35
- "@remotion/zod-types": "4.0.439",
29
+ "remotion": "4.0.440",
30
+ "@remotion/player": "4.0.440",
31
+ "@remotion/media-utils": "4.0.440",
32
+ "@remotion/renderer": "4.0.440",
33
+ "@remotion/web-renderer": "4.0.440",
34
+ "@remotion/studio-shared": "4.0.440",
35
+ "@remotion/zod-types": "4.0.440",
36
36
  "mediabunny": "1.39.2",
37
37
  "memfs": "3.4.3",
38
38
  "source-map": "0.7.3",
@@ -43,7 +43,7 @@
43
43
  "react": "19.2.3",
44
44
  "react-dom": "19.2.3",
45
45
  "@types/semver": "^7.3.4",
46
- "@remotion/eslint-config-internal": "4.0.439",
46
+ "@remotion/eslint-config-internal": "4.0.440",
47
47
  "eslint": "9.19.0",
48
48
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
49
49
  },