@remotion/studio-server 4.0.524 → 4.0.525

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 (43) hide show
  1. package/dist/codemods/add-effect.d.ts +1 -26
  2. package/dist/codemods/add-effect.js +6 -191
  3. package/dist/codemods/delete-effect.d.ts +1 -30
  4. package/dist/codemods/delete-effect.js +4 -126
  5. package/dist/codemods/duplicate-effect.d.ts +1 -26
  6. package/dist/codemods/duplicate-effect.js +4 -90
  7. package/dist/codemods/paste-effects.d.ts +9 -14
  8. package/dist/codemods/paste-effects.js +2 -170
  9. package/dist/codemods/reorder-effect.d.ts +1 -13
  10. package/dist/codemods/reorder-effect.js +2 -58
  11. package/dist/codemods/update-effect-props/update-effect-props.d.ts +2 -67
  12. package/dist/codemods/update-effect-props/update-effect-props.js +8 -312
  13. package/dist/codemods/update-keyframes/update-keyframes.js +2 -7
  14. package/dist/codemods/update-sequence-props/update-sequence-props.js +20 -58
  15. package/dist/helpers/resolve-composition-component.d.ts +2 -1
  16. package/dist/helpers/resolve-composition-component.js +13 -7
  17. package/dist/preview-server/api-routes.js +5 -0
  18. package/dist/preview-server/routes/add-keyframes.js +1 -0
  19. package/dist/preview-server/routes/apply-codemod.d.ts +19 -0
  20. package/dist/preview-server/routes/apply-codemod.js +17 -55
  21. package/dist/preview-server/routes/batch-update-keyframe-settings.js +1 -0
  22. package/dist/preview-server/routes/delete-keyframes.js +1 -0
  23. package/dist/preview-server/routes/duplicate-jsx-node.js +1 -0
  24. package/dist/preview-server/routes/insert-element.js +122 -19
  25. package/dist/preview-server/routes/insert-jsx-element.js +1 -0
  26. package/dist/preview-server/routes/install-remotion-skill.d.ts +4 -0
  27. package/dist/preview-server/routes/install-remotion-skill.js +108 -0
  28. package/dist/preview-server/routes/invalidate-bundle.d.ts +3 -0
  29. package/dist/preview-server/routes/invalidate-bundle.js +11 -0
  30. package/dist/preview-server/routes/move-keyframes.js +1 -0
  31. package/dist/preview-server/routes/save-multiple-effect-props.js +1 -0
  32. package/dist/preview-server/routes/save-sequence-props.js +1 -0
  33. package/dist/preview-server/undo-stack.d.ts +4 -2
  34. package/dist/preview-server/undo-stack.js +22 -4
  35. package/dist/preview-server/watch-ignore-next-change.d.ts +1 -0
  36. package/dist/preview-server/watch-ignore-next-change.js +20 -12
  37. package/package.json +8 -8
  38. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +0 -3
  39. package/dist/preview-server/routes/delete-effect-keyframe.js +0 -89
  40. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +0 -3
  41. package/dist/preview-server/routes/delete-sequence-keyframe.js +0 -82
  42. package/dist/preview-server/routes/save-props-mutex.d.ts +0 -1
  43. package/dist/preview-server/routes/save-props-mutex.js +0 -11
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.removeRemotionSkillHandler = exports.installRemotionSkillHandler = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ const renderer_1 = require("@remotion/renderer");
6
+ const package_manager_spawn_options_1 = require("../../helpers/package-manager-spawn-options");
7
+ const remotion_skill_names_1 = require("../../remotion-skill-names");
8
+ const get_package_manager_1 = require("../get-package-manager");
9
+ const remotion_skills_info_1 = require("./remotion-skills-info");
10
+ const changingSkillsInProjects = new Set();
11
+ const changeRemotionSkill = async ({ action, remotionRoot, input: { skill }, logLevel, }) => {
12
+ if (!remotion_skill_names_1.remotionSkillNames.some((name) => name === skill)) {
13
+ throw new Error(`Unknown Remotion skill: ${JSON.stringify(skill)}`);
14
+ }
15
+ if (changingSkillsInProjects.has(remotionRoot)) {
16
+ throw new Error('A skill is already being installed or removed. Please try again once it finishes.');
17
+ }
18
+ changingSkillsInProjects.add(remotionRoot);
19
+ try {
20
+ const installedSkill = (0, remotion_skills_info_1.getRemotionSkillsInfo)({ remotionRoot }).skills.find(({ name }) => name === skill);
21
+ const removingGlobally = action === 'remove' &&
22
+ (installedSkill === null || installedSkill === void 0 ? void 0 : installedSkill.installedInProject) === false &&
23
+ installedSkill.installedGlobally;
24
+ if (action === 'remove' &&
25
+ !removingGlobally &&
26
+ !(installedSkill === null || installedSkill === void 0 ? void 0 : installedSkill.installedInProject)) {
27
+ throw new Error(`${skill} is not installed.`);
28
+ }
29
+ const packageManager = (0, get_package_manager_1.getPackageManager)({
30
+ remotionRoot,
31
+ packageManager: undefined,
32
+ dirUp: 0,
33
+ logLevel,
34
+ });
35
+ const useBunx = packageManager !== 'unknown' && packageManager.manager === 'bun';
36
+ const executable = useBunx
37
+ ? 'bunx'
38
+ : process.platform === 'win32'
39
+ ? 'npx.cmd'
40
+ : 'npx';
41
+ const commandArgs = action === 'install'
42
+ ? ['add', `remotion-dev/skills@${skill}`, '--yes']
43
+ : ['remove', ...(removingGlobally ? ['--global'] : []), skill, '--yes'];
44
+ const args = useBunx
45
+ ? ['--silent', 'skills@1.5.26', ...commandArgs]
46
+ : ['--yes', '--loglevel=error', 'skills@1.5.26', ...commandArgs];
47
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray(`╭─ ${executable} ${args.join(' ')}`));
48
+ const time = Date.now();
49
+ try {
50
+ await new Promise((resolve, reject) => {
51
+ const child = (0, node_child_process_1.spawn)(executable, args, {
52
+ cwd: remotionRoot,
53
+ env: { ...process.env, DISABLE_TELEMETRY: '1' },
54
+ stdio: ['ignore', 'pipe', 'pipe'],
55
+ ...(0, package_manager_spawn_options_1.getPackageManagerSpawnOptions)(),
56
+ });
57
+ let output = '';
58
+ const onData = (data) => {
59
+ output = (output + data.toString()).slice(-8000);
60
+ data
61
+ .toString()
62
+ .trim()
63
+ .split('\n')
64
+ .forEach((line) => renderer_1.RenderInternals.Log.info({ indent: true, logLevel }, line));
65
+ };
66
+ child.stdout.on('data', onData);
67
+ child.stderr.on('data', onData);
68
+ child.on('error', reject);
69
+ child.on('close', (code, signal) => {
70
+ if (code === 0) {
71
+ resolve();
72
+ }
73
+ else {
74
+ reject(new Error(`Could not ${action} ${skill} (exit code ${code}, signal ${signal}). ${output.trim()}`));
75
+ }
76
+ });
77
+ });
78
+ const info = (0, remotion_skills_info_1.getRemotionSkillsInfo)({ remotionRoot });
79
+ const updatedSkill = info.skills.find(({ name }) => name === skill);
80
+ if (action === 'install' && !(updatedSkill === null || updatedSkill === void 0 ? void 0 : updatedSkill.installedInProject)) {
81
+ throw new Error(`The installer finished, but ${skill} was not found in the project. Please try again.`);
82
+ }
83
+ if (action === 'remove' &&
84
+ (removingGlobally
85
+ ? updatedSkill === null || updatedSkill === void 0 ? void 0 : updatedSkill.installedGlobally
86
+ : updatedSkill === null || updatedSkill === void 0 ? void 0 : updatedSkill.installedInProject)) {
87
+ throw new Error(`The remover finished, but ${skill} is still installed ${removingGlobally ? 'globally' : 'in the project'}. Please try again.`);
88
+ }
89
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray('╰─ '), `Done in ${Date.now() - time}ms`);
90
+ return info;
91
+ }
92
+ catch (error) {
93
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray('╰─ '), renderer_1.RenderInternals.chalk.red(`Errored in ${Date.now() - time}ms`));
94
+ throw error;
95
+ }
96
+ }
97
+ finally {
98
+ changingSkillsInProjects.delete(remotionRoot);
99
+ }
100
+ };
101
+ const installRemotionSkillHandler = (input) => {
102
+ return changeRemotionSkill({ ...input, action: 'install' });
103
+ };
104
+ exports.installRemotionSkillHandler = installRemotionSkillHandler;
105
+ const removeRemotionSkillHandler = (input) => {
106
+ return changeRemotionSkill({ ...input, action: 'remove' });
107
+ };
108
+ exports.removeRemotionSkillHandler = removeRemotionSkillHandler;
@@ -0,0 +1,3 @@
1
+ import type { ApiRoutes } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const invalidateBundleHandler: ApiHandler<ApiRoutes['/api/invalidate-bundle']['Request'], ApiRoutes['/api/invalidate-bundle']['Response']>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.invalidateBundleHandler = void 0;
4
+ const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
5
+ const source_file_write_queue_1 = require("./source-file-write-queue");
6
+ const invalidateBundleHandler = () => {
7
+ return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
8
+ return { didInvalidate: await (0, watch_ignore_next_change_1.invalidatePreviouslySuppressedFiles)() };
9
+ });
10
+ };
11
+ exports.invalidateBundleHandler = invalidateBundleHandler;
@@ -195,6 +195,7 @@ const moveKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, rem
195
195
  ? 'sequence-props'
