@remotion/studio-server 4.0.533 → 4.0.535

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 (68) hide show
  1. package/dist/detect-outdated-remotion-skills.d.ts +4 -0
  2. package/dist/detect-outdated-remotion-skills.js +3 -2
  3. package/dist/file-watcher.js +2 -0
  4. package/dist/helpers/app-discovery.d.ts +9 -0
  5. package/dist/helpers/app-discovery.js +61 -0
  6. package/dist/helpers/coding-agent-registry.d.ts +1 -0
  7. package/dist/helpers/coding-agent-registry.js +22 -1
  8. package/dist/helpers/editor-registry.d.ts +1 -0
  9. package/dist/helpers/editor-registry.js +24 -1
  10. package/dist/helpers/open-in-app.d.ts +13 -0
  11. package/dist/helpers/open-in-app.js +72 -0
  12. package/dist/helpers/open-in-editor.d.ts +1 -1
  13. package/dist/helpers/open-in-editor.js +67 -84
  14. package/dist/helpers/recently-used-apps.d.ts +9 -0
  15. package/dist/helpers/recently-used-apps.js +63 -0
  16. package/dist/helpers/running-processes.d.ts +12 -0
  17. package/dist/helpers/running-processes.js +88 -0
  18. package/dist/helpers/video-config-numeric-expression.js +29 -20
  19. package/dist/helpers/video-config-values.d.ts +6 -3
  20. package/dist/helpers/video-config-values.js +42 -26
  21. package/dist/preview-server/api-routes.js +8 -5
  22. package/dist/preview-server/live-events.d.ts +1 -0
  23. package/dist/preview-server/live-events.js +12 -1
  24. package/dist/preview-server/routes/add-sequence-keyframe.js +0 -1
  25. package/dist/preview-server/routes/app-info.d.ts +3 -0
  26. package/dist/preview-server/routes/app-info.js +16 -0
  27. package/dist/preview-server/routes/can-update-effect-props.d.ts +4 -6
  28. package/dist/preview-server/routes/can-update-effect-props.js +5 -28
  29. package/dist/preview-server/routes/can-update-sequence-props.d.ts +6 -8
  30. package/dist/preview-server/routes/can-update-sequence-props.js +11 -12
  31. package/dist/preview-server/routes/default-coding-agent.d.ts +1 -2
  32. package/dist/preview-server/routes/default-coding-agent.js +11 -19
  33. package/dist/preview-server/routes/default-editor.js +9 -29
  34. package/dist/preview-server/routes/delete-keyframes.d.ts +2 -2
  35. package/dist/preview-server/routes/delete-keyframes.js +0 -1
  36. package/dist/preview-server/routes/element-install-plan.js +5 -0
  37. package/dist/preview-server/routes/insert-basic-captions.js +1 -0
  38. package/dist/preview-server/routes/insert-element.js +63 -20
  39. package/dist/preview-server/routes/install-remotion-skill.d.ts +2 -1
  40. package/dist/preview-server/routes/install-remotion-skill.js +87 -56
  41. package/dist/preview-server/routes/open-in-editor.d.ts +1 -1
  42. package/dist/preview-server/routes/open-in-editor.js +2 -56
  43. package/dist/preview-server/routes/redo.js +2 -1
  44. package/dist/preview-server/routes/remotion-skills-info.d.ts +2 -1
  45. package/dist/preview-server/routes/remotion-skills-info.js +57 -3
  46. package/dist/preview-server/routes/save-sequence-props.js +0 -1
  47. package/dist/preview-server/routes/shared-memory-capture-support.d.ts +3 -0
  48. package/dist/preview-server/routes/shared-memory-capture-support.js +13 -0
  49. package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -1
  50. package/dist/preview-server/routes/subscribe-to-sequence-props.js +1 -2
  51. package/dist/preview-server/routes/undo.js +2 -1
  52. package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +0 -1
  53. package/dist/preview-server/routes/update-config.js +12 -5
  54. package/dist/preview-server/routes/update-sequence-keyframe-settings.js +0 -1
  55. package/dist/preview-server/routes/wrap-node.js +13 -4
  56. package/dist/preview-server/sequence-props-watchers.d.ts +3 -5
  57. package/dist/preview-server/sequence-props-watchers.js +9 -17
  58. package/dist/preview-server/studio-protocol/handle-element-library.js +14 -0
  59. package/dist/preview-server/studio-protocol/handle-install.js +2 -1
  60. package/dist/preview-server/undo-stack.js +1 -0
  61. package/dist/preview-server/update-available.js +17 -0
  62. package/dist/preview-server/watch-ignore-next-change.d.ts +1 -0
  63. package/dist/preview-server/watch-ignore-next-change.js +15 -2
  64. package/dist/routes.js +3 -1
  65. package/dist/start-studio.js +13 -6
  66. package/dist/studio-shortcuts.d.ts +13 -0
  67. package/dist/studio-shortcuts.js +257 -0
  68. package/package.json +8 -8
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRunningProcesses = exports.isAppRunning = void 0;
4
+ const node_child_process_1 = require("node:child_process");
5
+ const node_util_1 = require("node:util");
6
+ const execFilePromise = (0, node_util_1.promisify)(node_child_process_1.execFile);
7
+ let processSnapshot = null;
8
+ const isAppRunning = ({ processes, executablePath, commands, platform, }) => {
9
+ if (platform === 'darwin') {
10
+ const applicationPath = executablePath.split('/Contents/')[0];
11
+ if (applicationPath.endsWith('.app')) {
12
+ return processes.some(({ executable }) => executable === null || executable === void 0 ? void 0 : executable.startsWith(`${applicationPath}/Contents/MacOS/`));
13
+ }
14
+ }
15
+ const escapedCommands = commands.map((command) => command.replace(/\.(exe|cmd)$/i, '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'));
16
+ const escapedPath = executablePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
17
+ const executablePattern = new RegExp(`^"?(?:${escapedPath}|(?:[^"\\s]*[/\\\\])?(?:${escapedCommands.join('|')})(?:\\.(?:exe|cmd|js))?)"?(?=\\s|$)`, platform === 'win32' ? 'i' : '');
18
+ return processes.some(({ executable, commandLine }) => {
19
+ // Windows terminal launches put the app after the command interpreter.
20
+ const withoutCmd = (commandLine !== null && commandLine !== void 0 ? commandLine : '').replace(/^(?:"[^"\r\n]*[/\\]cmd(?:\.exe)?"|(?:[^\s"]*[/\\])?cmd(?:\.exe)?)\s+\/[ck]\s+/i, '');
21
+ // Node-based CLIs put the script after the interpreter path.
22
+ const withoutNode = withoutCmd.replace(/^(?:"[^"\r\n]*[/\\]node(?:\.exe)?"|(?:[^\s"]*[/\\])?node(?:\.exe)?)\s+/i, '');
23
+ return (executablePattern.test(executable !== null && executable !== void 0 ? executable : '') ||
24
+ executablePattern.test(withoutNode));
25
+ });
26
+ };
27
+ exports.isAppRunning = isAppRunning;
28
+ const getRunningProcesses = () => {
29
+ if (processSnapshot !== null && processSnapshot.expiresAt > Date.now()) {
30
+ return processSnapshot.promise;
31
+ }
32
+ const snapshot = {
33
+ expiresAt: Infinity,
34
+ promise: (async () => {
35
+ try {
36
+ if (process.platform === 'win32') {
37
+ const { stdout } = await execFilePromise('powershell.exe', [
38
+ '-NoProfile',
39
+ '-NonInteractive',
40
+ '-Command',
41
+ 'ConvertTo-Json -Compress -InputObject @(Get-CimInstance Win32_Process | Select-Object ExecutablePath, CommandLine)',
42
+ ], { timeout: 5000 });
43
+ const processes = JSON.parse(stdout);
44
+ return processes.map(({ ExecutablePath, CommandLine }) => ({
45
+ executable: ExecutablePath,
46
+ commandLine: CommandLine,
47
+ }));
48
+ }
49
+ if (process.platform === 'darwin') {
50
+ const { stdout } = await execFilePromise('ps', ['-ax', '-o', 'comm='], {
51
+ timeout: 5000,
52
+ });
53
+ return stdout
54
+ .split('\n')
55
+ .filter(Boolean)
56
+ .map((line) => ({
57
+ executable: line.trim(),
58
+ commandLine: null,
59
+ }));
60
+ }
61
+ if (process.platform === 'linux') {
62
+ // Use a fixed-width name column to preserve spaces in both fields.
63
+ const executableWidth = 64;
64
+ const { stdout } = await execFilePromise('ps', ['-e', '-ww', '-o', `comm:${executableWidth}=`, '-o', 'args='], { timeout: 5000 });
65
+ return stdout
66
+ .split('\n')
67
+ .filter(Boolean)
68
+ .map((line) => ({
69
+ executable: line.slice(0, executableWidth).trim(),
70
+ commandLine: line.slice(executableWidth).trim(),
71
+ }));
72
+ }
73
+ }
74
+ catch (_a) {
75
+ return null;
76
+ }
77
+ return null;
78
+ })(),
79
+ };
80
+ processSnapshot = snapshot;
81
+ // Share the in-flight query and its result across nearby editor and agent
82
+ // requests, but refresh it when Studio is revisited later.
83
+ snapshot.promise.then(() => {
84
+ snapshot.expiresAt = Date.now() + 1000;
85
+ });
86
+ return snapshot.promise;
87
+ };
88
+ exports.getRunningProcesses = getRunningProcesses;
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.updateVideoConfigNumericExpression = exports.parseVideoConfigNumericExpression = void 0;
37
37
  const recast = __importStar(require("recast"));
