@remotion/studio-server 4.0.513 → 4.0.515
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.
- package/dist/codemods/delete-jsx-node.d.ts +2 -5
- package/dist/codemods/delete-jsx-node.js +23 -341
- package/dist/codemods/duplicate-composition.d.ts +1 -9
- package/dist/codemods/duplicate-composition.js +3 -49
- package/dist/codemods/format-inline-content.d.ts +0 -4
- package/dist/codemods/format-inline-content.js +7 -46
- package/dist/codemods/recast-mods.js +0 -18
- package/dist/codemods/reorder-sequence.d.ts +2 -2
- package/dist/codemods/reorder-sequence.js +12 -112
- package/dist/codemods/split-jsx-sequence.d.ts +1 -2
- package/dist/codemods/split-jsx-sequence.js +11 -298
- package/dist/codemods/split-video-from-audio.d.ts +15 -0
- package/dist/codemods/split-video-from-audio.js +15 -0
- package/dist/codemods/update-default-props.d.ts +2 -6
- package/dist/codemods/update-default-props.js +12 -220
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +1 -4
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +5 -102
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +8 -93
- package/dist/codemods/update-keyframes/update-keyframes.js +11 -1302
- package/dist/detect-outdated-remotion-skills.d.ts +7 -0
- package/dist/detect-outdated-remotion-skills.js +11 -5
- package/dist/helpers/open-file-for-writing-without-symlinks.d.ts +4 -0
- package/dist/helpers/open-file-for-writing-without-symlinks.js +52 -0
- package/dist/helpers/resolve-composition-component.d.ts +3 -11
- package/dist/helpers/resolve-composition-component.js +38 -1495
- package/dist/helpers/video-config-values.js +25 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/max-timeline-tracks.d.ts +2 -1
- package/dist/max-timeline-tracks.js +10 -4
- package/dist/preview-server/api-routes.js +4 -0
- package/dist/preview-server/routes/add-effect.js +1 -1
- package/dist/preview-server/routes/apply-codemod.js +3 -3
- package/dist/preview-server/routes/apply-visual-control-change.js +3 -3
- package/dist/preview-server/routes/can-update-sequence-props.js +107 -24
- package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
- package/dist/preview-server/routes/delete-effect.js +1 -1
- package/dist/preview-server/routes/delete-jsx-node.js +1 -1
- package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
- package/dist/preview-server/routes/duplicate-effect.js +1 -1
- package/dist/preview-server/routes/duplicate-jsx-node.js +1 -1
- package/dist/preview-server/routes/element-install-plan.d.ts +1 -1
- package/dist/preview-server/routes/insert-element.js +2 -2
- package/dist/preview-server/routes/insert-jsx-element.js +1 -1
- package/dist/preview-server/routes/install-dependency.js +8 -2
- package/dist/preview-server/routes/log-updates/log-effect-update.js +2 -1
- package/dist/preview-server/routes/log-updates/log-update.js +2 -1
- package/dist/preview-server/routes/paste-effects.js +1 -1
- package/dist/preview-server/routes/remotion-skills-info.d.ts +7 -0
- package/dist/preview-server/routes/remotion-skills-info.js +24 -0
- package/dist/preview-server/routes/reorder-effect.js +1 -1
- package/dist/preview-server/routes/reorder-sequence.js +1 -1
- package/dist/preview-server/routes/save-props-mutex.d.ts +1 -0
- package/dist/preview-server/routes/save-props-mutex.js +11 -0
- package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -0
- package/dist/preview-server/routes/source-file-write-queue.js +11 -2
- package/dist/preview-server/routes/split-jsx-sequence.js +1 -1
- package/dist/preview-server/routes/split-video-from-audio.d.ts +3 -0
- package/dist/preview-server/routes/split-video-from-audio.js +80 -0
- package/dist/preview-server/routes/update-default-props.js +1 -1
- package/dist/preview-server/start-server.js +188 -140
- package/dist/preview-server/undo-stack.d.ts +3 -52
- package/dist/preview-server/update-available.js +4 -4
- package/dist/routes.js +36 -5
- package/package.json +8 -8
|
@@ -1,224 +1,16 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
const
|
|
38
|
-
const recast = __importStar(require("recast"));
|
|
3
|
+
exports.updateDefaultProps = exports.getCompositionDefaultPropsLine = void 0;
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
39
5
|
const format_inline_content_1 = require("./format-inline-content");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
// Convert recast's tab-expanded column to character index
|
|
52
|
-
const line = lines[loc.line - 1];
|
|
53
|
-
let col = 0;
|
|
54
|
-
for (let i = 0; i < line.length; i++) {
|
|
55
|
-
if (col >= loc.column) {
|
|
56
|
-
return offset + i;
|
|
57
|
-
}
|
|
58
|
-
col += line[i] === '\t' ? RECAST_TAB_WIDTH : 1;
|
|
59
|
-
}
|
|
60
|
-
return offset + line.length;
|
|
61
|
-
};
|
|
62
|
-
const updateDefaultProps = async ({ input, compositionId, newDefaultProps, enumPaths, }) => {
|
|
63
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
64
|
-
const stringified = (0, studio_shared_1.stringifyDefaultProps)({
|
|
65
|
-
props: newDefaultProps,
|
|
66
|
-
enumPaths,
|
|
67
|
-
});
|
|
68
|
-
let replaceStart;
|
|
69
|
-
let replaceEnd;
|
|
70
|
-
recast.types.visit(ast, {
|
|
71
|
-
visitJSXElement(path) {
|
|
72
|
-
var _a, _b;
|
|
73
|
-
const { openingElement } = path.node;
|
|
74
|
-
// 1: ensure its the element we're looking for
|
|
75
|
-
const openingName = openingElement.name;
|
|
76
|
-
if (openingName.type !== 'JSXIdentifier' &&
|
|
77
|
-
openingName.type !== 'JSXNamespacedName') {
|
|
78
|
-
this.traverse(path); // Continue traversing the AST
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (openingName.name !== 'Composition' && openingName.name !== 'Still') {
|
|
82
|
-
this.traverse(path); // Continue traversing the AST
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
if (!((_a = openingElement.attributes) === null || _a === void 0 ? void 0 : _a.some((attr) => {
|
|
86
|
-
if (attr.type === 'JSXSpreadAttribute') {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
if (!attr.value) {
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
if (attr.value.type === 'JSXElement') {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (attr.value.type === 'JSXExpressionContainer') {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (attr.value.type === 'JSXFragment') {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
return attr.name.name === 'id' && attr.value.value === compositionId;
|
|
102
|
-
}))) {
|
|
103
|
-
this.traverse(path); // Continue traversing the AST
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// 2: Find the defaultProps attribute and handle related errors
|
|
107
|
-
const defaultPropsAttr = openingElement.attributes.find((attr) => {
|
|
108
|
-
if (attr.type === 'JSXSpreadAttribute') {
|
|
109
|
-
this.traverse(path); // Continue traversing the AST
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
return attr.name.name === 'defaultProps';
|
|
113
|
-
});
|
|
114
|
-
if (!defaultPropsAttr) {
|
|
115
|
-
throw new Error(`No \`defaultProps\` prop found in the <Composition/> tag with the ID "${compositionId}".`);
|
|
116
|
-
}
|
|
117
|
-
if (defaultPropsAttr.type === 'JSXSpreadAttribute') {
|
|
118
|
-
this.traverse(path); // Continue traversing the AST
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
// 3: ensure only hardcoded values are provided
|
|
122
|
-
if (!defaultPropsAttr.value ||
|
|
123
|
-
defaultPropsAttr.value.type === 'JSXElement' ||
|
|
124
|
-
defaultPropsAttr.value.type === 'JSXText' ||
|
|
125
|
-
defaultPropsAttr.value.type === 'StringLiteral' ||
|
|
126
|
-
defaultPropsAttr.value.type === 'NumericLiteral' ||
|
|
127
|
-
defaultPropsAttr.value.type === 'BigIntLiteral' ||
|
|
128
|
-
defaultPropsAttr.value.type === 'DecimalLiteral' ||
|
|
129
|
-
defaultPropsAttr.value.type === 'NullLiteral' ||
|
|
130
|
-
defaultPropsAttr.value.type === 'BooleanLiteral' ||
|
|
131
|
-
defaultPropsAttr.value.type === 'RegExpLiteral' ||
|
|
132
|
-
defaultPropsAttr.value.type === 'JSXFragment' ||
|
|
133
|
-
defaultPropsAttr.value.type === 'Literal') {
|
|
134
|
-
throw new Error(`\`defaultProps\` prop must be a hardcoded value in the <Composition/> tag, but it is a ${(_b = defaultPropsAttr.value) === null || _b === void 0 ? void 0 : _b.type}".`);
|
|
135
|
-
}
|
|
136
|
-
const defaultPropsValue = defaultPropsAttr.value.expression;
|
|
137
|
-
if (defaultPropsValue.type !== 'ObjectExpression' &&
|
|
138
|
-
defaultPropsValue.type !== 'TSAsExpression') {
|
|
139
|
-
throw new Error(`\`defaultProps\` prop must be a hardcoded value in the <Composition/> tag with the ID "${compositionId}".`);
|
|
140
|
-
}
|
|
141
|
-
// Capture source positions for direct string replacement
|
|
142
|
-
// instead of modifying the AST and serializing (avoids recast artifacts)
|
|
143
|
-
const valueLoc = defaultPropsAttr.value.loc;
|
|
144
|
-
if (!valueLoc) {
|
|
145
|
-
throw new Error('Could not determine source location of defaultProps');
|
|
146
|
-
}
|
|
147
|
-
replaceStart = recastLocToOffset(input, valueLoc.start);
|
|
148
|
-
replaceEnd = recastLocToOffset(input, valueLoc.end);
|
|
149
|
-
this.traverse(path); // Continue traversing the AST
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
if (replaceStart === undefined || replaceEnd === undefined) {
|
|
153
|
-
throw new Error(`Could not find defaultProps for composition "${compositionId}"`);
|
|
154
|
-
}
|
|
155
|
-
// linePrefix includes the JSX container opening brace
|
|
156
|
-
const lineStart = input.lastIndexOf('\n', replaceStart) + 1;
|
|
157
|
-
const linePrefix = input.substring(lineStart, replaceStart + 1);
|
|
158
|
-
const { formatted, didFormat } = await (0, format_inline_content_1.formatInlineContent)({
|
|
159
|
-
inlineContent: stringified,
|
|
160
|
-
linePrefix,
|
|
161
|
-
endOfLine: 'auto',
|
|
162
|
-
});
|
|
163
|
-
// Replace the JSX expression container in the original input
|
|
164
|
-
const output = input.substring(0, replaceStart) +
|
|
165
|
-
'{' +
|
|
166
|
-
formatted +
|
|
167
|
-
'}' +
|
|
168
|
-
input.substring(replaceEnd);
|
|
169
|
-
return { output, formatted: didFormat };
|
|
170
|
-
};
|
|
6
|
+
const studio_codemods_2 = require("@remotion/studio-codemods");
|
|
7
|
+
Object.defineProperty(exports, "getCompositionDefaultPropsLine", { enumerable: true, get: function () { return studio_codemods_2.getCompositionDefaultPropsLine; } });
|
|
8
|
+
const formatInline = ({ inlineContent, linePrefix, endOfLine }) => (0, format_inline_content_1.formatInlineContent)({ inlineContent, linePrefix, endOfLine });
|
|
9
|
+
const updateDefaultProps = ({ input, compositionId, newDefaultProps, enumPaths, }) => (0, studio_codemods_1.updateDefaultProps)({
|
|
10
|
+
input,
|
|
11
|
+
compositionId,
|
|
12
|
+
newDefaultProps,
|
|
13
|
+
enumPaths,
|
|
14
|
+
formatInline,
|
|
15
|
+
});
|
|
171
16
|
exports.updateDefaultProps = updateDefaultProps;
|
|
172
|
-
/** Line of the matching `<Composition>` / `<Still>` opening tag (for log links). */
|
|
173
|
-
const getCompositionDefaultPropsLine = ({ input, compositionId, }) => {
|
|
174
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
175
|
-
let line = 1;
|
|
176
|
-
let found = false;
|
|
177
|
-
recast.types.visit(ast, {
|
|
178
|
-
visitJSXElement(path) {
|
|
179
|
-
var _a, _b, _c;
|
|
180
|
-
var _d, _e;
|
|
181
|
-
if (found) {
|
|
182
|
-
this.traverse(path);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const { openingElement } = path.node;
|
|
186
|
-
const openingName = openingElement.name;
|
|
187
|
-
if (openingName.type !== 'JSXIdentifier' &&
|
|
188
|
-
openingName.type !== 'JSXNamespacedName') {
|
|
189
|
-
this.traverse(path);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
if (openingName.name !== 'Composition' && openingName.name !== 'Still') {
|
|
193
|
-
this.traverse(path);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
if (!((_a = openingElement.attributes) === null || _a === void 0 ? void 0 : _a.some((attr) => {
|
|
197
|
-
if (attr.type === 'JSXSpreadAttribute') {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
if (!attr.value) {
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (attr.value.type === 'JSXElement') {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (attr.value.type === 'JSXExpressionContainer') {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (attr.value.type === 'JSXFragment') {
|
|
210
|
-
return;
|
|
211
|
-
}
|
|
212
|
-
return attr.name.name === 'id' && attr.value.value === compositionId;
|
|
213
|
-
}))) {
|
|
214
|
-
this.traverse(path);
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
found = true;
|
|
218
|
-
line = (_e = (_d = (_b = openingElement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : (_c = path.node.loc) === null || _c === void 0 ? void 0 : _c.start.line) !== null && _e !== void 0 ? _e : 1;
|
|
219
|
-
this.traverse(path);
|
|
220
|
-
},
|
|
221
|
-
});
|
|
222
|
-
return line;
|
|
223
|
-
};
|
|
224
|
-
exports.getCompositionDefaultPropsLine = getCompositionDefaultPropsLine;
|
|
@@ -1,4 +1 @@
|
|
|
1
|
-
|
|
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>, hookName?: string) => void;
|
|
1
|
+
export { ensureRemotionImports, ensureUseCurrentFrameHook, findEnclosingFunctionPath, } from '@remotion/studio-codemods';
|
|
@@ -1,104 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const isFunctionNode = (value) => {
|
|
42
|
-
return (n.FunctionDeclaration.check(value) ||
|
|
43
|
-
n.FunctionExpression.check(value) ||
|
|
44
|
-
n.ArrowFunctionExpression.check(value));
|
|
45
|
-
};
|
|
46
|
-
const findEnclosingFunctionPath = (path) => {
|
|
47
|
-
let current = path.parentPath;
|
|
48
|
-
while (current) {
|
|
49
|
-
if (isFunctionNode(current.value)) {
|
|
50
|
-
return current;
|
|
51
|
-
}
|
|
52
|
-
current = current.parentPath;
|
|
53
|
-
}
|
|
54
|
-
return null;
|
|
55
|
-
};
|
|
56
|
-
exports.findEnclosingFunctionPath = findEnclosingFunctionPath;
|
|
57
|
-
const ensureRemotionImports = (ast, names) => {
|
|
58
|
-
(0, imports_1.ensureNamedImports)({ ast, importedNames: names, sourcePath: 'remotion' });
|
|
59
|
-
};
|
|
60
|
-
exports.ensureRemotionImports = ensureRemotionImports;
|
|
61
|
-
const componentBodyHasFrameDeclaration = ({ body, hookName, }) => {
|
|
62
|
-
if (!n.BlockStatement.check(body)) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
for (const stmt of body.body) {
|
|
66
|
-
if (stmt.type !== 'VariableDeclaration') {
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
for (const decl of stmt.declarations) {
|
|
70
|
-
if (decl.type !== 'VariableDeclarator') {
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (decl.id.type === 'Identifier' &&
|
|
74
|
-
decl.id.name === 'frame' &&
|
|
75
|
-
decl.init &&
|
|
76
|
-
decl.init.type === 'CallExpression' &&
|
|
77
|
-
decl.init.callee.type === 'Identifier' &&
|
|
78
|
-
decl.init.callee.name === hookName) {
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return false;
|
|
84
|
-
};
|
|
85
|
-
const ensureUseCurrentFrameHook = (functionPath, hookName = 'useCurrentFrame') => {
|
|
86
|
-
const fn = functionPath.value;
|
|
87
|
-
if (!n.BlockStatement.check(fn.body)) {
|
|
88
|
-
// Arrow function with expression body: wrap the expression in a block so
|
|
89
|
-
// we can prepend the hook call before returning the original expression.
|
|
90
|
-
const expression = fn.body;
|
|
91
|
-
fn.body = b.blockStatement([
|
|
92
|
-
b.returnStatement(expression),
|
|
93
|
-
]);
|
|
94
|
-
}
|
|
95
|
-
if (componentBodyHasFrameDeclaration({ body: fn.body, hookName })) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const block = fn.body;
|
|
99
|
-
const frameDecl = b.variableDeclaration('const', [
|
|
100
|
-
b.variableDeclarator(b.identifier('frame'), b.callExpression(b.identifier(hookName), [])),
|
|
101
|
-
]);
|
|
102
|
-
block.body.unshift(frameDecl);
|
|
103
|
-
};
|
|
104
|
-
exports.ensureUseCurrentFrameHook = ensureUseCurrentFrameHook;
|
|
3
|
+
exports.findEnclosingFunctionPath = exports.ensureUseCurrentFrameHook = exports.ensureRemotionImports = void 0;
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
+
Object.defineProperty(exports, "ensureRemotionImports", { enumerable: true, get: function () { return studio_codemods_1.ensureRemotionImports; } });
|
|
6
|
+
Object.defineProperty(exports, "ensureUseCurrentFrameHook", { enumerable: true, get: function () { return studio_codemods_1.ensureUseCurrentFrameHook; } });
|
|
7
|
+
Object.defineProperty(exports, "findEnclosingFunctionPath", { enumerable: true, get: function () { return studio_codemods_1.findEnclosingFunctionPath; } });
|
|
@@ -1,106 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type KeyframeOperation = {
|
|
7
|
-
type: 'add';
|
|
8
|
-
frame: number;
|
|
9
|
-
value: unknown;
|
|
10
|
-
} | {
|
|
11
|
-
type: 'remove';
|
|
12
|
-
frame: number;
|
|
13
|
-
valueWhenLastKeyframeDeleted: unknown | null;
|
|
14
|
-
} | {
|
|
15
|
-
type: 'settings';
|
|
16
|
-
clamping: {
|
|
17
|
-
left: ExtrapolateType;
|
|
18
|
-
right: ExtrapolateType;
|
|
19
|
-
} | undefined;
|
|
20
|
-
posterize: number | undefined;
|
|
21
|
-
output: InterpolateOutputOption | undefined;
|
|
22
|
-
} | {
|
|
23
|
-
type: 'easing';
|
|
24
|
-
segmentIndex: number;
|
|
25
|
-
easing: KeyframeEasing;
|
|
26
|
-
} | {
|
|
27
|
-
type: 'move';
|
|
28
|
-
moves: {
|
|
29
|
-
fromFrame: number;
|
|
30
|
-
toFrame: number;
|
|
31
|
-
}[];
|
|
32
|
-
};
|
|
33
|
-
export type SequenceKeyframeUpdate = {
|
|
34
|
-
key: string;
|
|
35
|
-
operation: KeyframeOperation;
|
|
36
|
-
};
|
|
37
|
-
export type EffectKeyframeUpdate = {
|
|
38
|
-
key: string;
|
|
39
|
-
operation: KeyframeOperation;
|
|
40
|
-
};
|
|
41
|
-
export type IntroducedKeyframeIdentifiers = {
|
|
42
|
-
calleeName: KeyframeInterpolationFunction | null;
|
|
43
|
-
needsFrameHook: boolean;
|
|
44
|
-
needsEasingImport: boolean;
|
|
45
|
-
};
|
|
46
|
-
export declare const updateSequenceKeyframesAst: ({ input, nodePath, updates, schema, videoConfigValues, }: {
|
|
47
|
-
input: string;
|
|
48
|
-
nodePath: SequenceNodePath;
|
|
49
|
-
updates: SequenceKeyframeUpdate[];
|
|
50
|
-
schema?: InteractivitySchema | undefined;
|
|
51
|
-
videoConfigValues: VideoConfigValues | null;
|
|
52
|
-
}) => {
|
|
53
|
-
serialized: string;
|
|
54
|
-
oldValueStrings: string[];
|
|
55
|
-
newValueStrings: string[];
|
|
56
|
-
logLine: number;
|
|
57
|
-
updatedNodePath: SequenceNodePath;
|
|
58
|
-
};
|
|
59
|
-
export declare const updateSequenceKeyframes: ({ input, nodePath, updates, schema, prettierConfigOverride, videoConfigValues, }: {
|
|
60
|
-
input: string;
|
|
61
|
-
nodePath: SequenceNodePath;
|
|
62
|
-
updates: SequenceKeyframeUpdate[];
|
|
63
|
-
schema?: InteractivitySchema | undefined;
|
|
64
|
-
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
65
|
-
videoConfigValues: VideoConfigValues | null;
|
|
66
|
-
}) => Promise<{
|
|
1
|
+
import { updateEffectKeyframes as updateEffectKeyframesCodemod, updateSequenceKeyframes as updateSequenceKeyframesCodemod } from '@remotion/studio-codemods';
|
|
2
|
+
export { type EffectKeyframeUpdate, type IntroducedKeyframeIdentifiers, type KeyframeOperation, type SequenceKeyframeUpdate, updateEffectKeyframesAst, updateSequenceKeyframesAst, } from '@remotion/studio-codemods';
|
|
3
|
+
type UpdateSequenceKeyframesInput = Omit<Parameters<typeof updateSequenceKeyframesCodemod>[0], 'formatFile'>;
|
|
4
|
+
type UpdateEffectKeyframesInput = Omit<Parameters<typeof updateEffectKeyframesCodemod>[0], 'formatFile'>;
|
|
5
|
+
export declare const updateSequenceKeyframes: (input: UpdateSequenceKeyframesInput) => Promise<{
|
|
67
6
|
output: string;
|
|
68
7
|
formatted: boolean;
|
|
69
8
|
oldValueStrings: string[];
|
|
70
9
|
newValueStrings: string[];
|
|
71
10
|
logLine: number;
|
|
72
|
-
updatedNodePath: SequenceNodePath;
|
|
11
|
+
updatedNodePath: import("remotion").SequenceNodePath;
|
|
73
12
|
}>;
|
|
74
|
-
export declare const
|
|
75
|
-
input: string;
|
|
76
|
-
sequenceNodePath: SequenceNodePath;
|
|
77
|
-
effectIndex: number;
|
|
78
|
-
updates: EffectKeyframeUpdate[];
|
|
79
|
-
schema?: InteractivitySchema | undefined;
|
|
80
|
-
videoConfigValues: VideoConfigValues | null;
|
|
81
|
-
}) => {
|
|
82
|
-
serialized: string;
|
|
83
|
-
oldValueStrings: string[];
|
|
84
|
-
newValueStrings: string[];
|
|
85
|
-
logLine: number;
|
|
86
|
-
effectCallee: string;
|
|
87
|
-
updatedSequenceNodePath: SequenceNodePath;
|
|
88
|
-
};
|
|
89
|
-
export declare const updateEffectKeyframes: ({ input, sequenceNodePath, effectIndex, updates, schema, prettierConfigOverride, videoConfigValues, }: {
|
|
90
|
-
input: string;
|
|
91
|
-
sequenceNodePath: SequenceNodePath;
|
|
92
|
-
effectIndex: number;
|
|
93
|
-
updates: EffectKeyframeUpdate[];
|
|
94
|
-
schema?: InteractivitySchema | undefined;
|
|
95
|
-
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
96
|
-
videoConfigValues: VideoConfigValues | null;
|
|
97
|
-
}) => Promise<{
|
|
13
|
+
export declare const updateEffectKeyframes: (input: UpdateEffectKeyframesInput) => Promise<{
|
|
98
14
|
output: string;
|
|
99
15
|
formatted: boolean;
|
|
100
16
|
oldValueStrings: string[];
|
|
101
17
|
newValueStrings: string[];
|
|
102
18
|
logLine: number;
|
|
103
19
|
effectCallee: string;
|
|
104
|
-
updatedSequenceNodePath: SequenceNodePath;
|
|
20
|
+
updatedSequenceNodePath: import("remotion").SequenceNodePath;
|
|
105
21
|
}>;
|
|
106
|
-
export {};
|