@remotion/studio-server 4.0.536 → 4.0.538

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 (98) hide show
  1. package/dist/ansi-diff.js +3 -19
  2. package/dist/better-opn/index.d.ts +4 -2
  3. package/dist/codemods/effect-param-expression.d.ts +2 -2
  4. package/dist/codemods/get-node-path-remappings.d.ts +1 -12
  5. package/dist/codemods/get-node-path-remappings.js +1 -51
  6. package/dist/codemods/paste-effects.d.ts +2 -15
  7. package/dist/codemods/update-effect-props/update-effect-props.d.ts +2 -2
  8. package/dist/codemods/update-keyframes/update-keyframes.d.ts +3 -3
  9. package/dist/codemods/update-nested-prop.d.ts +1 -1
  10. package/dist/detect-outdated-remotion-skills.d.ts +3 -3
  11. package/dist/figma/figma-to-svg.d.ts +1 -1
  12. package/dist/file-watcher.d.ts +1 -1
  13. package/dist/helpers/coding-agent-registry.d.ts +3 -3
  14. package/dist/helpers/css-shorthand-properties.d.ts +8 -7
  15. package/dist/helpers/custom-editor.d.ts +2 -2
  16. package/dist/helpers/editor-registry.d.ts +2 -2
  17. package/dist/helpers/get-ast-node-path.d.ts +2 -1
  18. package/dist/helpers/import-agnostic-node-path.js +22 -13
  19. package/dist/helpers/open-in-app.d.ts +3 -3
  20. package/dist/helpers/open-in-editor.d.ts +2 -2
  21. package/dist/helpers/package-manager-spawn-options.d.ts +1 -1
  22. package/dist/helpers/read-source-file.d.ts +4 -0
  23. package/dist/helpers/read-source-file.js +14 -0
  24. package/dist/helpers/recently-used-apps.d.ts +2 -2
  25. package/dist/helpers/resolve-composition-component.d.ts +2 -2
  26. package/dist/helpers/resolve-editor.d.ts +3 -3
  27. package/dist/helpers/terminal-artwork.d.ts +4 -4
  28. package/dist/helpers/video-config-values.d.ts +4 -0
  29. package/dist/helpers/video-config-values.js +11 -3
  30. package/dist/index.d.ts +39 -100
  31. package/dist/index.js +1 -1
  32. package/dist/maybe-open-browser.d.ts +2 -1
  33. package/dist/preview-server/api-routes.js +2 -0
  34. package/dist/preview-server/api-types.d.ts +1 -1
  35. package/dist/preview-server/default-props-watchers.d.ts +3 -2
  36. package/dist/preview-server/default-props-watchers.js +48 -77
  37. package/dist/preview-server/dev-middleware/index.d.ts +2 -1
  38. package/dist/preview-server/dev-middleware/middleware.d.ts +1 -1
  39. package/dist/preview-server/dev-middleware/middleware.js +14 -17
  40. package/dist/preview-server/element-install-state.d.ts +1 -1
  41. package/dist/preview-server/get-package-manager.d.ts +3 -2
  42. package/dist/preview-server/handler.d.ts +4 -4
  43. package/dist/preview-server/hmr-timing.d.ts +2 -1
  44. package/dist/preview-server/hot-middleware/index.d.ts +2 -1
  45. package/dist/preview-server/jsx-component-identity.d.ts +4 -3
  46. package/dist/preview-server/live-events.d.ts +3 -2
  47. package/dist/preview-server/public-folder.js +11 -2
  48. package/dist/preview-server/routes/add-keyframes.d.ts +2 -1
  49. package/dist/preview-server/routes/app-icon.d.ts +1 -1
  50. package/dist/preview-server/routes/apply-visual-control-change.js +1 -4
  51. package/dist/preview-server/routes/batch-update-keyframe-settings.d.ts +2 -1
  52. package/dist/preview-server/routes/can-update-default-props.d.ts +11 -4
  53. package/dist/preview-server/routes/can-update-default-props.js +43 -10
  54. package/dist/preview-server/routes/can-update-effect-props.d.ts +2 -6
  55. package/dist/preview-server/routes/can-update-sequence-props.d.ts +17 -13
  56. package/dist/preview-server/routes/can-update-sequence-props.js +21 -25
  57. package/dist/preview-server/routes/delete-keyframes.d.ts +4 -6
  58. package/dist/preview-server/routes/delete-keyframes.js +4 -66
  59. package/dist/preview-server/routes/element-install-plan.d.ts +3 -3
  60. package/dist/preview-server/routes/find-in-file.d.ts +2 -9
  61. package/dist/preview-server/routes/insert-element.js +1 -4
  62. package/dist/preview-server/routes/install-dependency.d.ts +2 -14
  63. package/dist/preview-server/routes/log-updates/log-effect-update.d.ts +2 -1
  64. package/dist/preview-server/routes/log-updates/log-update.d.ts +3 -2
  65. package/dist/preview-server/routes/move-keyframes.d.ts +2 -1
  66. package/dist/preview-server/routes/open-in-editor.d.ts +2 -2
  67. package/dist/preview-server/routes/remotion-skills-info.d.ts +1 -1
  68. package/dist/preview-server/routes/save-multiple-effect-props.js +25 -8
  69. package/dist/preview-server/routes/save-sequence-props.d.ts +2 -2
  70. package/dist/preview-server/routes/source-file-write-queue.d.ts +3 -2
  71. package/dist/preview-server/routes/subscribe-to-default-props.js +2 -1
  72. package/dist/preview-server/routes/subscribe-to-sequence-props.js +55 -34
  73. package/dist/preview-server/routes/unsubscribe-from-sequence-props.d.ts +2 -2
  74. package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +12 -10
  75. package/dist/preview-server/routes/unwrap-node.d.ts +3 -0
  76. package/dist/preview-server/routes/unwrap-node.js +98 -0
  77. package/dist/preview-server/routes/update-default-props.js +15 -15
  78. package/dist/preview-server/sequence-node-path-mutation.d.ts +2 -6
  79. package/dist/preview-server/sequence-props-watchers.d.ts +7 -5
  80. package/dist/preview-server/sequence-props-watchers.js +14 -4
  81. package/dist/preview-server/serve-static.d.ts +1 -1
  82. package/dist/preview-server/serve-static.js +18 -1
  83. package/dist/preview-server/start-server.d.ts +3 -3
  84. package/dist/preview-server/studio-protocol/handle-discovery.d.ts +1 -1
  85. package/dist/preview-server/studio-protocol/handle-element-library.d.ts +1 -1
  86. package/dist/preview-server/studio-protocol/handle-install.d.ts +1 -1
  87. package/dist/preview-server/studio-protocol/handle-license-key.d.ts +1 -1
  88. package/dist/preview-server/studio-protocol/origin-policy.d.ts +2 -2
  89. package/dist/preview-server/studio-protocol/protocol-response.d.ts +1 -1
  90. package/dist/preview-server/undo-stack.d.ts +4 -4
  91. package/dist/preview-server/undo-stack.js +9 -0
  92. package/dist/preview-server/update-available.d.ts +3 -2
  93. package/dist/remotion-skill-names.d.ts +1 -1
  94. package/dist/routes.d.ts +4 -4
  95. package/dist/server-ready.d.ts +2 -1
  96. package/dist/start-studio.d.ts +3 -3
  97. package/dist/studio-shortcuts.d.ts +3 -3
  98. package/package.json +10 -10