38
+ const no_react_1 = require("remotion/no-react");
38
39
  const b = recast.types.builders;
39
40
  const getNumericLiteral = (node) => {
40
41
  if (node.type === 'NumericLiteral') {
@@ -61,11 +62,13 @@ const getVideoConfigValue = ({ node, videoConfigValues, }) => {
61
62
  if (node.type !== 'Identifier') {
62
63
  return null;
63
64
  }
64
- const value = videoConfigValues[node.name];
65
- if (value === undefined || !Number.isFinite(value)) {
65
+ const binding = videoConfigValues instanceof Map
66
+ ? videoConfigValues.get(node)
67
+ : videoConfigValues[node.name];
68
+ if (binding === undefined) {
66
69
  return null;
67
70
  }
68
- return { identifier: node.name, value };
71
+ return { identifier: node.name, binding };
69
72
  };
70
73
  const parseVideoConfigNumericExpression = ({ node, videoConfigValues, }) => {
71
74
  if (node.type === 'TSAsExpression') {
@@ -96,16 +99,11 @@ const parseVideoConfigNumericExpression = ({ node, videoConfigValues, }) => {
96
99
  if (minuend === null || subtrahend === null) {
97
100
  return null;
98
101
  }
99
- const resolvedValue = minuend.value - subtrahend;
100
- if (!Number.isFinite(resolvedValue)) {
101
- return null;
102
- }
103
102
  return {
104
103
  type: 'video-config-subtraction',
105
104
  identifier: minuend.identifier,
106
- minuend: minuend.value,
105
+ binding: minuend.binding,
107
106
  subtrahend,
108
- value: resolvedValue,
109
107
  };
110
108
  }
111
109
  if (node.operator !== '*') {
@@ -131,17 +129,12 @@ const parseVideoConfigNumericExpression = ({ node, videoConfigValues, }) => {
131
129
  }
132
130
  const multiplier = factorPosition === 'left' ? leftNumber : rightNumber;
133
131
  const configValue = factorPosition === 'left' ? rightVideoConfig : leftVideoConfig;
134
- const value = multiplier * configValue.value;
135
- if (!Number.isFinite(value)) {
136
- return null;
137
- }
138
132
  return {
139
133
  type: 'video-config-multiplication',
140
134
  identifier: configValue.identifier,
141
135
  multiplier,
142
- multiplicand: configValue.value,
136
+ binding: configValue.binding,
143
137
  factorPosition,
144
- value,
145
138
  };
146
139
  };
147
140
  exports.parseVideoConfigNumericExpression = parseVideoConfigNumericExpression;
@@ -156,13 +149,21 @@ const updateVideoConfigNumericExpression = ({ expression, value, }) => {
156
149
  return numericExpression(value);
157
150
  }
158
151
  if (expression.type === 'video-config-value') {
159
- return value === expression.value
152
+ return value ===
153
+ no_react_1.NoReactInternals.evaluateSourceNumericValue(expression, null)
160
154
  ? b.identifier(expression.identifier)
161
155
  : numericExpression(value);
162
156
  }
163
157
  if (expression.type === 'video-config-subtraction') {
164
- const subtrahend = expression.minuend - value;
165
- if (!Number.isFinite(subtrahend)) {
158
+ const subtrahend = (expression.binding.type === 'constant'
159
+ ? expression.binding.value
160
+ : NaN) - value;
161
+ if (!Number.isFinite(subtrahend) ||
162
+ (expression.binding.type === 'constant'
163
+ ? expression.binding.value
164
+ : NaN) -
165
+ subtrahend !==
166
+ value) {
166
167
  return numericExpression(value);
167
168
  }
168
169
  return b.binaryExpression('-', b.identifier(expression.identifier), numericExpression(subtrahend));
@@ -170,8 +171,16 @@ const updateVideoConfigNumericExpression = ({ expression, value, }) => {
170
171
  if (expression.type !== 'video-config-multiplication' || value === 0) {
171
172
  return numericExpression(value);
172
173
  }
173
- const multiplier = value / expression.multiplicand;
174
- if (!Number.isFinite(multiplier) || multiplier === 0) {
174
+ const multiplier = value /
175
+ (expression.binding.type === 'constant' ? expression.binding.value : NaN);
176
+ // Preserve the expression only if evaluating it reproduces the requested value.
177
+ if (!Number.isFinite(multiplier) ||
178
+ multiplier === 0 ||
179
+ multiplier *
180
+ (expression.binding.type === 'constant'
181
+ ? expression.binding.value
182
+ : NaN) !==
183
+ value) {
175
184
  return numericExpression(value);
176
185
  }
177
186
  const factor = numericExpression(multiplier);
@@ -1,6 +1,9 @@
1
- import type { File } from '@babel/types';
2
- import type { VideoConfigValues } from 'remotion';
3
- export type VideoConfigIdentifierValues = Record<string, number>;
1
+ import type { File, Identifier } from '@babel/types';
2
+ import type { VideoConfigNumericBinding, VideoConfigValues } from 'remotion';
3
+ export type VideoConfigIdentifierValues = Map<Identifier, VideoConfigNumericBinding> | Record<string, VideoConfigNumericBinding>;
4
+ export declare const getVideoConfigIdentifiers: ({ ast, }: {
5
+ ast: File;
6
+ }) => Map<Identifier, VideoConfigNumericBinding>;
4
7
  export declare const getVideoConfigIdentifierValues: ({ ast, videoConfigValues, }: {
5
8
  ast: File;
6
9
  videoConfigValues: VideoConfigValues | null;
@@ -33,24 +33,14 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.getVideoConfigIdentifierValues = void 0;
36
+ exports.getVideoConfigIdentifierValues = exports.getVideoConfigIdentifiers = void 0;
37
37
  const recast = __importStar(require("recast"));
38
- const getVideoConfigIdentifierValues = ({ ast, videoConfigValues, }) => {
38
+ const getVideoConfigIdentifiers = ({ ast, }) => {
39
39
  const candidates = new Map();
40
- const otherDeclarations = new Set();
41
- const addCandidate = (identifier, value) => {
42
- if (candidates.has(identifier) || otherDeclarations.has(identifier)) {
43
- candidates.delete(identifier);
44
- otherDeclarations.add(identifier);
45
- return;
46
- }
47
- candidates.set(identifier, value);
48
- };
49
40
  recast.types.visit(ast, {
50
41
  visitVariableDeclarator(path) {
51
42
  const { id, init } = path.node;
52
- const isVideoConfigDeclaration = videoConfigValues !== null &&
53
- id.type === 'ObjectPattern' &&
43
+ const isVideoConfigDeclaration = id.type === 'ObjectPattern' &&
54
44
  (init === null || init === void 0 ? void 0 : init.type) === 'CallExpression' &&
55
45
  init.callee.type === 'Identifier' &&
56
46
  init.callee.name === 'useVideoConfig' &&
@@ -67,13 +57,16 @@ const getVideoConfigIdentifierValues = ({ ast, videoConfigValues, }) => {
67
57
  : property.key.type === 'StringLiteral'
68
58
  ? property.key.value
69
59
  : null;
70
- if (configKey === null || !(configKey in videoConfigValues)) {
60
+ if (configKey !== 'durationInFrames' &&
61
+ configKey !== 'fps' &&
62
+ configKey !== 'width' &&
63
+ configKey !== 'height') {
71
64
  continue;
72
65
  }
73
- const value = videoConfigValues[configKey];
74
- if (Number.isFinite(value)) {
75
- addCandidate(property.value.name, value);
76
- }
66
+ candidates.set(property.value, {
67
+ type: 'video-config',
68
+ field: configKey,
69
+ });
77
70
  }
78
71
  }
79
72
  else if (id.type === 'Identifier') {
@@ -85,19 +78,42 @@ const getVideoConfigIdentifierValues = ({ ast, videoConfigValues, }) => {
85
78
  ? init.value
86
79
  : null;
87
80
  if (numericConstant !== null) {
88
- addCandidate(id.name, numericConstant);
81
+ candidates.set(id, {
82
+ type: 'constant',
83
+ value: numericConstant,
84
+ });
89
85
  }
90
- else {
91
- candidates.delete(id.name);
92
- otherDeclarations.add(id.name);
86
+ }
87
+ this.traverse(path);
88
+ },
89
+ });
90
+ // Resolve each reference to its declaration. Components may independently
91
+ // declare the same name, while parameters and other shadowing stay computed.
92
+ const bindings = new Map();
93
+ recast.types.visit(ast, {
94
+ visitIdentifier(path) {
95
+ var _a;
96
+ var _b;
97
+ const declarations = (_b = (_a = path.scope.lookup(path.node.name)) === null || _a === void 0 ? void 0 : _a.getBindings()[path.node.name]) !== null && _b !== void 0 ? _b : [];
98
+ if (declarations.length === 1) {
99
+ const binding = candidates.get(declarations[0].node);
100
+ if (binding !== undefined) {
101
+ bindings.set(path.node, binding);
93
102
  }
94
103
  }
95
104
  this.traverse(path);
96
105
  },
97
106
  });
98
- for (const identifier of otherDeclarations) {
99
- candidates.delete(identifier);
100
- }
101
- return Object.fromEntries(candidates);
107
+ return bindings;
102
108
  };
109
+ exports.getVideoConfigIdentifiers = getVideoConfigIdentifiers;
110
+ // Editing uses the current instance's configuration supplied with the mutation.
111
+ const getVideoConfigIdentifierValues = ({ ast, videoConfigValues, }) => new Map([...(0, exports.getVideoConfigIdentifiers)({ ast })].flatMap(([identifier, binding]) => {
112
+ if (binding.type === 'constant')
113
+ return [[identifier, binding]];
114
+ const value = videoConfigValues === null || videoConfigValues === void 0 ? void 0 : videoConfigValues[binding.field];
115
+ return value === undefined || !Number.isFinite(value)
116
+ ? []
117
+ : [[identifier, { type: 'constant', value }]];
118
+ }));
103
119
  exports.getVideoConfigIdentifierValues = getVideoConfigIdentifierValues;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.allApiRoutes = void 0;
4
+ const open_in_app_1 = require("../helpers/open-in-app");
4
5
  const add_composition_1 = require("./routes/add-composition");
5
6
  const add_effect_1 = require("./routes/add-effect");
6
7
  const add_effect_keyframe_1 = require("./routes/add-effect-keyframe");
@@ -8,14 +9,13 @@ const add_folder_1 = require("./routes/add-folder");
8
9
  const add_keyframes_1 = require("./routes/add-keyframes");
9
10
  const add_render_1 = require("./routes/add-render");
10
11
  const add_sequence_keyframe_1 = require("./routes/add-sequence-keyframe");
12
+ const app_info_1 = require("./routes/app-info");
11
13
  const apply_visual_control_change_1 = require("./routes/apply-visual-control-change");
12
14
  const batch_update_keyframe_settings_1 = require("./routes/batch-update-keyframe-settings");
13
15
  const cancel_render_1 = require("./routes/cancel-render");
14
16
  const composition_component_info_1 = require("./routes/composition-component-info");
15
17
  const convert_figma_clipboard_to_svg_1 = require("./routes/convert-figma-clipboard-to-svg");
16
18
  const copy_render_output_to_asset_1 = require("./routes/copy-render-output-to-asset");
17
- const default_coding_agent_1 = require("./routes/default-coding-agent");
18
- const default_editor_1 = require("./routes/default-editor");
19
19
  const delete_composition_1 = require("./routes/delete-composition");
20
20
  const delete_effect_1 = require("./routes/delete-effect");
21
21
  const delete_keyframes_1 = require("./routes/delete-keyframes");
@@ -58,6 +58,7 @@ const restart_studio_1 = require("./routes/restart-studio");
58
58
  const save_effect_props_1 = require("./routes/save-effect-props");
59
59
  const save_multiple_effect_props_1 = require("./routes/save-multiple-effect-props");
60
60
  const save_sequence_props_1 = require("./routes/save-sequence-props");
61
+ const shared_memory_capture_support_1 = require("./routes/shared-memory-capture-support");
61
62
  const shutdown_studio_1 = require("./routes/shutdown-studio");
62
63
  const split_sequences_1 = require("./routes/split-sequences");
63
64
  const split_video_from_audio_1 = require("./routes/split-video-from-audio");
@@ -79,6 +80,7 @@ const update_sequence_keyframe_settings_1 = require("./routes/update-sequence-ke
79
80
  const upgrade_remotion_1 = require("./routes/upgrade-remotion");
80
81
  const wrap_node_1 = require("./routes/wrap-node");
81
82
  exports.allApiRoutes = {
83
+ '/api/shared-memory-capture-support': shared_memory_capture_support_1.sharedMemoryCaptureSupportHandler,
82
84
  '/api/invalidate-bundle': invalidate_bundle_1.invalidateBundleHandler,
83
85
  '/api/composition-component-info': composition_component_info_1.compositionComponentInfoHandler,
84
86
  '/api/copy-render-output-to-asset': copy_render_output_to_asset_1.copyRenderOutputToAssetHandler,
@@ -93,7 +95,7 @@ exports.allApiRoutes = {
93
95
  '/api/open-in-terminal': open_in_terminal_1.openInTerminalHandler,
94
96
  '/api/open-in-git-client': open_in_git_client_1.openInGitClientHandler,
95
97
  '/api/open-in-editor': open_in_editor_1.openInEditorHandler,
96
- '/api/open-in-coding-agent': default_coding_agent_1.openInCodingAgentHandler,
98
+ '/api/open-in-coding-agent': open_in_app_1.openInCodingAgent,
97
99
  '/api/register-client-render': register_client_render_1.registerClientRenderHandler,
98
100
  '/api/unregister-client-render': unregister_client_render_1.unregisterClientRenderHandler,
99
101
  '/api/update-default-props': update_default_props_1.updateDefaultPropsHandler,
@@ -142,14 +144,15 @@ exports.allApiRoutes = {
142
144
  '/api/remotion-skills-info': remotion_skills_info_1.remotionSkillsInfoHandler,
143
145
  '/api/install-remotion-skill': install_remotion_skill_1.installRemotionSkillHandler,
144
146
  '/api/remove-remotion-skill': install_remotion_skill_1.removeRemotionSkillHandler,
147
+ '/api/upgrade-remotion-skill': install_remotion_skill_1.upgradeRemotionSkillHandler,
148
+ '/api/open-remotion-skill': remotion_skills_info_1.openRemotionSkillHandler,
145
149
  '/api/project-info': project_info_1.projectInfoHandler,
146
150
  '/api/delete-static-file': delete_static_file_1.deleteStaticFileHandler,
147
151
  '/api/rename-static-file': rename_static_file_1.renameStaticFileHandler,
148
152
  '/api/upgrade-remotion': upgrade_remotion_1.handleUpgradeRemotion,
149
153
  '/api/shutdown-studio': shutdown_studio_1.handleShutdownStudio,
150
154
  '/api/restart-studio': restart_studio_1.handleRestartStudio,
151
- '/api/default-coding-agent-info': default_coding_agent_1.getDefaultCodingAgentInfoHandler,
152
- '/api/default-editor-info': default_editor_1.getDefaultEditorInfoHandler,
155
+ '/api/app-info': app_info_1.appInfoHandler,
153
156
  '/api/insert-composition-element': insert_composition_element_1.insertCompositionElementHandler,
154
157
  '/api/insert-element': insert_element_1.insertElementHandler,
155
158
  '/api/prepare-element-install': prepare_element_install_1.prepareElementInstallHandler,
@@ -7,6 +7,7 @@ export type LiveEventsServer = {
7
7
  closeConnections: () => Promise<void>;
8
8
  addNewClientListener: (cb: () => void) => () => void;
9
9
  };
10
+ export declare const subscribeToConfigChanges: (onChange: () => void) => () => void;
10
11
  export declare const clearPrintPortMessageTimeout: () => void;
11
12
  export type InitialUndoRedoState = {
12
13
  undoFile: string | null;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setLiveEventsListener = exports.getLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = void 0;
3
+ exports.setLiveEventsListener = exports.getLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = exports.subscribeToConfigChanges = void 0;
4
4
  const server_ready_1 = require("../server-ready");
5
5
  const default_props_watchers_1 = require("./default-props-watchers");
6
6
  const file_existence_watchers_1 = require("./file-existence-watchers");
@@ -9,6 +9,14 @@ const serializeMessage = (message) => {
9
9
  return `data: ${JSON.stringify(message)}\n\n`;
10
10
  };
11
11
  let printPortMessageTimeout = null;
12
+ const configChangeListeners = new Set();
13
+ const subscribeToConfigChanges = (onChange) => {
14
+ configChangeListeners.add(onChange);
15
+ return () => {
16
+ configChangeListeners.delete(onChange);
17
+ };
18
+ };
19
+ exports.subscribeToConfigChanges = subscribeToConfigChanges;
12
20
  const clearPrintPortMessageTimeout = () => {
13
21
  if (printPortMessageTimeout) {
14
22
  clearTimeout(printPortMessageTimeout);
@@ -57,6 +65,9 @@ const makeLiveEventsRouter = (logLevel, getInitialUndoRedoState) => {
57
65
  return Promise.resolve();
58
66
  };
59
67
  const sendEventToClient = (event) => {
68
+ if (event.type === 'config-file-changed') {
69
+ configChangeListeners.forEach((listener) => listener());
70
+ }
60
71
  clients.forEach((client) => {
61
72
  client.response.write(serializeMessage(event));
62
73
  });
@@ -83,7 +83,6 @@ const addSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, v
83
83
  nodePath: updatedNodePath,
84
84
  componentIdentity: null,
85
85
  effects: [],
86
- videoConfigValues: nodePath.videoConfigValues,
87
86
  });
88
87
  const updatedSubscriptionKey = { ...nodePath, nodePath: updatedNodePath };
89
88
  return {
@@ -0,0 +1,3 @@
1
+ import type { GetAppInfoRequest, GetAppInfoResponse } from '@remotion/studio-shared';
2
+ import type { ApiHandler } from '../api-types';
3
+ export declare const appInfoHandler: ApiHandler<GetAppInfoRequest, GetAppInfoResponse>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appInfoHandler = void 0;
4
+ const default_coding_agent_1 = require("./default-coding-agent");
5
+ const default_editor_1 = require("./default-editor");
6
+ const appInfoHandler = async (params) => {
7
+ const [editorInfo, codingAgentInfo] = await Promise.all([
8
+ (0, default_editor_1.getDefaultEditorInfoHandler)({ ...params, input: params.input.editor }),
9
+ (0, default_coding_agent_1.getDefaultCodingAgentInfoHandler)({
10
+ ...params,
11
+ input: params.input.codingAgent,
12
+ }),
13
+ ]);
14
+ return { editorInfo, codingAgentInfo };
15
+ };
16
+ exports.appInfoHandler = appInfoHandler;
@@ -1,5 +1,5 @@
1
1
  import type { File, JSXOpeningElement } from '@babel/types';
2
- import type { CanUpdateEffectPropsResponse, SequenceNodePath, InteractivitySchema, VideoConfigValues } from 'remotion';
2
+ import type { CanUpdateEffectPropsResponse, SequenceNodePath, InteractivitySchema } from 'remotion';
3
3
  import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
4
4
  export declare const computeEffectPropStatus: ({ ast, jsx, effectIndex, keys, videoConfigValues, }: {
5
5
  ast: File;
@@ -8,18 +8,16 @@ export declare const computeEffectPropStatus: ({ ast, jsx, effectIndex, keys, vi
8
8
  keys: string[];
9
9
  videoConfigValues: VideoConfigIdentifierValues;
10
10
  }) => CanUpdateEffectPropsResponse;
11
- export declare const computeEffectPropsStatusesFromContent: ({ fileContents, sequenceNodePath, effects, keysFor, videoConfigValues, }: {
11
+ export declare const computeEffectPropsStatusesFromContent: ({ fileContents, sequenceNodePath, effects, keysFor, }: {
12
12
  fileContents: string;
13
13
  sequenceNodePath: SequenceNodePath;
14
14
  effects: InteractivitySchema[];
15
15
  keysFor: (effect: InteractivitySchema) => string[];
16
- videoConfigValues: VideoConfigValues | null;
17
- }) => CanUpdateEffectPropsResponse[];
18
- export declare const computeEffectPropsStatusesFromFile: ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, videoConfigValues, }: {
16
+ }) => CanUpdateEffectPropsResponse<import("remotion").SourceNumericValue>[];
17
+ export declare const computeEffectPropsStatusesFromFile: ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, }: {
19
18
  fileName: string;
20
19
  sequenceNodePath: SequenceNodePath;
21
20
  effects: InteractivitySchema[];
22
21
  keysFor: (effect: InteractivitySchema) => string[];
23
22
  remotionRoot: string;
24
- videoConfigValues: VideoConfigValues | null;
25
23
  }) => CanUpdateEffectPropsResponse[];
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.computeEffectPropsStatusesFromFile = exports.computeEffectPropsStatusesFromContent = exports.computeEffectPropStatus = void 0;
4
4
  const node_fs_1 = require("node:fs");
5
- const parse_ast_1 = require("../../codemods/parse-ast");
5
+ const codemods_1 = require("@remotion/codemods");
6
+ const no_react_1 = require("remotion/no-react");
6
7
  const update_effect_props_1 = require("../../codemods/update-effect-props/update-effect-props");
7
8
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
8
9
  const video_config_numeric_expression_1 = require("../../helpers/video-config-numeric-expression");
9
- const video_config_values_1 = require("../../helpers/video-config-values");
10
10
  const can_update_sequence_props_1 = require("./can-update-sequence-props");
11
11
  const staticStatus = (codeValue) => ({
12
12
  status: 'static',
@@ -112,7 +112,7 @@ const getPropsFromObjectExpression = ({ ast, objExpr, keys, videoConfigValues, }
112
112
  ? {
113
113
  status: 'static',
114
114
  keyframeDisplayOffsetAdjustment: null,
115
- codeValue: numericExpression.value,
115
+ codeValue: no_react_1.NoReactInternals.evaluateSourceNumericValue(numericExpression, null),
116
116
  ...(numericExpression.type === 'literal'
117
117
  ? {}
118
118
  : { numericExpression }),
@@ -195,30 +195,8 @@ const computeEffectPropStatus = ({ ast, jsx, effectIndex, keys, videoConfigValue
195
195
  };
196
196
  };
197
197
  exports.computeEffectPropStatus = computeEffectPropStatus;
198
- const computeEffectPropsStatusesFromContent = ({ fileContents, sequenceNodePath, effects, keysFor, videoConfigValues, }) => {
199
- const ast = (0, parse_ast_1.parseAst)(fileContents);
200
- const videoConfigIdentifierValues = (0, video_config_values_1.getVideoConfigIdentifierValues)({
201
- ast,
202
- videoConfigValues,
203
- });
204
- const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
205
- if (!jsx) {
206
- return effects.map((_effect, effectIndex) => ({
207
- canUpdate: false,
208
- effectIndex,
209
- reason: 'not-found',
210
- }));
211
- }
212
- return effects.map((effect, effectIndex) => (0, exports.computeEffectPropStatus)({
213
- ast,
214
- jsx,
215
- effectIndex,
216
- keys: keysFor(effect),
217
- videoConfigValues: videoConfigIdentifierValues,
218
- }));
219
- };
220
- exports.computeEffectPropsStatusesFromContent = computeEffectPropsStatusesFromContent;
221
- const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, videoConfigValues, }) => {
198
+ ({ computeEffectPropsStatusesFromContent: exports.computeEffectPropsStatusesFromContent } = codemods_1.CodemodsInternals);
199
+ const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, }) => {
222
200
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
223
201
  remotionRoot,
224
202
  fileName,
@@ -230,7 +208,6 @@ const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effect
230
208
  sequenceNodePath,
231
209
  effects,
232
210
  keysFor,
233
- videoConfigValues,
234
211
  });
235
212
  };
236
213
  exports.computeEffectPropsStatusesFromFile = computeEffectPropsStatusesFromFile;
@@ -1,13 +1,14 @@
1
1
  import type { Expression, File, JSXElement, JSXOpeningElement } from '@babel/types';
2
2
  import type { SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
3
- import type { CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, SequenceNodePath, VideoConfigValues } from 'remotion';
3
+ import type { CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, SequenceNodePath } from 'remotion';
4
4
  import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
5
+ type CanUpdatePropStatus = CanUpdateSequencePropStatus;
5
6
  type StaticValueOptions = {
6
7
  allowSpecialValues: boolean;
7
8
  };
8
9
  export declare const isStaticValue: (node: Expression, options?: StaticValueOptions) => boolean;
9
10
  export declare const extractStaticValue: (node: Expression, options?: StaticValueOptions) => unknown;
10
- export declare const getComputedStatus: (node: Expression, ast: File, videoConfigValues: VideoConfigIdentifierValues) => CanUpdateSequencePropStatus;
11
+ export declare const getComputedStatus: (node: Expression, ast: File, videoConfigValues: VideoConfigIdentifierValues) => CanUpdatePropStatus;
11
12
  export declare const getNodePathForRecastPath: (recastPath: any, ast: File) => SequenceNodePath;
12
13
  export declare const findJsxElementPathAtNodePath: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
13
14
  export declare const findJsxElementAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXOpeningElement | null;
@@ -40,16 +41,15 @@ export declare const resolveSequencePropsNodePathsFromFilename: ({ fileName, tar
40
41
  }[];
41
42
  remotionRoot: string;
42
43
  }) => (SequenceNodePath | null)[];
43
- export declare const computeSequencePropsStatusFromContent: ({ fileContents, nodePath, componentIdentity, keys, assetKeys, effects, videoConfigValues, }: {
44
+ export declare const computeSequencePropsStatusFromContent: ({ fileContents, nodePath, componentIdentity, keys, assetKeys, effects, }: {
44
45
  fileContents: string;
45
46
  nodePath: SequenceNodePath;
46
47
  componentIdentity: string | null;
47
48
  keys: string[];
48
49
  assetKeys?: string[] | undefined;
49
50
  effects: string[][];
50
- videoConfigValues: VideoConfigValues | null;
51
51
  }) => CanUpdateSequencePropsResponseTrue;
52
- export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, videoConfigValues, }: {
52
+ export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, }: {
53
53
  fileName: string;
54
54
  nodePath: SequenceNodePath;
55
55
  componentIdentity: string | null;
@@ -57,9 +57,8 @@ export declare const computeSequencePropsStatus: ({ fileName, nodePath, componen
57
57
  assetKeys?: string[] | undefined;
58
58
  effects: string[][];
59
59
  remotionRoot: string;
60
- videoConfigValues: VideoConfigValues | null;
61
60
  }) => CanUpdateSequencePropsResponseTrue;
62
- export declare const computeSequencePropsStatusFromFilenameByLocation: ({ fileName, line, column, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, videoConfigValues, }: {
61
+ export declare const computeSequencePropsStatusFromFilenameByLocation: ({ fileName, line, column, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, }: {
63
62
  fileName: string;
64
63
  line: number;
65
64
  column: number;
@@ -69,6 +68,5 @@ export declare const computeSequencePropsStatusFromFilenameByLocation: ({ fileNa
69
68
  effects: string[][];
70
69
  remotionRoot: string;
71
70
  logLevel: "error" | "info" | "trace" | "verbose" | "warn";
72
- videoConfigValues: VideoConfigValues;
73
71
  }) => SubscribeToSequencePropsResponse;
74
72
  export {};