@remotion/studio-server 4.0.438 → 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.
Files changed (36) hide show
  1. package/dist/client-render-queue.js +3 -3
  2. package/dist/codemods/apply-visual-control.js +8 -1
  3. package/dist/codemods/format-inline-content.d.ts +21 -0
  4. package/dist/codemods/format-inline-content.js +108 -0
  5. package/dist/codemods/read-visual-control-values.d.ts +7 -0
  6. package/dist/codemods/read-visual-control-values.js +166 -0
  7. package/dist/codemods/update-default-props.d.ts +4 -1
  8. package/dist/codemods/update-default-props.js +51 -22
  9. package/dist/file-watcher.d.ts +24 -7
  10. package/dist/file-watcher.js +148 -29
  11. package/dist/index.d.ts +5 -2
  12. package/dist/index.js +3 -0
  13. package/dist/preview-server/api-routes.js +8 -2
  14. package/dist/preview-server/default-props-watchers.js +12 -17
  15. package/dist/preview-server/file-existence-watchers.js +3 -3
  16. package/dist/preview-server/hot-middleware/index.d.ts +2 -2
  17. package/dist/preview-server/hot-middleware/index.js +14 -92
  18. package/dist/preview-server/live-events.d.ts +7 -1
  19. package/dist/preview-server/live-events.js +21 -2
  20. package/dist/preview-server/routes/apply-codemod.js +2 -1
  21. package/dist/preview-server/routes/apply-visual-control-change.js +103 -5
  22. package/dist/preview-server/routes/can-update-default-props.d.ts +10 -3
  23. package/dist/preview-server/routes/can-update-default-props.js +138 -13
  24. package/dist/preview-server/routes/can-update-sequence-props.js +4 -0
  25. package/dist/preview-server/routes/log-update.d.ts +8 -0
  26. package/dist/preview-server/routes/log-update.js +60 -27
  27. package/dist/preview-server/routes/save-sequence-props.js +47 -5
  28. package/dist/preview-server/routes/update-default-props.js +41 -4
  29. package/dist/preview-server/sequence-props-watchers.js +4 -9
  30. package/dist/preview-server/start-server.js +16 -9
  31. package/dist/preview-server/undo-stack.d.ts +24 -4
  32. package/dist/preview-server/undo-stack.js +75 -11
  33. package/dist/preview-server/watch-ignore-next-change.d.ts +3 -0
  34. package/dist/preview-server/watch-ignore-next-change.js +12 -0
  35. package/dist/start-studio.js +3 -0
  36. package/package.json +6 -6
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.pushToUndoStack = pushToUndoStack;
7
+ exports.printUndoHint = printUndoHint;
4
8
  exports.pushToRedoStack = pushToRedoStack;
5
9
  exports.suppressUndoStackInvalidation = suppressUndoStackInvalidation;
6
10
  exports.popUndo = popUndo;
@@ -8,16 +12,22 @@ exports.popRedo = popRedo;
8
12
  exports.getUndoStack = getUndoStack;
9
13
  exports.getRedoStack = getRedoStack;
10
14
  const node_fs_1 = require("node:fs");
15
+ const node_path_1 = __importDefault(require("node:path"));
11
16
  const renderer_1 = require("@remotion/renderer");
17
+ const parse_ast_1 = require("../codemods/parse-ast");
18
+ const read_visual_control_values_1 = require("../codemods/read-visual-control-values");
12
19
  const file_watcher_1 = require("../file-watcher");
13
- const hmr_suppression_1 = require("./hmr-suppression");
20
+ const make_link_1 = require("../hyperlinks/make-link");
14
21
  const live_events_1 = require("./live-events");
22
+ const watch_ignore_next_change_1 = require("./watch-ignore-next-change");
15
23
  const MAX_ENTRIES = 100;
16
24
  const undoStack = [];
17
25
  const redoStack = [];
18
26
  const suppressedWrites = new Map();
19
27
  const watchers = new Map();
20
28
  let storedLogLevel = 'info';