@@ -18,7 +18,7 @@ type StudioProtocolTarget = {
18
18
  readonly target: ElementInstallTarget;
19
19
  readonly expiresAt: number;
20
20
  };
21
- export declare const updateElementInstallTarget: (newTarget: Omit<ElementInstallTarget, "updatedAt">) => void;
21
+ export declare const updateElementInstallTarget: (newTarget: Omit<ElementInstallTarget, 'updatedAt'>) => void;
22
22
  export declare const getElementInstallTargetByClientId: (clientId: string) => ElementInstallTarget | null;
23
23
  export declare const getElementInstallTarget: (requestId: string | null) => ElementInstallTarget | null;
24
24
  export declare const issueStudioProtocolTarget: ({ now, origin, purpose, target, }: {
@@ -1,3 +1,4 @@
1
+ import type { LogLevel } from '@remotion/renderer';
1
2
  import type { PackageManager } from '@remotion/studio-shared';
2
3
  type LockfilePath = {
3
4
  manager: PackageManager;
@@ -10,6 +11,6 @@ export declare const getPackageManager: ({ remotionRoot, packageManager, dirUp,
10
11
  remotionRoot: string;
11
12
  packageManager: string | undefined;
12
13
  dirUp: number;
13
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
14
- }) => "unknown" | LockfilePath;
14
+ logLevel: LogLevel;
15
+ }) => LockfilePath | 'unknown';
15
16
  export {};
@@ -1,17 +1,17 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
- import type { DefaultEditor } from '@remotion/renderer';
2
+ import type { DefaultCodingAgent, DefaultEditor, LogLevel } from '@remotion/renderer';
3
3
  import type { ApiHandler, QueueMethods } from './api-types';
4
4
  export declare const handleRequest: <Req, Res>({ remotionRoot, request, response, entryPoint, handler, logLevel, methods, binariesDirectory, publicDir, configFile, getDefaultCodingAgent, getDefaultEditor, }: {
5
5
  remotionRoot: string;
6
6
  publicDir: string;
7
7
  request: IncomingMessage;
8
- response: ServerResponse<IncomingMessage>;
8
+ response: ServerResponse;
9
9
  entryPoint: string;
10
10
  binariesDirectory: string | null;
11
11
  configFile: string | null;
12
- getDefaultCodingAgent: () => "claude-code" | "codex" | "copilot" | "cursor" | null;
12
+ getDefaultCodingAgent: () => DefaultCodingAgent | null;
13
13
  getDefaultEditor: () => DefaultEditor | null;
14
14
  handler: ApiHandler<Req, Res>;
15
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
15
+ logLevel: LogLevel;
16
16
  methods: QueueMethods;
17
17
  }) => Promise<void>;
@@ -1,5 +1,6 @@
1
+ import { type LogLevel } from '@remotion/renderer';
1
2
  export declare const logHmrTiming: ({ detail, logLevel, stage, }: {
2
3
  detail: string | null;
3
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
4
+ logLevel: LogLevel;
4
5
  stage: string;
5
6
  }) => void;
@@ -4,6 +4,7 @@
4
4
  * and rewritten in TypeScript. This file is MIT licensed
5
5
  */
6
6
  import type { webpack } from '@remotion/bundler';
7
+ import type { LogLevel } from '@remotion/renderer';
7
8
  import type { LiveEventsServer } from '../live-events';
8
9
  declare global {
9
10
  const __webpack_hash__: unknown;
@@ -99,4 +100,4 @@ declare global {
99
100
  };
100
101
  type ModuleId = string | number;
101
102
  }
102
- export declare const setupWebpackHmr: (compiler: webpack.Compiler, logLevel: "error" | "info" | "trace" | "verbose" | "warn", liveEventsServer: LiveEventsServer) => void;
103
+ export declare const setupWebpackHmr: (compiler: webpack.Compiler, logLevel: LogLevel, liveEventsServer: LiveEventsServer) => void;
@@ -1,12 +1,13 @@
1
1
  import type { File, JSXOpeningElement } from '@babel/types';
2
+ import type { JsxComponentIdentity } from 'remotion';
2
3
  export declare class JsxElementIdentityMismatchError extends Error {
3
4
  constructor();
4
5
  }
5
6
  export declare const getJsxComponentIdentity: ({ ast, jsxElement, }: {
6
7
  ast: File;
7
8
  jsxElement: JSXOpeningElement;
8
- }) => string | null;
9
+ }) => JsxComponentIdentity | null;
9
10
  export declare const jsxComponentIdentitiesMatch: ({ expected, actual, }: {
10
- expected: string | null;
11
- actual: string | null;
11
+ expected: JsxComponentIdentity | null;
12
+ actual: JsxComponentIdentity | null;
12
13
  }) => boolean;