196
196
  : 'effect-props',
197
197
  suppressHmrOnFileRestore: true,
198
+ undoRedoNavigation: null,
198
199
  });
199
200
  for (const snapshot of snapshots) {
200
201
  (0, undo_stack_1.suppressUndoStackInvalidation)(snapshot.filePath);
@@ -99,6 +99,7 @@ const saveMultipleEffectPropsHandler = ({ input: { edits, clientId, undoLabel, r
99
99
  },
100
100
  entryType: 'effect-props',
101
101
  suppressHmrOnFileRestore: true,
102
+ undoRedoNavigation: null,
102
103
  });
103
104
  for (const [absolutePath, output] of outputByPath) {
104
105
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
@@ -401,6 +401,7 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
401
401
  description: { undoMessage, redoMessage },
402
402
  entryType: 'sequence-props',
403
403
  suppressHmrOnFileRestore: suppressHmr,
404
+ undoRedoNavigation: null,
404
405
  });
405
406
  for (const [absolutePath, output] of outputByPath) {
406
407
  (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
@@ -1,5 +1,5 @@
1
1
  import type { LogLevel } from '@remotion/renderer';
2
- import type { RedoResponse, SequenceNodePathRemapping, UndoResponse } from '@remotion/studio-shared';
2
+ import type { RedoResponse, SequenceNodePathRemapping, UndoRedoNavigation, UndoResponse } from '@remotion/studio-shared';
3
3
  export interface UndoEntryDescription {
4
4
  undoMessage: string;
5
5
  redoMessage: string;
@@ -22,6 +22,7 @@ type UndoEntry = {
22
22
  /** When true, undo/redo file restores call `suppressBundlerUpdateForFile` (skip HMR refresh). */
23
23
  suppressHmrOnFileRestore: boolean;
24
24
  entryType: UndoEntryType;
25
+ undoRedoNavigation: UndoRedoNavigation | null;
25
26
  };
26
27
  export declare function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore, nodePathRemappings }: {
27
28
  filePath: string;
@@ -35,7 +36,7 @@ export declare function pushToUndoStack({ filePath, oldContents, newContents, lo
35
36
  suppressHmrOnFileRestore: boolean;
36
37
  nodePathRemappings: SequenceNodePathRemapping[] | null;
37
38
  }): void;
38
- export declare function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore }: {
39
+ export declare function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore, undoRedoNavigation }: {
39
40
  snapshots: Array<{
40
41
  filePath: string;
41
42
  oldContents: string | null;
@@ -48,6 +49,7 @@ export declare function pushTransactionToUndoStack({ snapshots, logLevel, remoti
48
49
  description: UndoEntryDescription;
49
50
  entryType: UndoEntryType;
50
51
  suppressHmrOnFileRestore: boolean;
52
+ undoRedoNavigation: UndoRedoNavigation | null;
51
53
  }): void;
52
54
  export declare function printUndoHint(logLevel: LogLevel): void;
53
55
  export declare function pushToRedoStack({ filePath, oldContents, newContents, logLine, description, entryType, suppressHmrOnFileRestore }: {
@@ -44,7 +44,7 @@ const entryTouchesFile = (entry, filePath) => {
44
44
  const getEntryFilePaths = (entry) => {
45
45
  return entry.snapshots.map((snapshot) => snapshot.filePath);
46
46
  };
47
- const makeUndoEntry = ({ snapshots, description, entryType, suppressHmrOnFileRestore, }) => {
47
+ const makeUndoEntry = ({ snapshots, description, entryType, suppressHmrOnFileRestore, undoRedoNavigation, }) => {
48
48
  if (snapshots.length === 0) {
49
49
  throw new Error('Cannot create an undo entry without snapshots');
50
50
  }
@@ -55,6 +55,7 @@ const makeUndoEntry = ({ snapshots, description, entryType, suppressHmrOnFileRes
55
55
  description,
56
56
  entryType,
57
57
  suppressHmrOnFileRestore,
58
+ undoRedoNavigation,
58
59
  };
59
60
  };
60
61
  function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotionRoot, logLine, description, entryType, suppressHmrOnFileRestore, nodePathRemappings, }) {
@@ -73,9 +74,10 @@ function pushToUndoStack({ filePath, oldContents, newContents, logLevel, remotio
73
74
  description,
74
75
  entryType,
75
76
  suppressHmrOnFileRestore,
77
+ undoRedoNavigation: null,
76
78
  });
77
79
  }
78
- function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore, }) {
80
+ function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, description, entryType, suppressHmrOnFileRestore, undoRedoNavigation, }) {
79
81
  storedLogLevel = logLevel;
80
82
  storedRemotionRoot = remotionRoot;
81
83
  const entry = makeUndoEntry({
@@ -83,6 +85,7 @@ function pushTransactionToUndoStack({ snapshots, logLevel, remotionRoot, descrip
83
85
  description,
84
86
  entryType,
85
87
  suppressHmrOnFileRestore,
88
+ undoRedoNavigation,
86
89
  });
87
90
  undoStack.push(entry);
88
91
  if (undoStack.length > MAX_ENTRIES) {
@@ -116,6 +119,7 @@ function pushToRedoStack({ filePath, oldContents, newContents, logLine, descript
116
119
  description,
117
120
  entryType,
118
121
  suppressHmrOnFileRestore,
122
+ undoRedoNavigation: null,
119
123
  });
120
124
  redoStack.push(entry);
121
125
  if (redoStack.length > MAX_ENTRIES) {
@@ -228,6 +232,8 @@ function logFileAction(action, filePath, logLine) {
228
232
  renderer_1.RenderInternals.Log.info({ indent: false, logLevel: storedLogLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${action}`);
229
233
  }
230
234
  function popUndo() {
235
+ var _a;
236
+ var _b;
231
237
  const entry = undoStack.pop();
232
238
  if (!entry) {
233
239
  return { success: false, reason: 'Nothing to undo' };
@@ -246,6 +252,7 @@ function popUndo() {
246
252
  description: entry.description,
247
253
  entryType: entry.entryType,
248
254
  suppressHmrOnFileRestore: entry.suppressHmrOnFileRestore,
255
+ undoRedoNavigation: entry.undoRedoNavigation,
249
256
  }));
250
257
  if (redoStack.length > MAX_ENTRIES) {
251
258
  redoStack.shift();
@@ -297,9 +304,15 @@ function popUndo() {
297
304
  ensureWatching(filePath);
298
305
  }
299
306
  broadcastState();
300
- return { success: true, nodePathMutation };
307
+ return {
308
+ success: true,
309
+ nodePathMutation,
310
+ route: (_b = (_a = entry.undoRedoNavigation) === null || _a === void 0 ? void 0 : _a.undoRoute) !== null && _b !== void 0 ? _b : null,
311
+ };
301
312
  }
302
313
  function popRedo() {
314
+ var _a;
315
+ var _b;
303
316
  const entry = redoStack.pop();
304
317
  if (!entry) {
305
318
  return { success: false, reason: 'Nothing to redo' };
@@ -319,6 +332,7 @@ function popRedo() {
319
332
  description: entry.description,
320
333
  entryType: entry.entryType,
321
334
  suppressHmrOnFileRestore: entry.suppressHmrOnFileRestore,
335
+ undoRedoNavigation: entry.undoRedoNavigation,
322
336
  }));
323
337
  if (undoStack.length > MAX_ENTRIES) {
324
338
  undoStack.shift();
@@ -362,7 +376,11 @@ function popRedo() {
362
376
  ensureWatching(filePath);
363
377
  }
364
378
  broadcastState();
365
- return { success: true, nodePathMutation };
379
+ return {
380
+ success: true,
381
+ nodePathMutation,
382
+ route: (_b = (_a = entry.undoRedoNavigation) === null || _a === void 0 ? void 0 : _a.redoRoute) !== null && _b !== void 0 ? _b : null,
383
+ };
366
384
  }
367
385
  /*
368
386
  * Keep stack accessors typed as readonly arrays so callers can only inspect
@@ -1,4 +1,5 @@
1
1
  import type { WatchIgnoreNextChangePlugin } from '@remotion/bundler';
2
2
  export declare const setWatchIgnoreNextChangePlugin: (plugin: WatchIgnoreNextChangePlugin) => void;
3
3
  export declare const suppressBundlerUpdateForFile: (absolutePath: string) => void;
4
+ export declare const invalidatePreviouslySuppressedFiles: () => Promise<boolean>;
4
5
  export declare const reloadPreviouslySuppressedFiles: () => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reloadPreviouslySuppressedFiles = exports.suppressBundlerUpdateForFile = exports.setWatchIgnoreNextChangePlugin = void 0;
3
+ exports.reloadPreviouslySuppressedFiles = exports.invalidatePreviouslySuppressedFiles = exports.suppressBundlerUpdateForFile = exports.setWatchIgnoreNextChangePlugin = void 0;
4
4
  const node_fs_1 = require("node:fs");
5
5
  let currentPlugin = null;
6
6
  const setWatchIgnoreNextChangePlugin = (plugin) => {
@@ -11,6 +11,24 @@ const suppressBundlerUpdateForFile = (absolutePath) => {
11
11
  currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.ignoreNextChange(absolutePath);
12
12
  };
13
13
  exports.suppressBundlerUpdateForFile = suppressBundlerUpdateForFile;
14
+ const invalidatePreviouslySuppressedFiles = async () => {
15
+ if (!currentPlugin) {
16
+ return false;
17
+ }
18
+ const files = currentPlugin.consumeSuppressedFilesForRebuild();
19
+ const now = new Date();
20
+ const touchedFiles = await Promise.all(files.map(async (file) => {
21
+ try {
22
+ await node_fs_1.promises.utimes(file, now, now);
23
+ return true;
24
+ }
25
+ catch (_a) {
26
+ return false;
27
+ }
28
+ }));
29
+ return touchedFiles.some(Boolean);
30
+ };
31
+ exports.invalidatePreviouslySuppressedFiles = invalidatePreviouslySuppressedFiles;
14
32
  // Why do we need this?
15
33
  // Consider we have a <Sequence>.
16
34
  // 1. In visual mode, we update it to layout='none'. This is reflected in the browser and in the code,
@@ -21,16 +39,6 @@ exports.suppressBundlerUpdateForFile = suppressBundlerUpdateForFile;
21
39
  // The same happens again - infinite loop!
22
40
  // --> When reloading the Studio, it is a good idea to reset Webpack to a non-hacked state.
23
41
  const reloadPreviouslySuppressedFiles = async () => {
24
- if (!currentPlugin) {
25
- return;
26
- }
27
- const files = currentPlugin.consumeSuppressedFilesHistory();
28
- const now = new Date();
29
- await Promise.all(files.map(async (file) => {
30
- try {
31
- await node_fs_1.promises.utimes(file, now, now);
32
- }
33
- catch (_a) { }
34
- }));
42
+ await (0, exports.invalidatePreviouslySuppressedFiles)();
35
43
  };
36
44
  exports.reloadPreviouslySuppressedFiles = reloadPreviouslySuppressedFiles;
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.524",
6
+ "version": "4.0.525",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "access": "public"
24
24
  },
25
25
  "dependencies": {
26
- "@remotion/studio-protocol": "4.0.524",
26
+ "@remotion/studio-protocol": "4.0.525",
27
27
  "@babel/types": "7.24.0",
28
28
  "@babel/parser": "7.24.1",
29
29
  "@svgr/core": "8.1.0",
@@ -32,12 +32,12 @@
32
32
  "semver": "7.5.3",
33
33
  "zod": "4.5.4",
34
34
  "prettier": "3.8.1",
35
- "remotion": "4.0.524",
35
+ "remotion": "4.0.525",
36
36
  "recast": "0.23.21",
37
- "@remotion/bundler": "4.0.524",
38
- "@remotion/renderer": "4.0.524",
39
- "@remotion/studio-codemods": "4.0.524",
40
- "@remotion/studio-shared": "4.0.524",
37
+ "@remotion/bundler": "4.0.525",
38
+ "@remotion/renderer": "4.0.525",
39
+ "@remotion/studio-codemods": "4.0.525",
40
+ "@remotion/studio-shared": "4.0.525",
41
41
  "memfs": "3.4.3",
42
42
  "open": "8.4.2"
43
43
  },
@@ -45,7 +45,7 @@
45
45
  "ast-types": "0.16.1",
46
46
  "react": "19.2.3",
47
47
  "@types/semver": "7.5.3",
48
- "@remotion/eslint-config-internal": "4.0.524",
48
+ "@remotion/eslint-config-internal": "4.0.525",
49
49
  "eslint": "9.19.0",
50
50
  "@types/node": "20.12.14",
51
51
  "@typescript/native-preview": "7.0.0-dev.20260217.1"
@@ -1,3 +0,0 @@
1
- import type { DeleteEffectKeyframeRequest, DeleteEffectKeyframeResponse } from '@remotion/studio-shared';
2
- import type { ApiHandler } from '../api-types';
3
- export declare const deleteEffectKeyframeHandler: ApiHandler<DeleteEffectKeyframeRequest, DeleteEffectKeyframeResponse>;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteEffectKeyframeHandler = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const renderer_1 = require("@remotion/renderer");
6
- const studio_shared_1 = require("@remotion/studio-shared");
7
- const parse_ast_1 = require("../../codemods/parse-ast");
8
- const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
9
- const file_watcher_1 = require("../../file-watcher");
10
- const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
11
- const undo_stack_1 = require("../undo-stack");
12
- const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
13
- const can_update_effect_props_1 = require("./can-update-effect-props");
14
- const can_update_sequence_props_1 = require("./can-update-sequence-props");
15
- const log_effect_update_1 = require("./log-updates/log-effect-update");
16
- const save_props_mutex_1 = require("./save-props-mutex");
17
- const deleteEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectIndex, key, frame, schema, clientId, }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
18
- renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[delete-effect-keyframe] Received request for fileName="${fileName}" effectIndex=${effectIndex} key="${key}" frame=${frame}`);
19
- const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
20
- remotionRoot,
21
- fileName,
22
- action: 'modify',
23
- });
24
- const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
25
- const { output, oldValueStrings, newValueStrings, formatted, logLine, effectCallee, } = await (0, update_keyframes_1.updateEffectKeyframes)({
26
- input: fileContents,
27
- sequenceNodePath: sequenceNodePath.nodePath,
28
- effectIndex,
29
- updates: [
30
- {
31
- key,
32
- operation: {
33
- type: 'remove',
34
- frame,
35
- },
36
- },
37
- ],
38
- });
39
- const oldValueString = oldValueStrings[0];
40
- const newValueString = newValueStrings[0];
41
- const undoPropChange = `${key} keyframe restored at frame ${frame}`;
42
- const redoPropChange = `${key} keyframe deleted at frame ${frame}`;
43
- (0, undo_stack_1.pushToUndoStack)({
44
- filePath: absolutePath,
45
- oldContents: fileContents,
46
- newContents: null,
47
- logLevel,
48
- remotionRoot,
49
- logLine,
50
- description: {
51
- undoMessage: `↩️ ${undoPropChange}`,
52
- redoMessage: `↪️ ${redoPropChange}`,
53
- },
54
- entryType: 'effect-props',
55
- suppressHmrOnFileRestore: true,
56
- });
57
- (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
58
- (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
59
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
60
- (0, log_effect_update_1.logEffectUpdate)({
61
- fileRelativeToRoot,
62
- line: logLine,
63
- effectName: effectCallee,
64
- propKey: key,
65
- oldValueString,
66
- newValueString,
67
- defaultValueString: null,
68
- formatted,
69
- logLevel,
70
- removedProps: [],
71
- addedProps: [],
72
- });
73
- (0, undo_stack_1.printUndoHint)(logLevel);
74
- const ast = (0, parse_ast_1.parseAst)((0, node_fs_1.readFileSync)(absolutePath, 'utf-8'));
75
- const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath.nodePath);
76
- if (!jsx) {
77
- return {
78
- canUpdate: false,
79
- effectIndex,
80
- reason: 'not-found',
81
- };
82
- }
83
- return (0, can_update_effect_props_1.computeEffectPropStatus)({
84
- jsx,
85
- effectIndex,
86
- keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
87
- });
88
- });
89
- exports.deleteEffectKeyframeHandler = deleteEffectKeyframeHandler;
@@ -1,3 +0,0 @@
1
- import type { DeleteSequenceKeyframeRequest, DeleteSequenceKeyframeResponse } from '@remotion/studio-shared';
2
- import type { ApiHandler } from '../api-types';
3
- export declare const deleteSequenceKeyframeHandler: ApiHandler<DeleteSequenceKeyframeRequest, DeleteSequenceKeyframeResponse>;
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteSequenceKeyframeHandler = void 0;
4
- const node_fs_1 = require("node:fs");
5
- const renderer_1 = require("@remotion/renderer");
6
- const studio_shared_1 = require("@remotion/studio-shared");
7
- const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
8
- const file_watcher_1 = require("../../file-watcher");
9
- const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
10
- const undo_stack_1 = require("../undo-stack");
11
- const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
12
- const can_update_sequence_props_1 = require("./can-update-sequence-props");
13
- const log_update_1 = require("./log-updates/log-update");
14
- const save_props_mutex_1 = require("./save-props-mutex");
15
- const deleteSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, schema, clientId }, remotionRoot, logLevel, }) => (0, save_props_mutex_1.withSavePropsLock)(async () => {
16
- renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[delete-sequence-keyframe] Received request for fileName="${fileName}" key="${key}" frame=${frame}`);
17
- const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
18
- remotionRoot,
19
- fileName,
20
- action: 'modify',
21
- });
22
- const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
23
- const { output, oldValueStrings, newValueStrings, formatted, logLine } = await (0, update_keyframes_1.updateSequenceKeyframes)({
24
- input: fileContents,
25
- nodePath: nodePath.nodePath,
26
- updates: [
27
- {
28
- key,
29
- operation: {
30
- type: 'remove',
31
- frame,
32
- },
33
- },
34
- ],
35
- });
36
- const oldValueString = oldValueStrings[0];
37
- const newValueString = newValueStrings[0];
38
- const undoPropChange = `${key} keyframe restored at frame ${frame}`;
39
- const redoPropChange = `${key} keyframe deleted at frame ${frame}`;
40
- (0, undo_stack_1.pushToUndoStack)({
41
- filePath: absolutePath,
42
- oldContents: fileContents,
43
- newContents: null,
44
- logLevel,
45
- remotionRoot,
46
- logLine,
47
- description: {
48
- undoMessage: `↩️ ${undoPropChange}`,
49
- redoMessage: `↪️ ${redoPropChange}`,
50
- },
51
- entryType: 'sequence-props',
52
- suppressHmrOnFileRestore: true,
53
- });
54
- (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
55
- (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
56
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output, clientId);
57
- (0, log_update_1.logUpdate)({
58
- fileRelativeToRoot,
59
- line: logLine,
60
- key,
61
- oldValueString,
62
- newValueString,
63
- defaultValueString: null,
64
- formatted,
65
- logLevel,
66
- removedProps: [],
67
- addedProps: [],
68
- });
69
- (0, undo_stack_1.printUndoHint)(logLevel);
70
- const status = (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
71
- fileContents: output,
72
- keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
73
- nodePath: nodePath.nodePath,
74
- effects: [],
75
- });
76
- return {
77
- canUpdate: true,
78
- props: status.props,
79
- results: [{ fileName, nodePath, props: status.props }],
80
- };
81
- });
82
- exports.deleteSequenceKeyframeHandler = deleteSequenceKeyframeHandler;
@@ -1 +0,0 @@
1
- export declare const withSavePropsLock: <T>(fn: () => Promise<T>) => Promise<T>;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.withSavePropsLock = void 0;
4
- let chain = Promise.resolve();
5
- const withSavePropsLock = (fn) => {
6
- const run = () => fn();
7
- const next = chain.then(run, run);
8
- chain = next.then(() => undefined, () => undefined);
9
- return next;
10
- };
11
- exports.withSavePropsLock = withSavePropsLock;