@remotion/studio-server 4.0.435 → 4.0.437

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.
@@ -22,9 +22,7 @@ const startBrowserProcess = async ({ browser, url, args, }) => {
22
22
  const tryNewInstance = args.length > 0;
23
23
  const shouldTryOpenChromiumWithAppleScript = process.platform === 'darwin' &&
24
24
  !tryNewInstance &&
25
- (typeof browser !== 'string' ||
26
- browser === 'google chrome' ||
27
- browser === 'chrome');
25
+ (!browser || browser === 'google chrome' || browser === 'chrome');
28
26
  if (shouldTryOpenChromiumWithAppleScript) {
29
27
  let appleScriptDenied = false;
30
28
  // Will use the first open browser found from list
@@ -69,9 +67,7 @@ const startBrowserProcess = async ({ browser, url, args, }) => {
69
67
 
70
68
  on run argv
71
69
  set theURL to "${encodeURI(url)}"
72
- set matchURL to "${process.env.OPEN_MATCH_HOST_ONLY === 'true'
73
- ? encodeURI(normalizeURLToMatch(url))
74
- : encodeURI(url)}"
70
+ set matchURL to "${encodeURI(normalizeURLToMatch(url))}"
75
71
 
76
72
  using terms from application "Google Chrome"
77
73
  tell application theProgram
@@ -0,0 +1,3 @@
1
+ import type { RedoRequest, RedoResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const redoHandler: ApiHandler<RedoRequest, RedoResponse>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.redoHandler = void 0;
4
+ const undo_stack_1 = require("../undo-stack");
5
+ const redoHandler = () => {
6
+ return Promise.resolve((0, undo_stack_1.popRedo)());
7
+ };
8
+ exports.redoHandler = redoHandler;
@@ -0,0 +1,3 @@
1
+ import type { UndoRequest, UndoResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const undoHandler: ApiHandler<UndoRequest, UndoResponse>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.undoHandler = void 0;
4
+ const undo_stack_1 = require("../undo-stack");
5
+ const undoHandler = () => {
6
+ return Promise.resolve((0, undo_stack_1.popUndo)());
7
+ };
8
+ exports.undoHandler = undoHandler;
@@ -0,0 +1,23 @@
1
+ import type { LogLevel } from '@remotion/renderer';
2
+ interface UndoEntry {
3
+ filePath: string;
4
+ oldContents: string;
5
+ }
6
+ export declare function pushToUndoStack(filePath: string, oldContents: string, logLevel: LogLevel): void;
7
+ export declare function pushToRedoStack(filePath: string, oldContents: string): void;
8
+ export declare function suppressUndoStackInvalidation(filePath: string): void;
9
+ export declare function popUndo(): {
10
+ success: true;
11
+ } | {
12
+ success: false;
13
+ reason: string;
14
+ };
15
+ export declare function popRedo(): {
16
+ success: true;
17
+ } | {
18
+ success: false;
19
+ reason: string;
20
+ };
21
+ export declare function getUndoStack(): readonly UndoEntry[];
22
+ export declare function getRedoStack(): readonly UndoEntry[];
23
+ export {};
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pushToUndoStack = pushToUndoStack;
4
+ exports.pushToRedoStack = pushToRedoStack;
5
+ exports.suppressUndoStackInvalidation = suppressUndoStackInvalidation;
6
+ exports.popUndo = popUndo;
7
+ exports.popRedo = popRedo;
8
+ exports.getUndoStack = getUndoStack;
9
+ exports.getRedoStack = getRedoStack;
10
+ const node_fs_1 = require("node:fs");
11
+ const renderer_1 = require("@remotion/renderer");
12
+ const file_watcher_1 = require("../file-watcher");
13
+ const hmr_suppression_1 = require("./hmr-suppression");
14
+ const live_events_1 = require("./live-events");
15
+ const MAX_ENTRIES = 100;
16
+ const undoStack = [];
17
+ const redoStack = [];
18
+ const suppressedWrites = new Map();
19
+ const watchers = new Map();
20
+ let storedLogLevel = 'info';
21
+ function broadcastState() {
22
+ const undoFile = undoStack.length > 0 ? undoStack[undoStack.length - 1].filePath : null;
23
+ const redoFile = redoStack.length > 0 ? redoStack[redoStack.length - 1].filePath : null;
24
+ (0, live_events_1.waitForLiveEventsListener)().then((listener) => {
25
+ listener.sendEventToClient({
26
+ type: 'undo-redo-stack-changed',
27
+ undoFile,
28
+ redoFile,
29
+ });
30
+ });
31
+ }
32
+ function pushToUndoStack(filePath, oldContents, logLevel) {
33
+ storedLogLevel = logLevel;
34
+ undoStack.push({ filePath, oldContents });
35
+ if (undoStack.length > MAX_ENTRIES) {
36
+ undoStack.shift();
37
+ }
38
+ redoStack.length = 0;
39
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray(`Undo stack: added entry for ${filePath} (${undoStack.length} items)`));
40
+ ensureWatching(filePath);
41
+ broadcastState();
42
+ }
43
+ function pushToRedoStack(filePath, oldContents) {
44
+ redoStack.push({ filePath, oldContents });
45
+ if (redoStack.length > MAX_ENTRIES) {
46
+ redoStack.shift();
47
+ }
48
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Redo stack: added entry for ${filePath} (${redoStack.length} items)`));
49
+ ensureWatching(filePath);
50
+ broadcastState();
51
+ }
52
+ function suppressUndoStackInvalidation(filePath) {
53
+ var _a;
54
+ suppressedWrites.set(filePath, ((_a = suppressedWrites.get(filePath)) !== null && _a !== void 0 ? _a : 0) + 1);
55
+ }
56
+ function ensureWatching(filePath) {
57
+ if (watchers.has(filePath)) {
58
+ return;
59
+ }
60
+ const watcher = (0, file_watcher_1.installFileWatcher)({
61
+ file: filePath,
62
+ onChange: () => {
63
+ var _a;
64
+ const count = (_a = suppressedWrites.get(filePath)) !== null && _a !== void 0 ? _a : 0;
65
+ if (count > 0) {
66
+ if (count === 1) {
67
+ suppressedWrites.delete(filePath);
68
+ }
69
+ else {
70
+ suppressedWrites.set(filePath, count - 1);
71
+ }
72
+ return;
73
+ }
74
+ invalidateForFile(filePath);
75
+ },
76
+ });
77
+ watchers.set(filePath, watcher);
78
+ }
79
+ function invalidateForFile(filePath) {
80
+ let changed = false;
81
+ let lastUndoIndex = -1;
82
+ for (let i = undoStack.length - 1; i >= 0; i--) {
83
+ if (undoStack[i].filePath === filePath) {
84
+ lastUndoIndex = i;
85
+ break;
86
+ }
87
+ }
88
+ if (lastUndoIndex !== -1) {
89
+ const removed = lastUndoIndex + 1;
90
+ undoStack.splice(0, removed);
91
+ changed = true;
92
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Undo stack: ${filePath} was externally modified, removed ${removed} entries (${undoStack.length} items)`));
93
+ }
94
+ let lastRedoIndex = -1;
95
+ for (let i = redoStack.length - 1; i >= 0; i--) {
96
+ if (redoStack[i].filePath === filePath) {
97
+ lastRedoIndex = i;
98
+ break;
99
+ }
100
+ }
101
+ if (lastRedoIndex !== -1) {
102
+ const removed = lastRedoIndex + 1;
103
+ redoStack.splice(0, removed);
104
+ changed = true;
105
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Redo stack: ${filePath} was externally modified, removed ${removed} entries (${redoStack.length} items)`));
106
+ }
107
+ cleanupWatchers();
108
+ if (changed) {
109
+ broadcastState();
110
+ }
111
+ }
112
+ function cleanupWatchers() {
113
+ const filesInStacks = new Set([
114
+ ...undoStack.map((e) => e.filePath),
115
+ ...redoStack.map((e) => e.filePath),
116
+ ]);
117
+ for (const [filePath, watcher] of watchers) {
118
+ if (!filesInStacks.has(filePath)) {
119
+ watcher.unwatch();
120
+ watchers.delete(filePath);
121
+ }
122
+ }
123
+ }
124
+ function popUndo() {
125
+ const entry = undoStack.pop();
126
+ if (!entry) {
127
+ return { success: false, reason: 'Nothing to undo' };
128
+ }
129
+ const currentContents = (0, node_fs_1.readFileSync)(entry.filePath, 'utf-8');
130
+ redoStack.push({ filePath: entry.filePath, oldContents: currentContents });
131
+ suppressUndoStackInvalidation(entry.filePath);
132
+ (0, hmr_suppression_1.suppressHmrForFile)(entry.filePath);
133
+ (0, node_fs_1.writeFileSync)(entry.filePath, entry.oldContents);
134
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Undo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
135
+ ensureWatching(entry.filePath);
136
+ broadcastState();
137
+ return { success: true };
138
+ }
139
+ function popRedo() {
140
+ const entry = redoStack.pop();
141
+ if (!entry) {
142
+ return { success: false, reason: 'Nothing to redo' };
143
+ }
144
+ const currentContents = (0, node_fs_1.readFileSync)(entry.filePath, 'utf-8');
145
+ undoStack.push({ filePath: entry.filePath, oldContents: currentContents });
146
+ suppressUndoStackInvalidation(entry.filePath);
147
+ (0, hmr_suppression_1.suppressHmrForFile)(entry.filePath);
148
+ (0, node_fs_1.writeFileSync)(entry.filePath, entry.oldContents);
149
+ renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Redo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
150
+ ensureWatching(entry.filePath);
151
+ broadcastState();
152
+ return { success: true };
153
+ }
154
+ function getUndoStack() {
155
+ return undoStack;
156
+ }
157
+ function getRedoStack() {
158
+ return redoStack;
159
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
4
4
  },
5
5
  "name": "@remotion/studio-server",
6
- "version": "4.0.435",
6
+ "version": "4.0.437",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "sideEffects": false,
@@ -27,11 +27,11 @@
27
27
  "@babel/parser": "7.24.1",
28
28
  "semver": "7.5.3",
29
29
  "prettier": "3.8.1",
30
- "remotion": "4.0.435",
30
+ "remotion": "4.0.437",
31
31
  "recast": "0.23.11",
32
- "@remotion/bundler": "4.0.435",
33
- "@remotion/renderer": "4.0.435",
34
- "@remotion/studio-shared": "4.0.435",
32
+ "@remotion/bundler": "4.0.437",
33
+ "@remotion/renderer": "4.0.437",
34
+ "@remotion/studio-shared": "4.0.437",
35
35
  "memfs": "3.4.3",
36
36
  "source-map": "0.7.3",
37
37
  "open": "^8.4.2"
@@ -41,7 +41,7 @@
41
41
  "react": "19.2.3",
42
42
  "@babel/types": "7.24.0",
43
43
  "@types/semver": "^7.3.4",
44
- "@remotion/eslint-config-internal": "4.0.435",
44
+ "@remotion/eslint-config-internal": "4.0.437",
45
45
  "eslint": "9.19.0",
46
46
  "@types/node": "20.12.14",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260217.1"