@@ -1,4 +1,5 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ import type { LogLevel } from '@remotion/renderer';
2
3
  import type { EventSourceEvent } from '@remotion/studio-shared';
3
4
  export type LiveEventsServer = {
4
5
  sendEventToClient: (event: EventSourceEvent) => void;
@@ -7,13 +8,13 @@ export type LiveEventsServer = {
7
8
  closeConnections: () => Promise<void>;
8
9
  addNewClientListener: (cb: () => void) => () => void;
9
10
  };
10
- export declare const subscribeToConfigChanges: (onChange: () => void) => () => void;
11
+ export declare const subscribeToConfigChanges: (onChange: () => void) => (() => void);
11
12
  export declare const clearPrintPortMessageTimeout: () => void;
12
13
  export type InitialUndoRedoState = {
13
14
  undoFile: string | null;
14
15
  redoFile: string | null;
15
16
  };
16
- export declare const makeLiveEventsRouter: (logLevel: "error" | "info" | "trace" | "verbose" | "warn", getInitialUndoRedoState: () => InitialUndoRedoState) => LiveEventsServer;
17
+ export declare const makeLiveEventsRouter: (logLevel: LogLevel, getInitialUndoRedoState: () => InitialUndoRedoState) => LiveEventsServer;
17
18
  export declare const waitForLiveEventsListener: () => Promise<LiveEventsServer>;
18
19
  export declare const getLiveEventsListener: () => LiveEventsServer | null;
19
20
  export declare const setLiveEventsListener: (listener: LiveEventsServer) => () => void;
@@ -47,9 +47,18 @@ const watchPublicFolder = ({ publicDir, onUpdate, staticHash, }) => {
47
47
  }
48
48
  // Known bug: If whole public folder is deleted, this will not be called on macOS.
49
49
  // This is not severe, so a wontfix for now.
50
+ let updateTimeout = null;
50
51
  (0, node_fs_1.watch)(publicDir, { recursive: (0, env_supports_fs_recursive_1.envSupportsFsRecursive)() }, () => {
51
- (0, exports.fetchFolder)({ publicDir, staticHash });
52
- onUpdate();
52
+ if (updateTimeout !== null) {
53
+ return;
54
+ }
55
+ // Imports can emit many events, each of which would scan and broadcast the
56
+ // entire asset list. Keep the deadline fixed so ongoing writes still update.
57
+ updateTimeout = setTimeout(() => {
58
+ updateTimeout = null;
59
+ (0, exports.fetchFolder)({ publicDir, staticHash });
60
+ onUpdate();
61
+ }, 100);
53
62
  });
54
63
  };
