@remotion/studio-server 4.0.469 → 4.0.470

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 (48) hide show
  1. package/dist/codemods/delete-effect.d.ts +18 -0
  2. package/dist/codemods/delete-effect.js +95 -21
  3. package/dist/codemods/delete-jsx-node.d.ts +10 -0
  4. package/dist/codemods/delete-jsx-node.js +38 -14
  5. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +4 -0
  6. package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +152 -0
  7. package/dist/codemods/update-keyframes/update-keyframes.d.ts +8 -0
  8. package/dist/codemods/update-keyframes/update-keyframes.js +94 -24
  9. package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +32 -10
  10. package/dist/codemods/update-sequence-props/update-sequence-props.js +39 -7
  11. package/dist/index.d.ts +2 -1
  12. package/dist/preview-server/api-routes.js +16 -0
  13. package/dist/preview-server/routes/add-effect-keyframe.d.ts +3 -0
  14. package/dist/preview-server/routes/add-effect-keyframe.js +91 -0
  15. package/dist/preview-server/routes/add-sequence-keyframe.d.ts +3 -0
  16. package/dist/preview-server/routes/add-sequence-keyframe.js +84 -0
  17. package/dist/preview-server/routes/apply-codemod.js +1 -0
  18. package/dist/preview-server/routes/apply-visual-control-change.js +1 -0
  19. package/dist/preview-server/routes/can-update-sequence-props.js +33 -13
  20. package/dist/preview-server/routes/composition-component-info.d.ts +3 -0
  21. package/dist/preview-server/routes/composition-component-info.js +26 -0
  22. package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
  23. package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
  24. package/dist/preview-server/routes/delete-effect.js +76 -37
  25. package/dist/preview-server/routes/delete-jsx-node.js +67 -36
  26. package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
  27. package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
  28. package/dist/preview-server/routes/duplicate-jsx-node.js +1 -0
  29. package/dist/preview-server/routes/open-in-editor.d.ts +4 -0
  30. package/dist/preview-server/routes/open-in-editor.js +40 -0
  31. package/dist/preview-server/routes/register-client-render.d.ts +3 -0
  32. package/dist/preview-server/routes/register-client-render.js +11 -0
  33. package/dist/preview-server/routes/save-effect-props.js +1 -0
  34. package/dist/preview-server/routes/save-sequence-props.js +158 -72
  35. package/dist/preview-server/routes/unregister-client-render.d.ts +4 -0
  36. package/dist/preview-server/routes/unregister-client-render.js +11 -0
  37. package/dist/preview-server/routes/update-default-props.js +1 -0
  38. package/dist/preview-server/start-server.d.ts +1 -0
  39. package/dist/preview-server/start-server.js +1 -0
  40. package/dist/preview-server/undo-stack.d.ts +26 -3
  41. package/dist/preview-server/undo-stack.js +130 -42
  42. package/dist/preview-server/validate-same-origin.d.ts +2 -0
  43. package/dist/preview-server/validate-same-origin.js +13 -0
  44. package/dist/routes.d.ts +2 -1
  45. package/dist/routes.js +9 -136
  46. package/dist/start-studio.d.ts +2 -1
  47. package/dist/start-studio.js +2 -1
  48. package/package.json +6 -6
@@ -1,4 +1,22 @@
1
1
  import type { SequenceNodePath } from 'remotion';