29
+ let storedRemotionRoot = null;
30
+ let printedUndoHint = false;
21
31
  function broadcastState() {
22
32
  const undoFile = undoStack.length > 0 ? undoStack[undoStack.length - 1].filePath : null;
23
33
  const redoFile = redoStack.length > 0 ? redoStack[redoStack.length - 1].filePath : null;
@@ -29,9 +39,10 @@ function broadcastState() {
29
39
  });
30
40
  });
31
41
  }
32
- function pushToUndoStack(filePath, oldContents, logLevel) {
42
+ function pushToUndoStack({ filePath, oldContents, logLevel, remotionRoot, description, entryType, }) {
33
43
  storedLogLevel = logLevel;
34
- undoStack.push({ filePath, oldContents });
44
+ storedRemotionRoot = remotionRoot;
45
+ undoStack.push({ filePath, oldContents, description, entryType });
35
46
  if (undoStack.length > MAX_ENTRIES) {
36
47
  undoStack.shift();
37
48
  }
@@ -40,8 +51,15 @@ function pushToUndoStack(filePath, oldContents, logLevel) {
40
51
  ensureWatching(filePath);
41
52
  broadcastState();
42
53
  }
43
- function pushToRedoStack(filePath, oldContents) {
44
- redoStack.push({ filePath, oldContents });
54
+ function printUndoHint(logLevel) {
55
+ if (!printedUndoHint) {
56
+ printedUndoHint = true;
57
+ const shortcut = process.platform === 'darwin' ? 'Cmd+Z' : 'Ctrl+Z';
58
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray(`Tip: ${shortcut} in Studio to undo`));
59
+ }
60
+ }
61
+ function pushToRedoStack(filePath, oldContents, description, entryType) {
62
+ redoStack.push({ filePath, oldContents, description, entryType });
45
63
  if (redoStack.length > MAX_ENTRIES) {
46
64
  redoStack.shift();
47
65
  }
@@ -121,17 +139,54 @@ function cleanupWatchers() {
121
139
  }
122
140
  }
123
141
  }
142
+ function emitVisualControlChanges(fileContents) {
143
+ try {
144
+ const ast = (0, parse_ast_1.parseAst)(fileContents);
145
+ const values = (0, read_visual_control_values_1.readVisualControlValues)(ast);
146
+ if (values.length > 0) {
147
+ (0, live_events_1.waitForLiveEventsListener)().then((listener) => {
148
+ listener.sendEventToClient({
149
+ type: 'visual-control-values-changed',
150
+ values,
151
+ });
152
+ });
153
+ }
154
+ }
155
+ catch (_a) {
156
+ // File might not contain visual controls or might not be parseable
157
+ }
158
+ }
159
+ function logFileAction(action, filePath) {
160
+ const locationLabel = storedRemotionRoot
161
+ ? node_path_1.default.relative(storedRemotionRoot, filePath)
162
+ : filePath;
163
+ const fileLink = (0, make_link_1.makeHyperlink)({
164
+ url: `file://${filePath}`,
165
+ text: locationLabel,
166
+ fallback: locationLabel,
167
+ });
168
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel: storedLogLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${fileLink}:`)} ${action}`);
169
+ }
124
170
  function popUndo() {
125
171
  const entry = undoStack.pop();
126
172
  if (!entry) {
127
173
  return { success: false, reason: 'Nothing to undo' };
128
174
  }
129
175
  const currentContents = (0, node_fs_1.readFileSync)(entry.filePath, 'utf-8');
130
- redoStack.push({ filePath: entry.filePath, oldContents: currentContents });
176
+ redoStack.push({
177
+ filePath: entry.filePath,
178
+ oldContents: currentContents,
179
+ description: entry.description,
180
+ entryType: entry.entryType,
181
+ });
131
182
  suppressUndoStackInvalidation(entry.filePath);
132
- (0, hmr_suppression_1.suppressHmrForFile)(entry.filePath);
133
- (0, node_fs_1.writeFileSync)(entry.filePath, entry.oldContents);
183
+ (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(entry.filePath);
184
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)(entry.filePath, entry.oldContents);
134
185
  renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Undo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
186
+ logFileAction(entry.description.undoMessage, entry.filePath);
187
+ if (entry.entryType === 'visual-control') {
188
+ emitVisualControlChanges(entry.oldContents);
189
+ }
135
190
  ensureWatching(entry.filePath);
136
191
  broadcastState();
137
192
  return { success: true };
@@ -142,11 +197,20 @@ function popRedo() {
142
197
  return { success: false, reason: 'Nothing to redo' };
143
198
  }
144
199
  const currentContents = (0, node_fs_1.readFileSync)(entry.filePath, 'utf-8');
145
- undoStack.push({ filePath: entry.filePath, oldContents: currentContents });
200
+ undoStack.push({
201
+ filePath: entry.filePath,
202
+ oldContents: currentContents,
203
+ description: entry.description,
204
+ entryType: entry.entryType,
205
+ });
146
206
  suppressUndoStackInvalidation(entry.filePath);
147
- (0, hmr_suppression_1.suppressHmrForFile)(entry.filePath);
148
- (0, node_fs_1.writeFileSync)(entry.filePath, entry.oldContents);
207
+ (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(entry.filePath);
208
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)(entry.filePath, entry.oldContents);
149
209
  renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel: storedLogLevel }, renderer_1.RenderInternals.chalk.gray(`Redo: restored ${entry.filePath} (undo: ${undoStack.length}, redo: ${redoStack.length})`));