55
64
  const getFiles = () => {
@@ -1,7 +1,8 @@
1
+ import type { LogLevel } from '@remotion/renderer';
1
2
  import type { AddKeyframesRequest, AddKeyframesResponse, SequenceNodePathMutation } from '@remotion/studio-shared';
2
3
  import type { ApiHandler } from '../api-types';
3
4
  export declare const addKeyframes: ({ sequenceKeyframes, effectKeyframes, clientId, remotionRoot, logLevel, }: AddKeyframesRequest & {
4
5
  readonly remotionRoot: string;
5
- readonly logLevel: "error" | "info" | "trace" | "verbose" | "warn";
6
+ readonly logLevel: LogLevel;
6
7
  }) => Promise<SequenceNodePathMutation | null>;
7
8
  export declare const addKeyframesHandler: ApiHandler<AddKeyframesRequest, AddKeyframesResponse>;
@@ -1,6 +1,6 @@
1
1
  import type { IncomingMessage, ServerResponse } from 'node:http';
2
2
  export declare const handleAppIcon: ({ request, response, pathname, }: {
3
3
  request: IncomingMessage;
4
- response: ServerResponse<IncomingMessage>;
4
+ response: ServerResponse;
5
5
  pathname: string;
6
6
  }) => Promise<void>;
@@ -28,10 +28,7 @@ const applyVisualControlHandler = ({ input: { fileName, changes }, remotionRoot,
28
28
  changes,
29
29
  });
30
30
  const output = (_c = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _c !== void 0 ? _c : fileContents;
31
- const logLine = (_d = (_b = result.updatedControls.findLast((control) => {
32
- var _a;
33
- return control.id === ((_a = changes[0]) === null || _a === void 0 ? void 0 : _a.id);
34
- })) === null || _b === void 0 ? void 0 : _b.line) !== null && _d !== void 0 ? _d : 1;
31
+ const logLine = (_d = (_b = result.updatedControls.findLast((control) => { var _a; return control.id === ((_a = changes[0]) === null || _a === void 0 ? void 0 : _a.id); })) === null || _b === void 0 ? void 0 : _b.line) !== null && _d !== void 0 ? _d : 1;
35
32
  if (result.updatedControls.length === 0) {
36
33
  throw new Error('No changes were made to the file');
37
34
  }
@@ -1,7 +1,8 @@
1
+ import type { LogLevel } from '@remotion/renderer';
1
2
  import type { BatchUpdateKeyframeSettingsRequest, BatchUpdateKeyframeSettingsResponse } from '@remotion/studio-shared';
2
3
  import type { ApiHandler } from '../api-types';
3
4
  export declare const batchUpdateKeyframeSettings: ({ sequenceKeyframes, effectKeyframes, clientId, remotionRoot, logLevel, }: BatchUpdateKeyframeSettingsRequest & {
4
5
  remotionRoot: string;
5
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
6
+ logLevel: LogLevel;
6
7
  }) => Promise<void>;
7
8
  export declare const batchUpdateKeyframeSettingsHandler: ApiHandler<BatchUpdateKeyframeSettingsRequest, BatchUpdateKeyframeSettingsResponse>;
@@ -1,11 +1,18 @@
1
- import type { CanUpdateDefaultPropsResponse } from '@remotion/studio-shared';
2
- export declare const computeCanUpdateDefaultPropsFromContent: (content: string, compositionId: string) => CanUpdateDefaultPropsResponse;
1
+ import { CodemodsInternals } from '@remotion/codemods';
2
+ import type { CanUpdateDefaultPropsResponse, SymbolicatedStackFrame } from '@remotion/studio-shared';
3
+ export declare const { computeCanUpdateDefaultPropsFromContent, }: typeof CodemodsInternals;
3
4
  export declare const checkIfTypeScriptFile: (file: string) => void;
4
- export declare const computeCanUpdateDefaultProps: ({ compositionId, remotionRoot, entryPoint, }: {
5
+ export declare const getDefaultPropsFile: ({ symbolicatedStack, remotionRoot, entryPoint, }: {
6
+ symbolicatedStack: SymbolicatedStackFrame | null;
7
+ remotionRoot: string;
8
+ entryPoint: string;
9
+ }) => Promise<string>;
10
+ export declare const computeCanUpdateDefaultProps: ({ compositionId, symbolicatedStack, remotionRoot, entryPoint, }: {
5
11
  compositionId: string;
12
+ symbolicatedStack: SymbolicatedStackFrame | null;
6
13
  remotionRoot: string;
7
14
  entryPoint: string;
8
15
  }) => Promise<{
9
16
  result: CanUpdateDefaultPropsResponse;
10
- rootFile: string | null;
17
+ compositionFile: string | null;
11
18
  }>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computeCanUpdateDefaultProps = exports.checkIfTypeScriptFile = exports.computeCanUpdateDefaultPropsFromContent = void 0;
3
+ exports.computeCanUpdateDefaultProps = exports.getDefaultPropsFile = exports.checkIfTypeScriptFile = exports.computeCanUpdateDefaultPropsFromContent = void 0;
4
4
  const node_fs_1 = require("node:fs");
5
5
  const codemods_1 = require("@remotion/codemods");
6
+ const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
6
7
  const project_info_1 = require("../project-info");
7
8
  ({ computeCanUpdateDefaultPropsFromContent: exports.computeCanUpdateDefaultPropsFromContent } = codemods_1.CodemodsInternals);
8
9
  const checkIfTypeScriptFile = (file) => {
@@ -14,18 +15,50 @@ const checkIfTypeScriptFile = (file) => {
14
15
  }
15
16
  };
16
17
  exports.checkIfTypeScriptFile = checkIfTypeScriptFile;
17
- const computeCanUpdateDefaultProps = async ({ compositionId, remotionRoot, entryPoint, }) => {
18
+ // Compositions can be registered in files imported by the root file. The
19
+ // client sends the location of the registration, otherwise use the root file.
20
+ const getDefaultPropsFile = async ({ symbolicatedStack, remotionRoot, entryPoint, }) => {
21
+ if (symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalFileName) {
22
+ return (0, resolve_file_inside_project_1.resolveFileInsideProject)({
23
+ remotionRoot,
24
+ fileName: symbolicatedStack.originalFileName,
25
+ action: 'update default props in',
26
+ }).absolutePath;
27
+ }
28
+ const { rootFile } = await (0, project_info_1.getProjectInfo)(remotionRoot, entryPoint);
29
+ if (!rootFile) {
30
+ throw new Error('Cannot find root file in project');
31
+ }
32
+ return rootFile;
33
+ };
34
+ exports.getDefaultPropsFile = getDefaultPropsFile;
35
+ const computeCanUpdateDefaultProps = async ({ compositionId, symbolicatedStack, remotionRoot, entryPoint, }) => {
18
36
  try {
19
- const projectInfo = await (0, project_info_1.getProjectInfo)(remotionRoot, entryPoint);
20
- if (!projectInfo.rootFile) {
21
- throw new Error('Cannot find root file in project');
22
- }
23
- (0, exports.checkIfTypeScriptFile)(projectInfo.rootFile);
24
- const input = (0, node_fs_1.readFileSync)(projectInfo.rootFile, 'utf-8');
37
+ const compositionFile = await (0, exports.getDefaultPropsFile)({
38
+ symbolicatedStack,
39
+ remotionRoot,
40
+ entryPoint,
41
+ });
42
+ (0, exports.checkIfTypeScriptFile)(compositionFile);
43
+ const input = (0, node_fs_1.readFileSync)(compositionFile, 'utf-8');
25
44
  const result = (0, exports.computeCanUpdateDefaultPropsFromContent)(input, compositionId);
45
+ if (!result.canUpdate &&
46
+ !(symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalFileName) &&
47
+ codemods_1.CodemodsInternals.getCompositionFile({
48
+ compositionId,
49
+ project: { files: { [compositionFile]: input }, rootDir: remotionRoot },
50
+ }) === null) {
51
+ return {
52
+ result: {
53
+ canUpdate: false,
54
+ reason: `Could not determine which file registers this composition, checked the root file: ${result.reason}`,
55
+ },
56
+ compositionFile,
57
+ };
58
+ }
26
59
  return {
27
60
  result,
28
- rootFile: projectInfo.rootFile,
61
+ compositionFile,
29
62
  };
30
63
  }
31
64
  catch (err) {
@@ -34,7 +67,7 @@ const computeCanUpdateDefaultProps = async ({ compositionId, remotionRoot, entry
34
67
  canUpdate: false,
35
68
  reason: err.message,
36
69
  },
37
- rootFile: null,
70
+ compositionFile: null,
38
71
  };
39
72
  }
40
73
  };
@@ -1,4 +1,5 @@
1
1
  import type { File, JSXOpeningElement } from '@babel/types';
2
+ import { CodemodsInternals } from '@remotion/codemods';
2
3
  import type { CanUpdateEffectPropsResponse, SequenceNodePath, InteractivitySchema } from 'remotion';
3
4
  import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
4
5
  export declare const computeEffectPropStatus: ({ ast, jsx, effectIndex, keys, videoConfigValues, }: {
@@ -8,12 +9,7 @@ export declare const computeEffectPropStatus: ({ ast, jsx, effectIndex, keys, vi
8
9
  keys: string[];
9
10
  videoConfigValues: VideoConfigIdentifierValues;
10
11
  }) => CanUpdateEffectPropsResponse;
11
- export declare const computeEffectPropsStatusesFromContent: ({ fileContents, sequenceNodePath, effects, keysFor, }: {
12
- fileContents: string;
13
- sequenceNodePath: SequenceNodePath;
14
- effects: InteractivitySchema[];
15
- keysFor: (effect: InteractivitySchema) => string[];
16
- }) => CanUpdateEffectPropsResponse<import("remotion").SourceNumericValue>[];
12
+ export declare const { computeEffectPropsStatusesFromContent }: typeof CodemodsInternals;
17
13
  export declare const computeEffectPropsStatusesFromFile: ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, }: {
18
14
  fileName: string;
19
15
  sequenceNodePath: SequenceNodePath;
@@ -1,6 +1,7 @@
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 } from 'remotion';
3
+ import * as recast from 'recast';
4
+ import type { CanUpdateSequencePropsResponseTrue, CanUpdateSequencePropStatus, JsxComponentIdentity, LogLevel, SequenceNodePath } from 'remotion';
4
5
  import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
5
6
  type CanUpdatePropStatus = CanUpdateSequencePropStatus;
6
7
  type StaticValueOptions = {
@@ -10,7 +11,7 @@ export declare const isStaticValue: (node: Expression, options?: StaticValueOpti
10
11
  export declare const extractStaticValue: (node: Expression, options?: StaticValueOptions) => unknown;
11
12
  export declare const getComputedStatus: (node: Expression, ast: File, videoConfigValues: VideoConfigIdentifierValues) => CanUpdatePropStatus;
12
13
  export declare const getNodePathForRecastPath: (recastPath: any, ast: File) => SequenceNodePath;
13
- export declare const findJsxElementPathAtNodePath: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
14
+ export declare const findJsxElementPathAtNodePath: (ast: File, nodePath: SequenceNodePath) => recast.types.NodePath<any, any> | null;
14
15
  export declare const findJsxElementAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXOpeningElement | null;
15
16
  export declare const findJsxElementNodeAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXElement | null;
16
17
  export type StaticJsxTextContent = {
@@ -24,7 +25,7 @@ export declare const getStaticJsxChildrenAttribute: (jsxElement: JSXOpeningEleme
24
25
  export declare const hasJsxChildrenAttribute: (jsxElement: JSXOpeningElement) => boolean;
25
26
  export declare const getStaticJsxTextContent: (jsxElement: JSXElement) => StaticJsxTextContent | null;
26
27
  export declare const findNodePathForJsxElement: (ast: File, target: JSXOpeningElement) => SequenceNodePath | null;
27
- export declare const lineColumnToNodePath: (ast: File, targetLine: number, targetColumn?: number | undefined, fileContents?: string | undefined) => SequenceNodePath | null;
28
+ export declare const lineColumnToNodePath: (ast: File, targetLine: number, targetColumn?: number, fileContents?: string) => SequenceNodePath | null;
28
29
  export declare const lineColumnsToNodePaths: ({ ast, targets, fileContents, }: {
29
30
  ast: File;
30
31
  targets: {
@@ -33,40 +34,43 @@ export declare const lineColumnsToNodePaths: ({ ast, targets, fileContents, }: {
33
34
  }[];
34
35
  fileContents: string;
35
36
  }) => (SequenceNodePath | null)[];
36
- export declare const resolveSequencePropsNodePathsFromFilename: ({ fileName, targets, remotionRoot, }: {
37
+ export declare const resolveSequencePropsNodePathsFromFilename: ({ fileName, targets, remotionRoot, fileContentsCache, }: {
37
38
  fileName: string;
38
39
  targets: {
39
40
  line: number;
40
41
  column: number;
41
42
  }[];
42
43
  remotionRoot: string;
44
+ fileContentsCache: Map<string, string> | null;
43
45
  }) => (SequenceNodePath | null)[];
44
46
  export declare const computeSequencePropsStatusFromContent: ({ fileContents, nodePath, componentIdentity, keys, assetKeys, effects, }: {
45
47
  fileContents: string;
46
48
  nodePath: SequenceNodePath;
47
- componentIdentity: string | null;
49
+ componentIdentity: JsxComponentIdentity | null;
48
50
  keys: string[];
49
- assetKeys?: string[] | undefined;
51
+ assetKeys?: string[];
50
52
  effects: string[][];
51
53
  }) => CanUpdateSequencePropsResponseTrue;
52
- export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, }: {
54
+ export declare const computeSequencePropsStatus: ({ fileName, nodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, fileContentsCache, }: {
53
55
  fileName: string;
54
56
  nodePath: SequenceNodePath;
55
- componentIdentity: string | null;
57
+ componentIdentity: JsxComponentIdentity | null;
56
58
  keys: string[];
57
- assetKeys?: string[] | undefined;
59
+ assetKeys?: string[];
58
60
  effects: string[][];
59
61
  remotionRoot: string;
62
+ fileContentsCache: Map<string, string> | null;
60
63
  }) => CanUpdateSequencePropsResponseTrue;
61
- export declare const computeSequencePropsStatusFromFilenameByLocation: ({ fileName, line, column, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, }: {
64
+ export declare const computeSequencePropsStatusFromFilenameByLocation: ({ fileName, line, column, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, fileContentsCache, }: {
62
65
  fileName: string;
63
66
  line: number;
64
67
  column: number;
65
- componentIdentity: string | null;
68
+ componentIdentity: JsxComponentIdentity | null;
66
69
  keys: string[];
67
- assetKeys?: string[] | undefined;
70
+ assetKeys?: string[];
68
71
  effects: string[][];
69
72
  remotionRoot: string;
70
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
73
+ logLevel: LogLevel;
74
+ fileContentsCache: Map<string, string> | null;
71
75
  }) => SubscribeToSequencePropsResponse;
72
76
  export {};
@@ -34,7 +34,6 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.computeSequencePropsStatusFromFilenameByLocation = exports.computeSequencePropsStatus = exports.computeSequencePropsStatusFromContent = exports.resolveSequencePropsNodePathsFromFilename = exports.lineColumnsToNodePaths = exports.lineColumnToNodePath = exports.findNodePathForJsxElement = exports.getStaticJsxTextContent = exports.hasJsxChildrenAttribute = exports.getStaticJsxChildrenAttribute = exports.findJsxElementNodeAtNodePath = exports.findJsxElementAtNodePath = exports.findJsxElementPathAtNodePath = exports.getNodePathForRecastPath = exports.getComputedStatus = exports.extractStaticValue = exports.isStaticValue = void 0;
37
- const node_fs_1 = require("node:fs");
38
37
  const codemods_1 = require("@remotion/codemods");
39
38
  const renderer_1 = require("@remotion/renderer");
40
39
  const studio_shared_1 = require("@remotion/studio-shared");
@@ -43,6 +42,7 @@ const no_react_1 = require("remotion/no-react");
43
42
  const get_ast_node_path_1 = require("../../helpers/get-ast-node-path");
44
43
  const import_agnostic_node_path_1 = require("../../helpers/import-agnostic-node-path");
45
44
  const parse_keyframe_easing_expression_1 = require("../../helpers/parse-keyframe-easing-expression");
45
+ const read_source_file_1 = require("../../helpers/read-source-file");
46
46
  const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
47
47
  const video_config_numeric_expression_1 = require("../../helpers/video-config-numeric-expression");
48
48
  const jsx_component_identity_1 = require("../jsx-component-identity");
@@ -513,7 +513,7 @@ const findNodePath = (ast, target) => {
513
513
  visitNode(p) {
514
514
  if (p.node === target) {
515
515
  found = p;
516
- return false;
516
+ return this.abort();
517
517
  }
518
518
  return this.traverse(p);
519
519
  },
@@ -604,11 +604,13 @@ const getFrameDisplayOffsetAdjustmentBetweenPaths = ({ startPath, endPath, video
604
604
  ? { adjustment, playbackRateAdjustment, hasEnclosingElement }
605
605
  : null;
606
606
  };
607
- const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
607
+ const resolveCurrentFrameExpression = ({ node, nodePath, ast, seenDeclarations, }) => {
608
608
  var _a;
609
+ var _b, _c, _d;
609
610
  if (node.type === 'TSAsExpression') {
610
611
  return resolveCurrentFrameExpression({
611
612
  node: node.expression,
613
+ nodePath: (_b = nodePath === null || nodePath === void 0 ? void 0 : nodePath.get('expression')) !== null && _b !== void 0 ? _b : null,
612
614
  ast,
613
615
  seenDeclarations,
614
616
  });
@@ -619,6 +621,7 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
619
621
  if (rightValue !== null && Number.isFinite(rightValue)) {
620
622
  const resolvedLeft = resolveCurrentFrameExpression({
621
623
  node: node.left,
624
+ nodePath: (_c = nodePath === null || nodePath === void 0 ? void 0 : nodePath.get('left')) !== null && _c !== void 0 ? _c : null,
622
625
  ast,
623
626
  seenDeclarations,
624
627
  });
@@ -635,6 +638,7 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
635
638
  if (leftValue !== null && Number.isFinite(leftValue)) {
636
639
  const resolvedRight = resolveCurrentFrameExpression({
637
640
  node: node.right,
641
+ nodePath: (_d = nodePath === null || nodePath === void 0 ? void 0 : nodePath.get('right')) !== null && _d !== void 0 ? _d : null,
638
642
  ast,
639
643
  seenDeclarations,
640
644
  });
@@ -651,7 +655,6 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
651
655
  if (node.type !== 'Identifier') {
652
656
  return null;
653
657
  }
654
- const nodePath = findNodePath(ast, node);
655
658
  const bindingScope = (_a = nodePath === null || nodePath === void 0 ? void 0 : nodePath.scope) === null || _a === void 0 ? void 0 : _a.lookup(node.name);
656
659
  if (!nodePath || !bindingScope) {
657
660
  return null;
@@ -659,6 +662,7 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
659
662
  let matchingDeclarations = 0;
660
663
  let matchingDeclaration = null;
661
664
  let initializer = null;
665
+ let initializerPath = null;
662
666
  let isConstDeclaration = false;
663
667
  recast.types.visit(bindingScope.path, {
664
668
  visitVariableDeclarator(p) {
@@ -674,6 +678,7 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
674
678
  if (init) {
675
679
  matchingDeclaration = p.node;
676
680
  initializer = init;
681
+ initializerPath = p.get('init');
677
682
  isConstDeclaration =
678
683
  declaration.type === 'VariableDeclaration' &&
679
684
  declaration.kind === 'const';
@@ -697,6 +702,7 @@ const resolveCurrentFrameExpression = ({ node, ast, seenDeclarations, }) => {
697
702
  nextSeenDeclarations.add(matchingDeclaration);
698
703
  return resolveCurrentFrameExpression({
699
704
  node: initializer,
705
+ nodePath: initializerPath,
700
706
  ast,
701
707
  seenDeclarations: nextSeenDeclarations,
702
708
  });
@@ -712,6 +718,7 @@ const getCurrentFrameDisplayOffsetAdjustment = ({ node, ast, videoConfigValues,
712
718
  const nodePath = findNodePath(ast, node);
713
719
  const resolved = resolveCurrentFrameExpression({
714
720
  node,
721
+ nodePath,
715
722
  ast,
716
723
  seenDeclarations: new Set(),
717
724
  });
@@ -951,29 +958,16 @@ const lineColumnsToNodePaths = ({ ast, targets, fileContents, }) => {
951
958
  return targets.map((_, index) => exactMatchCounts[index] === 1 ? exactMatches[index] : lineMatches[index]);
952
959
  };
953
960
  exports.lineColumnsToNodePaths = lineColumnsToNodePaths;
954
- const resolveSequencePropsNodePathsFromFilename = ({ fileName, targets, remotionRoot, }) => {
961
+ const resolveSequencePropsNodePathsFromFilename = ({ fileName, targets, remotionRoot, fileContentsCache, }) => {
955
962
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
956
963
  remotionRoot,
957
964
  fileName,
958
965
  action: 'read',
959
966
  });
960
- const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
961
- const nodes = (0, codemods_1.getNodes)({
962
- project: { rootDir: remotionRoot, files: { [absolutePath]: fileContents } },
963
- filePath: absolutePath,
964
- });
965
- return targets.map(({ line, column }) => {
966
- var _a;
967
- var _b;
968
- const lineMatches = nodes.filter((node) => {
969
- var _a;
970
- return ((_a = node.location) === null || _a === void 0 ? void 0 : _a.line) === line;
971
- });
972
- const exactMatches = lineMatches.filter((node) => {
973
- var _a;
974
- return ((_a = node.location) === null || _a === void 0 ? void 0 : _a.column) === column;
975
- });
976
- return ((_b = (_a = (exactMatches.length === 1 ? exactMatches[0] : lineMatches.at(-1))) === null || _a === void 0 ? void 0 : _a.nodePath) !== null && _b !== void 0 ? _b : null);
967
+ const fileContents = (0, read_source_file_1.readSourceFile)({ absolutePath, fileContentsCache });
968
+ return codemods_1.CodemodsInternals.resolveNodePathsFromLocations({
969
+ fileContents,
970
+ targets,
977
971
  });
978
972
  };
979
973
  exports.resolveSequencePropsNodePathsFromFilename = resolveSequencePropsNodePathsFromFilename;
@@ -999,13 +993,13 @@ const computeSequencePropsStatusFromContent = ({ fileContents, nodePath, compone
999
993
  }
1000
994
  };
1001
995
  exports.computeSequencePropsStatusFromContent = computeSequencePropsStatusFromContent;
1002
- const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, keys, assetKeys = [], effects, remotionRoot, }) => {
996
+ const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, keys, assetKeys = [], effects, remotionRoot, fileContentsCache, }) => {
1003
997
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
1004
998
  remotionRoot,
1005
999
  fileName,
1006
1000
  action: 'read',
1007
1001
  });
1008
- const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
1002
+ const fileContents = (0, read_source_file_1.readSourceFile)({ absolutePath, fileContentsCache });
1009
1003
  return (0, exports.computeSequencePropsStatusFromContent)({
1010
1004
  fileContents,
1011
1005
  nodePath,
@@ -1016,7 +1010,7 @@ const computeSequencePropsStatus = ({ fileName, nodePath, componentIdentity, key
1016
1010
  });
1017
1011
  };
1018
1012
  exports.computeSequencePropsStatus = computeSequencePropsStatus;
1019
- const computeSequencePropsStatusFromFilenameByLocation = ({ fileName, line, column, componentIdentity, keys, assetKeys = [], effects, remotionRoot, logLevel, }) => {
1013
+ const computeSequencePropsStatusFromFilenameByLocation = ({ fileName, line, column, componentIdentity, keys, assetKeys = [], effects, remotionRoot, logLevel, fileContentsCache, }) => {
1020
1014
  try {
1021
1015
  const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
1022
1016
  remotionRoot,
@@ -1027,6 +1021,7 @@ const computeSequencePropsStatusFromFilenameByLocation = ({ fileName, line, colu
1027
1021
  fileName,
1028
1022
  targets: [{ line, column }],
1029
1023
  remotionRoot,
1024
+ fileContentsCache,
1030
1025
  });
1031
1026
  if (!resolvedNodePath) {
1032
1027
  return {
@@ -1046,6 +1041,7 @@ const computeSequencePropsStatusFromFilenameByLocation = ({ fileName, line, colu
1046
1041
  assetKeys,
1047
1042
  effects,
1048
1043
  remotionRoot,
1044
+ fileContentsCache,
1049
1045
  }),
1050
1046
  nodePath: {
1051
1047
  absolutePath,
@@ -1,13 +1,11 @@
1
- import type { DeleteEffectKeyframe, DeleteKeyframesRequest, DeleteKeyframesResponse, DeleteSequenceKeyframe, SaveEffectPropsResponse, SaveSequencePropsResult } from '@remotion/studio-shared';
1
+ import type { LogLevel } from '@remotion/renderer';
2
+ import type { DeleteEffectKeyframe, DeleteKeyframesRequest, DeleteKeyframesResponse, DeleteSequenceKeyframe } from '@remotion/studio-shared';
2
3
  import type { ApiHandler } from '../api-types';
3
4
  export declare const deleteKeyframes: ({ sequenceKeyframes, effectKeyframes, clientId, remotionRoot, logLevel, }: {
4
5
  sequenceKeyframes: DeleteSequenceKeyframe[];
5
6
  effectKeyframes: DeleteEffectKeyframe[];
6
7
  clientId: string;
7
8
  remotionRoot: string;
8
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
9
- }) => Promise<{
10
- sequenceResults: SaveSequencePropsResult[];
11
- effectResults: SaveEffectPropsResponse[];
12
- }>;
9
+ logLevel: LogLevel;
10
+ }) => Promise<void>;
13
11
  export declare const deleteKeyframesHandler: ApiHandler<DeleteKeyframesRequest, DeleteKeyframesResponse>;