2
+ export type EffectDeletionTarget = {
3
+ sequenceNodePath: SequenceNodePath;
4
+ } & ({
5
+ type: 'single-effect';
6
+ effectIndex: number;
7
+ } | {
8
+ type: 'all-effects';
9
+ });
10
+ export declare const deleteEffects: ({ input, effects, prettierConfigOverride, }: {
11
+ input: string;
12
+ effects: EffectDeletionTarget[];
13
+ prettierConfigOverride?: Record<string, unknown> | null | undefined;
14
+ }) => Promise<{
15
+ output: string;
16
+ formatted: boolean;
17
+ effectLabels: string[];
18
+ logLines: number[];
19
+ }>;
2
20
  export declare const deleteEffect: ({ input, sequenceNodePath, effectIndex, prettierConfigOverride, }: {
3
21
  input: string;
4
22
  sequenceNodePath: SequenceNodePath;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteEffect = void 0;
3
+ exports.deleteEffect = exports.deleteEffects = void 0;
4
4
  const can_update_sequence_props_1 = require("../preview-server/routes/can-update-sequence-props");
5
5
  const format_file_content_1 = require("./format-file-content");
6
6
  const parse_ast_1 = require("./parse-ast");
@@ -15,28 +15,88 @@ const getEffectsArray = (attr) => {
15
15
  }
16
16
  return expr;
17
17
  };
18
- const deleteEffect = async ({ input, sequenceNodePath, effectIndex, prettierConfigOverride, }) => {
18
+ const getAllEffectLabels = (effectsArray, attr) => {
19
+ if (effectsArray.elements.length === 0) {
20
+ throw new Error('Cannot delete effect: no effects found');
21
+ }
22
+ const elements = (0, update_effect_props_1.enumerateEffectArrayElements)(effectsArray);
23
+ return {
24
+ effectLabels: elements.map((effect) => effect.kind === 'call' ? `${effect.callee}()` : 'effect'),
25
+ logLines: elements.map((effect) => {
26
+ var _a, _b, _c;
27
+ var _d, _e, _f;
28
+ return effect.kind === 'call'
29
+ ? ((_e = (_d = (_a = effect.node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : (_b = attr.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _e !== void 0 ? _e : 1)
30
+ : ((_f = (_c = attr.loc) === null || _c === void 0 ? void 0 : _c.start.line) !== null && _f !== void 0 ? _f : 1);
31
+ }),
32
+ };
33
+ };
34
+ const deleteEffects = async ({ input, effects, prettierConfigOverride, }) => {
19
35
  var _a, _b;
20
36
  var _c, _d, _e;
21
- const ast = (0, parse_ast_1.parseAst)(input);
22
- const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
23
- if (!jsx) {
24
- throw new Error('Could not find a JSX element at the specified location to delete effect');
37
+ if (effects.length === 0) {
38
+ throw new Error('No effects were specified for deletion');
25
39
  }
26
- const attr = (0, update_effect_props_1.findEffectsAttr)((_c = jsx.attributes) !== null && _c !== void 0 ? _c : []);
27
- if (!attr) {
28
- throw new Error('Could not find effects on the target JSX element');
29
- }
30
- const effectsArray = getEffectsArray(attr);
31
- const found = (0, update_effect_props_1.findEffectCallExpression)({ attr, effectIndex });
32
- if (found.kind === 'error') {
33
- throw new Error(`Cannot delete effect: ${found.reason}`);
40
+ const ast = (0, parse_ast_1.parseAst)(input);
41
+ const deletionsByAttr = new Map();
42
+ for (const effect of effects) {
43
+ const { sequenceNodePath } = effect;
44
+ const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
45
+ if (!jsx) {
46
+ throw new Error('Could not find a JSX element at the specified location to delete effect');
47
+ }
48
+ const attr = (0, update_effect_props_1.findEffectsAttr)((_c = jsx.attributes) !== null && _c !== void 0 ? _c : []);
49
+ if (!attr) {
50
+ throw new Error('Could not find effects on the target JSX element');
51
+ }
52
+ const effectsArray = getEffectsArray(attr);
53
+ const existingDeletion = deletionsByAttr.get(attr);
54
+ const deletion = existingDeletion !== null && existingDeletion !== void 0 ? existingDeletion : {
55
+ jsxAttributes: jsx.attributes,
56
+ attr,
57
+ effectsArray,
58
+ allEffects: false,
59
+ effectIndices: new Set(),
60
+ effectLabels: [],
61
+ logLines: [],
62
+ };
63
+ deletionsByAttr.set(attr, deletion);
64
+ if (effect.type === 'all-effects') {
65
+ const { effectLabels, logLines } = getAllEffectLabels(effectsArray, attr);
66
+ deletion.allEffects = true;
67
+ deletion.effectIndices.clear();
68
+ deletion.effectLabels = effectLabels;
69
+ deletion.logLines = logLines;
70
+ continue;
71
+ }
72
+ const { effectIndex } = effect;
73
+ if (deletion.allEffects || deletion.effectIndices.has(effectIndex)) {
74
+ continue;
75
+ }
76
+ const found = (0, update_effect_props_1.findEffectCallExpression)({ attr, effectIndex });
77
+ if (found.kind === 'error') {
78
+ throw new Error(`Cannot delete effect: ${found.reason}`);
79
+ }
80
+ deletion.effectIndices.add(effectIndex);
81
+ deletion.effectLabels.push(`${found.callee}()`);
82
+ deletion.logLines.push((_e = (_d = (_a = found.call.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : (_b = jsx.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _e !== void 0 ? _e : 1);
34
83
  }
35
- effectsArray.elements.splice(effectIndex, 1);
36
- if (effectsArray.elements.length === 0) {
37
- const attrIndex = jsx.attributes.indexOf(attr);
38
- if (attrIndex !== -1) {
39
- jsx.attributes.splice(attrIndex, 1);
84
+ for (const deletion of deletionsByAttr.values()) {
85
+ if (deletion.allEffects) {
86
+ const attrIndex = deletion.jsxAttributes.indexOf(deletion.attr);
87
+ if (attrIndex !== -1) {
88
+ deletion.jsxAttributes.splice(attrIndex, 1);
89
+ }
90
+ continue;
91
+ }
92
+ for (const effectIndex of [...deletion.effectIndices].sort((a, b) => b - a)) {
93
+ deletion.effectsArray.elements.splice(effectIndex, 1);
94
+ }
95
+ if (deletion.effectsArray.elements.length === 0) {
96
+ const attrIndex = deletion.jsxAttributes.indexOf(deletion.attr);
97
+ if (attrIndex !== -1) {
98
+ deletion.jsxAttributes.splice(attrIndex, 1);
99
+ }
40
100
  }
41
101
  }
42
102
  const finalFile = (0, parse_ast_1.serializeAst)(ast);
@@ -47,8 +107,22 @@ const deleteEffect = async ({ input, sequenceNodePath, effectIndex, prettierConf
47
107
  return {
48
108
  output,
49
109
  formatted,
50
- effectLabel: `${found.callee}()`,
51
- logLine: (_e = (_d = (_a = found.call.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : (_b = jsx.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _e !== void 0 ? _e : 1,
110
+ effectLabels: [...deletionsByAttr.values()].flatMap((deletion) => deletion.effectLabels),
111
+ logLines: [...deletionsByAttr.values()].flatMap((deletion) => deletion.logLines),
112
+ };
113
+ };
114
+ exports.deleteEffects = deleteEffects;
115
+ const deleteEffect = async ({ input, sequenceNodePath, effectIndex, prettierConfigOverride, }) => {
116
+ const { output, formatted, effectLabels, logLines } = await (0, exports.deleteEffects)({
117
+ input,
118
+ effects: [{ type: 'single-effect', sequenceNodePath, effectIndex }],
119
+ prettierConfigOverride,
120
+ });
121
+ return {
122
+ output,
123
+ formatted,
124
+ effectLabel: effectLabels[0],
125
+ logLine: logLines[0],
52
126
  };
53
127
  };
54
128
  exports.deleteEffect = deleteEffect;
@@ -4,6 +4,16 @@ import type { SequenceNodePath } from 'remotion';
4
4
  export declare const getJsxElementTagLabel: (element: JSXElement) => string;
5
5
  export declare const findJsxElementPathForDeletion: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
6
6
  export declare const deleteJsxElementAtPath: (jsxPath: import("ast-types/lib/node-path").NodePath<N, V>) => void;
7
+ export declare const deleteJsxNodes: ({ input, nodePaths, prettierConfigOverride, }: {
8
+ input: string;
9
+ nodePaths: SequenceNodePath[];
10
+ prettierConfigOverride?: Record<string, unknown> | null | undefined;
11
+ }) => Promise<{
12
+ output: string;
13
+ formatted: boolean;
14
+ nodeLabels: string[];
15
+ logLines: number[];
16
+ }>;
7
17
  export declare const deleteJsxNode: ({ input, nodePath, prettierConfigOverride, }: {
8
18
  input: string;
9
19
  nodePath: SequenceNodePath;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.deleteJsxNode = exports.deleteJsxElementAtPath = exports.findJsxElementPathForDeletion = exports.getJsxElementTagLabel = void 0;
36
+ exports.deleteJsxNode = exports.deleteJsxNodes = exports.deleteJsxElementAtPath = exports.findJsxElementPathForDeletion = exports.getJsxElementTagLabel = void 0;
37
37
  const recast = __importStar(require("recast"));
38
38
  const get_ast_node_path_1 = require("../helpers/get-ast-node-path");
39
39
  const format_file_content_1 = require("./format-file-content");
@@ -287,18 +287,28 @@ const deleteJsxElementAtPath = (jsxPath) => {
287
287
  jsxPath.replace(b.nullLiteral());
288
288
  };
289
289
  exports.deleteJsxElementAtPath = deleteJsxElementAtPath;
290
- const deleteJsxNode = async ({ input, nodePath, prettierConfigOverride, }) => {
291
- var _a, _b;
292
- var _c, _d;
290
+ const deleteJsxNodes = async ({ input, nodePaths, prettierConfigOverride, }) => {
291
+ if (nodePaths.length === 0) {
292
+ throw new Error('No JSX nodes were specified for deletion');
293
+ }
293
294
  const ast = (0, parse_ast_1.parseAst)(input);
294
- const jsxPath = (0, exports.findJsxElementPathForDeletion)(ast, nodePath);
295
- if (!jsxPath) {
296
- throw new Error('Could not find a JSX element at the specified location to delete');
297
- }
298
- const jsxElement = jsxPath.node;
299
- const nodeLabel = (0, exports.getJsxElementTagLabel)(jsxElement);
300
- const logLine = (_d = (_c = (_a = jsxElement.openingElement.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _c !== void 0 ? _c : (_b = jsxElement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : 1;
301
- (0, exports.deleteJsxElementAtPath)(jsxPath);
295
+ const pathsToDelete = nodePaths.map((nodePath) => {
296
+ var _a, _b;
297
+ var _c, _d;
298
+ const jsxPath = (0, exports.findJsxElementPathForDeletion)(ast, nodePath);
299
+ if (!jsxPath) {
300
+ throw new Error('Could not find a JSX element at the specified location to delete');
301
+ }
302
+ const jsxElement = jsxPath.node;
303
+ return {
304
+ jsxPath,
305
+ nodeLabel: (0, exports.getJsxElementTagLabel)(jsxElement),
306
+ logLine: (_d = (_c = (_a = jsxElement.openingElement.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _c !== void 0 ? _c : (_b = jsxElement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : 1,
307
+ };
308
+ });
309
+ for (const { jsxPath } of pathsToDelete) {
310
+ (0, exports.deleteJsxElementAtPath)(jsxPath);
311
+ }
302
312
  const finalFile = (0, parse_ast_1.serializeAst)(ast);
303
313
  const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
304
314
  input: finalFile,
@@ -307,8 +317,22 @@ const deleteJsxNode = async ({ input, nodePath, prettierConfigOverride, }) => {
307
317
  return {
308
318
  output,
309
319
  formatted,
310
- nodeLabel,
311
- logLine,
320
+ nodeLabels: pathsToDelete.map(({ nodeLabel }) => nodeLabel),
321
+ logLines: pathsToDelete.map(({ logLine }) => logLine),
322
+ };
323
+ };
324
+ exports.deleteJsxNodes = deleteJsxNodes;
325
+ const deleteJsxNode = async ({ input, nodePath, prettierConfigOverride, }) => {
326
+ const { output, formatted, nodeLabels, logLines } = await (0, exports.deleteJsxNodes)({
327
+ input,
328
+ nodePaths: [nodePath],
329
+ prettierConfigOverride,
330
+ });
331
+ return {
332
+ output,
333
+ formatted,
334
+ nodeLabel: nodeLabels[0],
335
+ logLine: logLines[0],
312
336
  };
313
337
  };
314
338
  exports.deleteJsxNode = deleteJsxNode;
@@ -0,0 +1,4 @@
1
+ import type { File } from '@babel/types';
2
+ export declare const findEnclosingFunctionPath: (path: import("ast-types/lib/node-path").NodePath<N, V>) => import("ast-types/lib/node-path").NodePath<N, V> | null;
3
+ export declare const ensureRemotionImports: (ast: File, names: ReadonlySet<string>) => void;
4
+ export declare const ensureUseCurrentFrameHook: (functionPath: import("ast-types/lib/node-path").NodePath<N, V>) => void;
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ensureUseCurrentFrameHook = exports.ensureRemotionImports = exports.findEnclosingFunctionPath = void 0;
37
+ const recast = __importStar(require("recast"));
38
+ const b = recast.types.builders;
39
+ const n = recast.types.namedTypes;
40
+ const isFunctionNode = (value) => {
41
+ return (n.FunctionDeclaration.check(value) ||
42
+ n.FunctionExpression.check(value) ||
43
+ n.ArrowFunctionExpression.check(value));
44
+ };
45
+ const findEnclosingFunctionPath = (path) => {
46
+ let current = path.parentPath;
47
+ while (current) {
48
+ if (isFunctionNode(current.value)) {
49
+ return current;
50
+ }
51
+ current = current.parentPath;
52
+ }
53
+ return null;
54
+ };
55
+ exports.findEnclosingFunctionPath = findEnclosingFunctionPath;
56
+ const findRemotionImport = (ast) => {
57
+ for (const stmt of ast.program.body) {
58
+ if (stmt.type === 'ImportDeclaration' &&
59
+ stmt.source.type === 'StringLiteral' &&
60
+ stmt.source.value === 'remotion') {
61
+ return stmt;
62
+ }
63
+ }
64
+ return null;
65
+ };
66
+ const insertImportDeclaration = (ast, importDecl) => {
67
+ const { body } = ast.program;
68
+ let lastImportIndex = -1;
69
+ for (let i = 0; i < body.length; i++) {
70
+ if (body[i].type === 'ImportDeclaration') {
71
+ lastImportIndex = i;
72
+ }
73
+ }
74
+ body.splice(lastImportIndex + 1, 0, importDecl);
75
+ };
76
+ const ensureRemotionImports = (ast, names) => {
77
+ var _a, _b;
78
+ if (names.size === 0) {
79
+ return;
80
+ }
81
+ let remotionImport = findRemotionImport(ast);
82
+ if (!remotionImport) {
83
+ remotionImport = b.importDeclaration([], b.stringLiteral('remotion'));
84
+ insertImportDeclaration(ast, remotionImport);
85
+ }
86
+ const existingNames = new Set();
87
+ for (const specifier of (_a = remotionImport.specifiers) !== null && _a !== void 0 ? _a : []) {
88
+ if (specifier.type !== 'ImportSpecifier') {
89
+ continue;
90
+ }
91
+ const { imported } = specifier;
92
+ if (imported.type === 'Identifier') {
93
+ existingNames.add(imported.name);
94
+ }
95
+ else if (imported.type === 'StringLiteral') {
96
+ existingNames.add(imported.value);
97
+ }
98
+ }
99
+ for (const name of names) {
100
+ if (existingNames.has(name)) {
101
+ continue;
102
+ }
103
+ remotionImport.specifiers = (_b = remotionImport.specifiers) !== null && _b !== void 0 ? _b : [];
104
+ remotionImport.specifiers.push(b.importSpecifier(b.identifier(name)));
105
+ existingNames.add(name);
106
+ }
107
+ };
108
+ exports.ensureRemotionImports = ensureRemotionImports;
109
+ const componentBodyHasFrameDeclaration = (body) => {
110
+ if (!n.BlockStatement.check(body)) {
111
+ return false;
112
+ }
113
+ for (const stmt of body.body) {
114
+ if (stmt.type !== 'VariableDeclaration') {
115
+ continue;
116
+ }
117
+ for (const decl of stmt.declarations) {
118
+ if (decl.type !== 'VariableDeclarator') {
119
+ continue;
120
+ }
121
+ if (decl.id.type === 'Identifier' &&
122
+ decl.id.name === 'frame' &&
123
+ decl.init &&
124
+ decl.init.type === 'CallExpression' &&
125
+ decl.init.callee.type === 'Identifier' &&
126
+ decl.init.callee.name === 'useCurrentFrame') {
127
+ return true;
128
+ }
129
+ }
130
+ }
131
+ return false;
132
+ };
133
+ const ensureUseCurrentFrameHook = (functionPath) => {
134
+ const fn = functionPath.value;
135
+ if (!n.BlockStatement.check(fn.body)) {
136
+ // Arrow function with expression body: wrap the expression in a block so
137
+ // we can prepend the hook call before returning the original expression.
138
+ const expression = fn.body;
139
+ fn.body = b.blockStatement([
140
+ b.returnStatement(expression),
141
+ ]);
142
+ }
143
+ if (componentBodyHasFrameDeclaration(fn.body)) {
144
+ return;
145
+ }
146
+ const block = fn.body;
147
+ const frameDecl = b.variableDeclaration('const', [
148
+ b.variableDeclarator(b.identifier('frame'), b.callExpression(b.identifier('useCurrentFrame'), [])),
149
+ ]);
150
+ block.body.unshift(frameDecl);
151
+ };
152
+ exports.ensureUseCurrentFrameHook = ensureUseCurrentFrameHook;
@@ -15,6 +15,10 @@ export type EffectKeyframeUpdate = {
15
15
  key: string;
16
16
  operation: KeyframeOperation;
17
17
  };
18
+ export type IntroducedKeyframeIdentifiers = {
19
+ calleeName: 'interpolate' | 'interpolateColors' | null;
20
+ needsFrameHook: boolean;
21
+ };
18
22
  export declare const updateSequenceKeyframesAst: ({ input, nodePath, updates, }: {
19
23
  input: string;
20
24
  nodePath: SequenceNodePath;
@@ -22,6 +26,7 @@ export declare const updateSequenceKeyframesAst: ({ input, nodePath, updates, }:
22
26
  }) => {
23
27
  serialized: string;
24
28
  oldValueStrings: string[];
29
+ newValueStrings: string[];
25
30
  logLine: number;
26
31
  };
27
32
  export declare const updateSequenceKeyframes: ({ input, nodePath, updates, prettierConfigOverride, }: {
@@ -33,6 +38,7 @@ export declare const updateSequenceKeyframes: ({ input, nodePath, updates, prett
33
38
  output: string;
34
39
  formatted: boolean;
35
40
  oldValueStrings: string[];
41
+ newValueStrings: string[];
36
42
  logLine: number;
37
43
  }>;
38
44
  export declare const updateEffectKeyframesAst: ({ input, sequenceNodePath, effectIndex, updates, }: {
@@ -43,6 +49,7 @@ export declare const updateEffectKeyframesAst: ({ input, sequenceNodePath, effec
43
49
  }) => {
44
50
  serialized: string;
45
51
  oldValueStrings: string[];
52
+ newValueStrings: string[];
46
53
  logLine: number;
47
54
  effectCallee: string;
48
55
  };
@@ -56,6 +63,7 @@ export declare const updateEffectKeyframes: ({ input, sequenceNodePath, effectIn
56
63
  output: string;
57
64
  formatted: boolean;
58
65
  oldValueStrings: string[];
66
+ newValueStrings: string[];
59
67
  logLine: number;
60
68
  effectCallee: string;
61
69
  }>;