210
+ logFileAction(entry.description.redoMessage, entry.filePath);
211
+ if (entry.entryType === 'visual-control') {
212
+ emitVisualControlChanges(entry.oldContents);
213
+ }
150
214
  ensureWatching(entry.filePath);
151
215
  broadcastState();
152
216
  return { success: true };
@@ -0,0 +1,3 @@
1
+ import type { WatchIgnoreNextChangePlugin } from '@remotion/bundler';
2
+ export declare const setWatchIgnoreNextChangePlugin: (plugin: WatchIgnoreNextChangePlugin) => void;
3
+ export declare const suppressBundlerUpdateForFile: (absolutePath: string) => void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.suppressBundlerUpdateForFile = exports.setWatchIgnoreNextChangePlugin = void 0;
4
+ let currentPlugin = null;
5
+ const setWatchIgnoreNextChangePlugin = (plugin) => {
6
+ currentPlugin = plugin;
7
+ };
8
+ exports.setWatchIgnoreNextChangePlugin = setWatchIgnoreNextChangePlugin;
9
+ const suppressBundlerUpdateForFile = (absolutePath) => {
10
+ currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.ignoreNextChange(absolutePath);
11
+ };
12
+ exports.suppressBundlerUpdateForFile = suppressBundlerUpdateForFile;
@@ -8,6 +8,7 @@ const node_crypto_1 = __importDefault(require("node:crypto"));
8
8
  const node_fs_1 = require("node:fs");
9
9
  const node_path_1 = __importDefault(require("node:path"));
10
10
  const renderer_1 = require("@remotion/renderer");
11
+ const file_watcher_1 = require("./file-watcher");
11
12
  const get_network_address_1 = require("./get-network-address");
12
13
  const maybe_open_browser_1 = require("./maybe-open-browser");
13
14
  const close_and_restart_1 = require("./preview-server/close-and-restart");
@@ -30,6 +31,8 @@ const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEn
30
31
  }
31
32
  }
32
33
  catch (_a) { }
34
+ // Validate that the file watcher registry has been initialized
35
+ (0, file_watcher_1.getFileWatcherRegistry)();
33
36
  (0, watch_root_file_1.watchRootFile)(remotionRoot, previewEntry);
34
37
  const publicDir = (0, get_absolute_public_dir_1.getAbsolutePublicDir)({
35
38
  relativePublicDir,
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.438",
6
+ "version": "4.0.440",
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.438",
30
+ "remotion": "4.0.440",
31
31
  "recast": "0.23.11",
32
- "@remotion/bundler": "4.0.438",
33
- "@remotion/renderer": "4.0.438",
34
- "@remotion/studio-shared": "4.0.438",
32
+ "@remotion/bundler": "4.0.440",
33
+ "@remotion/renderer": "4.0.440",
34
+ "@remotion/studio-shared": "4.0.440",
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.438",
44
+ "@remotion/eslint-config-internal": "4.0.440",
45
45
  "eslint": "9.19.0",
46
46
  "@types/node": "20.12.14",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260217.1"