@remotion/studio-server 4.0.535 → 4.0.536
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/helpers/resolve-composition-component.d.ts +1 -2
- package/dist/helpers/resolve-composition-component.js +1 -3
- package/dist/preview-server/routes/insert-basic-captions.js +1 -2
- package/dist/preview-server/routes/insert-composition-element.js +14 -6
- package/dist/preview-server/routes/insert-element.js +1 -2
- package/package.json +8 -8
- package/dist/canvas-capture/generate-canvas-capture-composition.d.ts +0 -14
- package/dist/canvas-capture/generate-canvas-capture-composition.js +0 -239
- package/dist/codemods/add-effect.d.ts +0 -1
- package/dist/codemods/add-effect.js +0 -8
- package/dist/codemods/apply-codemod-to-file.d.ts +0 -7
- package/dist/codemods/apply-codemod-to-file.js +0 -171
- package/dist/codemods/apply-visual-control.d.ts +0 -8
- package/dist/codemods/apply-visual-control.js +0 -89
- package/dist/codemods/delete-effect.d.ts +0 -1
- package/dist/codemods/delete-effect.js +0 -6
- package/dist/codemods/delete-jsx-node.d.ts +0 -22
- package/dist/codemods/delete-jsx-node.js +0 -17
- package/dist/codemods/delete-jsx-nodes.d.ts +0 -13
- package/dist/codemods/delete-jsx-nodes.js +0 -10
- package/dist/codemods/duplicate-composition.d.ts +0 -2
- package/dist/codemods/duplicate-composition.js +0 -64
- package/dist/codemods/duplicate-effect.d.ts +0 -1
- package/dist/codemods/duplicate-effect.js +0 -6
- package/dist/codemods/duplicate-jsx-node.d.ts +0 -25
- package/dist/codemods/duplicate-jsx-node.js +0 -26
- package/dist/codemods/format-file-content.d.ts +0 -7
- package/dist/codemods/format-file-content.js +0 -80
- package/dist/codemods/format-inline-content.d.ts +0 -18
- package/dist/codemods/format-inline-content.js +0 -78
- package/dist/codemods/insert-video-layers.d.ts +0 -11
- package/dist/codemods/insert-video-layers.js +0 -5
- package/dist/codemods/recast-mods.d.ts +0 -13
- package/dist/codemods/recast-mods.js +0 -902
- package/dist/codemods/reorder-effect.d.ts +0 -1
- package/dist/codemods/reorder-effect.js +0 -5
- package/dist/codemods/reorder-sequence.d.ts +0 -1
- package/dist/codemods/reorder-sequence.js +0 -5
- package/dist/codemods/simple-diff.d.ts +0 -5
- package/dist/codemods/simple-diff.js +0 -39
- package/dist/codemods/split-jsx-sequence.d.ts +0 -27
- package/dist/codemods/split-jsx-sequence.js +0 -19
- package/dist/codemods/split-video-from-audio.d.ts +0 -1
- package/dist/codemods/split-video-from-audio.js +0 -5
- package/dist/codemods/update-default-props.d.ts +0 -1
- package/dist/codemods/update-default-props.js +0 -6
- package/dist/codemods/update-inline-caption-patches.d.ts +0 -1
- package/dist/codemods/update-inline-caption-patches.js +0 -5
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +0 -1
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +0 -7
- package/dist/open-browser-shortcut.d.ts +0 -9
- package/dist/open-browser-shortcut.js +0 -121
- package/dist/preview-server/hot-middleware/types.d.ts +0 -2
- package/dist/preview-server/hot-middleware/types.js +0 -2
- package/dist/preview-server/routes/apply-codemod.d.ts +0 -4
- package/dist/preview-server/routes/apply-codemod.js +0 -272
- package/dist/preview-server/routes/delete-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-node.js +0 -126
- package/dist/preview-server/routes/delete-jsx-nodes.d.ts +0 -3
- package/dist/preview-server/routes/delete-jsx-nodes.js +0 -137
- package/dist/preview-server/routes/duplicate-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/duplicate-jsx-node.js +0 -118
- package/dist/preview-server/routes/insert-jsx-element.d.ts +0 -3
- package/dist/preview-server/routes/insert-jsx-element.js +0 -231
- package/dist/preview-server/routes/insert-video-layers.d.ts +0 -3
- package/dist/preview-server/routes/insert-video-layers.js +0 -68
- package/dist/preview-server/routes/split-jsx-sequence.d.ts +0 -3
- package/dist/preview-server/routes/split-jsx-sequence.js +0 -117
- package/dist/preview-server/routes/update-public-license.d.ts +0 -11
- package/dist/preview-server/routes/update-public-license.js +0 -97
- package/dist/preview-server/routes/wrap-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/wrap-jsx-node.js +0 -97
|
@@ -12,13 +12,12 @@ export declare const resolveCompositionComponent: ({ remotionRoot, compositionFi
|
|
|
12
12
|
compositionFile: string;
|
|
13
13
|
compositionId: string;
|
|
14
14
|
}) => Promise<ResolvedCompositionComponent>;
|
|
15
|
-
export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositionFile, compositionId, element, from,
|
|
15
|
+
export declare const insertJsxElementIntoComposition: ({ remotionRoot, compositionFile, compositionId, element, from, prettierConfigOverride, wrapInSequence, sourceFileOverrides, }: {
|
|
16
16
|
remotionRoot: string;
|
|
17
17
|
compositionFile: string;
|
|
18
18
|
compositionId: string;
|
|
19
19
|
element: InsertableCompositionElement;
|
|
20
20
|
from: number | null;
|
|
21
|
-
premountFor: number | null;
|
|
22
21
|
prettierConfigOverride: Record<string, unknown> | null;
|
|
23
22
|
wrapInSequence?: {
|
|
24
23
|
dimensions: {
|
|
@@ -40,7 +40,7 @@ const resolveCompositionComponent = ({ remotionRoot, compositionFile, compositio
|
|
|
40
40
|
environment: makeCodemodEnvironment(remotionRoot, null),
|
|
41
41
|
});
|
|
42
42
|
exports.resolveCompositionComponent = resolveCompositionComponent;
|
|
43
|
-
const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile, compositionId, element, from,
|
|
43
|
+
const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile, compositionId, element, from, prettierConfigOverride, wrapInSequence = null, sourceFileOverrides, }) => {
|
|
44
44
|
var _a;
|
|
45
45
|
var _b, _c;
|
|
46
46
|
const environment = makeCodemodEnvironment(remotionRoot, sourceFileOverrides);
|
|
@@ -61,7 +61,6 @@ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile,
|
|
|
61
61
|
element,
|
|
62
62
|
environment,
|
|
63
63
|
from,
|
|
64
|
-
premountFor,
|
|
65
64
|
prettierConfigOverride,
|
|
66
65
|
wrapInSequence: sequence,
|
|
67
66
|
});
|
|
@@ -69,7 +68,6 @@ const insertJsxElementIntoComposition = async ({ remotionRoot, compositionFile,
|
|
|
69
68
|
const codemodElement = createElementFromInsertable({
|
|
70
69
|
element,
|
|
71
70
|
from,
|
|
72
|
-
premountFor,
|
|
73
71
|
wrapInSequence: sequence,
|
|
74
72
|
});
|
|
75
73
|
const location = await resolveCompositionComponentWithFileCodemod({
|
|
@@ -11,7 +11,7 @@ const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
|
11
11
|
const undo_stack_1 = require("../undo-stack");
|
|
12
12
|
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
13
13
|
const { basicCaptionsElementSource, getBasicCaptionsElementFile, insertBasicCaptions, } = codemods_1.CodemodsInternals;
|
|
14
|
-
const insertBasicCaptionsHandler = ({ input: { fileName, nodePath, captions, durationInFrames
|
|
14
|
+
const insertBasicCaptionsHandler = ({ input: { fileName, nodePath, captions, durationInFrames }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => {
|
|
15
15
|
var _a;
|
|
16
16
|
try {
|
|
17
17
|
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
@@ -50,7 +50,6 @@ const insertBasicCaptionsHandler = ({ input: { fileName, nodePath, captions, dur
|
|
|
50
50
|
nodePath,
|
|
51
51
|
captions,
|
|
52
52
|
durationInFrames,
|
|
53
|
-
premountFor,
|
|
54
53
|
importPath: elementFile.importPath,
|
|
55
54
|
});
|
|
56
55
|
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([{ absolutePath, remappings: nodePathRemappings }], null);
|
|
@@ -54,6 +54,16 @@ const validateElement = (element, remotionRoot) => {
|
|
|
54
54
|
validateDimension('height', element.height);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
+
if (element.type === 'text') {
|
|
58
|
+
if (typeof element.text !== 'string' || element.text.trim() === '') {
|
|
59
|
+
throw new Error('Text must be a non-empty string');
|
|
60
|
+
}
|
|
61
|
+
validateDimension('fontSize', element.fontSize);
|
|
62
|
+
if (typeof element.color !== 'string' || element.color.trim() === '') {
|
|
63
|
+
throw new Error('Text color must be a non-empty string');
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
57
67
|
if (element.type === 'svg') {
|
|
58
68
|
if (typeof element.markup !== 'string' || element.markup.trim() === '') {
|
|
59
69
|
throw new Error('SVG markup must be a non-empty string');
|
|
@@ -118,6 +128,9 @@ const validateElement = (element, remotionRoot) => {
|
|
|
118
128
|
throw new Error('Unsupported element type');
|
|
119
129
|
};
|
|
120
130
|
const getElementLabel = (element) => {
|
|
131
|
+
if (element.type === 'text') {
|
|
132
|
+
return '<Interactive.Div>';
|
|
133
|
+
}
|
|
121
134
|
if (element.type === 'solid') {
|
|
122
135
|
return '<Solid>';
|
|
123
136
|
}
|
|
@@ -149,17 +162,13 @@ const getElementLabel = (element) => {
|
|
|
149
162
|
}
|
|
150
163
|
throw new Error('Unsupported element type');
|
|
151
164
|
};
|
|
152
|
-
const insertCompositionElementHandler = ({ input: { compositionFile, compositionId, element, from
|
|
165
|
+
const insertCompositionElementHandler = ({ input: { compositionFile, compositionId, element, from }, remotionRoot, logLevel, }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
153
166
|
try {
|
|
154
167
|
validateElement(element, remotionRoot);
|
|
155
168
|
if (from !== null &&
|
|
156
169
|
(!Number.isInteger(from) || !Number.isFinite(from) || from < 0)) {
|
|
157
170
|
throw new Error('from must be a non-negative integer');
|
|
158
171
|
}
|
|
159
|
-
if (premountFor !== null &&
|
|
160
|
-
(!Number.isInteger(premountFor) || premountFor < 0)) {
|
|
161
|
-
throw new Error('premountFor must be a non-negative integer');
|
|
162
|
-
}
|
|
163
172
|
const elementLabel = getElementLabel(element);
|
|
164
173
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[insert-composition-element] Received request for compositionFile="${compositionFile}" compositionId="${compositionId}" element="${element.type}"`);
|
|
165
174
|
const { fileName, source, oldContents, output, insertedNodePath, logLine, nodePathRemappings, } = await (0, resolve_composition_component_1.insertJsxElementIntoComposition)({
|
|
@@ -168,7 +177,6 @@ const insertCompositionElementHandler = ({ input: { compositionFile, composition
|
|
|
168
177
|
compositionId,
|
|
169
178
|
element,
|
|
170
179
|
from,
|
|
171
|
-
premountFor,
|
|
172
180
|
prettierConfigOverride: null,
|
|
173
181
|
sourceFileOverrides: null,
|
|
174
182
|
});
|
|
@@ -34,7 +34,7 @@ const hasExpectedFileState = ({ expected, actual, }) => {
|
|
|
34
34
|
}
|
|
35
35
|
return actual.sourceHash === expected.sourceHash;
|
|
36
36
|
};
|
|
37
|
-
const insertElementHandler = async ({ input: { compositionFile, compositionId, captionTarget, element, installationName, expectedFileState, from,
|
|
37
|
+
const insertElementHandler = async ({ input: { compositionFile, compositionId, captionTarget, element, installationName, expectedFileState, from, position, overwriteExisting, undoRedoNavigation, newComposition, }, entryPoint, remotionRoot, logLevel, publicDir, }) => {
|
|
38
38
|
var _a;
|
|
39
39
|
let resolvedAssets;
|
|
40
40
|
try {
|
|
@@ -237,7 +237,6 @@ const insertElementHandler = async ({ input: { compositionFile, compositionId, c
|
|
|
237
237
|
position: componentOwnsSequence ? position : null,
|
|
238
238
|
},
|
|
239
239
|
from: componentOwnsSequence ? from : null,
|
|
240
|
-
premountFor,
|
|
241
240
|
prettierConfigOverride: null,
|
|
242
241
|
wrapInSequence: componentOwnsSequence
|
|
243
242
|
? null
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio-server",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.536",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@remotion/studio-protocol": "4.0.
|
|
26
|
+
"@remotion/studio-protocol": "4.0.536",
|
|
27
27
|
"@babel/types": "7.24.0",
|
|
28
28
|
"@babel/parser": "7.24.1",
|
|
29
29
|
"@svgr/core": "8.1.0",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"kiwi-schema": "0.5.0",
|
|
32
32
|
"semver": "7.5.3",
|
|
33
33
|
"zod": "4.5.4",
|
|
34
|
-
"remotion": "4.0.
|
|
34
|
+
"remotion": "4.0.536",
|
|
35
35
|
"recast": "0.23.21",
|
|
36
|
-
"@remotion/bundler": "4.0.
|
|
37
|
-
"@remotion/renderer": "4.0.
|
|
38
|
-
"@remotion/codemods": "4.0.
|
|
39
|
-
"@remotion/studio-shared": "4.0.
|
|
36
|
+
"@remotion/bundler": "4.0.536",
|
|
37
|
+
"@remotion/renderer": "4.0.536",
|
|
38
|
+
"@remotion/codemods": "4.0.536",
|
|
39
|
+
"@remotion/studio-shared": "4.0.536",
|
|
40
40
|
"memfs": "3.4.3",
|
|
41
41
|
"open": "8.4.2"
|
|
42
42
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ast-types": "0.16.1",
|
|
45
45
|
"react": "19.2.3",
|
|
46
46
|
"@types/semver": "7.5.3",
|
|
47
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
47
|
+
"@remotion/eslint-config-internal": "4.0.536",
|
|
48
48
|
"eslint": "9.19.0",
|
|
49
49
|
"prettier": "3.8.1",
|
|
50
50
|
"@types/node": "20.12.14",
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { CanvasCaptureData } from '@remotion/studio-shared';
|
|
2
|
-
export declare const generateCanvasCaptureComposition: ({ componentName, compositionId, data, durationInFrames, fps, height, keyframeFps, videoFileName, videoHeight, videoWidth, width, }: {
|
|
3
|
-
readonly componentName: string;
|
|
4
|
-
readonly compositionId: string;
|
|
5
|
-
readonly data: CanvasCaptureData;
|
|
6
|
-
readonly durationInFrames: number;
|
|
7
|
-
readonly fps: number;
|
|
8
|
-
readonly height: number;
|
|
9
|
-
readonly keyframeFps: number;
|
|
10
|
-
readonly videoFileName: string;
|
|
11
|
-
readonly videoHeight: number;
|
|
12
|
-
readonly videoWidth: number;
|
|
13
|
-
readonly width: number;
|
|
14
|
-
}) => string;
|
|
@@ -1,239 +0,0 @@
|
|
|
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.generateCanvasCaptureComposition = void 0;
|
|
37
|
-
const recast = __importStar(require("recast"));
|
|
38
|
-
const customCursorRegex = /^\s*url\(/;
|
|
39
|
-
const collapseMouseMovementsByFrame = ({ data, keyframeFps, }) => {
|
|
40
|
-
const movements = [];
|
|
41
|
-
for (const movement of data.mouseMovements) {
|
|
42
|
-
if (movement.canvasX === null || movement.canvasY === null) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
const framedMovement = {
|
|
46
|
-
...movement,
|
|
47
|
-
frame: Math.ceil(movement.timeInSeconds * keyframeFps),
|
|
48
|
-
};
|
|
49
|
-
const previous = movements.at(-1);
|
|
50
|
-
if ((previous === null || previous === void 0 ? void 0 : previous.frame) === framedMovement.frame) {
|
|
51
|
-
movements[movements.length - 1] = framedMovement;
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
movements.push(framedMovement);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
return movements;
|
|
58
|
-
};
|
|
59
|
-
const getCursorName = (cursor) => {
|
|
60
|
-
var _a;
|
|
61
|
-
if (customCursorRegex.test(cursor)) {
|
|
62
|
-
return 'custom';
|
|
63
|
-
}
|
|
64
|
-
return ((_a = cursor.split(',').at(-1)) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) || 'default';
|
|
65
|
-
};
|
|
66
|
-
const serialize = (value) => {
|
|
67
|
-
if (typeof value === 'string') {
|
|
68
|
-
return recast.prettyPrint(recast.types.builders.stringLiteral(value), {
|
|
69
|
-
quote: 'single',
|
|
70
|
-
}).code;
|
|
71
|
-
}
|
|
72
|
-
return JSON.stringify(value);
|
|
73
|
-
};
|
|
74
|
-
const serializeArray = (values, indentation) => {
|
|
75
|
-
const items = values.map(serialize);
|
|
76
|
-
const inline = `[${items.join(', ')}]`;
|
|
77
|
-
if (indentation * 2 + inline.length + 1 <= 80) {
|
|
78
|
-
return inline;
|
|
79
|
-
}
|
|
80
|
-
const lines = [];
|
|
81
|
-
const numeric = values.every((value) => typeof value === 'number');
|
|
82
|
-
for (const item of items) {
|
|
83
|
-
const previous = lines.at(-1);
|
|
84
|
-
if (numeric &&
|
|
85
|
-
previous &&
|
|
86
|
-
(indentation + 1) * 2 + previous.length + item.length + 2 <= 80) {
|
|
87
|
-
lines[lines.length - 1] = `${previous} ${item},`;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
lines.push(`${item},`);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return [
|
|
94
|
-
'[',
|
|
95
|
-
...lines.map((line) => `${'\t'.repeat(indentation + 1)}${line}`),
|
|
96
|
-
`${'\t'.repeat(indentation)}]`,
|
|
97
|
-
].join('\n');
|
|
98
|
-
};
|
|
99
|
-
const generateCanvasCaptureComposition = ({ componentName, compositionId, data, durationInFrames, fps, height, keyframeFps, videoFileName, videoHeight, videoWidth, width, }) => {
|
|
100
|
-
var _a;
|
|
101
|
-
const movements = collapseMouseMovementsByFrame({ data, keyframeFps });
|
|
102
|
-
if (movements.length === 0) {
|
|
103
|
-
throw new Error('The Canvas Capture does not contain cursor movements');
|
|
104
|
-
}
|
|
105
|
-
const cursorKeyframes = movements.reduce((keyframes, movement) => {
|
|
106
|
-
var _a;
|
|
107
|
-
const value = getCursorName(movement.cursor);
|
|
108
|
-
if (((_a = keyframes.at(-1)) === null || _a === void 0 ? void 0 : _a.value) !== value) {
|
|
109
|
-
keyframes.push({ frame: movement.frame, value });
|
|
110
|
-
}
|
|
111
|
-
return keyframes;
|
|
112
|
-
}, []);
|
|
113
|
-
const positionKeyframes = [];
|
|
114
|
-
for (const movement of movements) {
|
|
115
|
-
const previous = positionKeyframes.at(-1);
|
|
116
|
-
if (previous !== undefined && movement.frame - previous.frame > 1) {
|
|
117
|
-
positionKeyframes.push({
|
|
118
|
-
frame: movement.frame - 1,
|
|
119
|
-
value: previous.value,
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
positionKeyframes.push({
|
|
123
|
-
frame: movement.frame,
|
|
124
|
-
value: `${movement.canvasX}px ${movement.canvasY}px`,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
const scaleKeyframes = [
|
|
128
|
-
{ frame: 0, value: data.captureMetadata.density },
|
|
129
|
-
...data.pointerClicks.map((click) => ({
|
|
130
|
-
frame: Math.ceil(click.timeInSeconds * keyframeFps),
|
|
131
|
-
value: click.type === 'pointer-down'
|
|
132
|
-
? data.captureMetadata.density * 0.9
|
|
133
|
-
: data.captureMetadata.density,
|
|
134
|
-
})),
|
|
135
|
-
].reduce((keyframes, keyframe) => {
|
|
136
|
-
var _a, _b;
|
|
137
|
-
if (((_a = keyframes.at(-1)) === null || _a === void 0 ? void 0 : _a.frame) === keyframe.frame) {
|
|
138
|
-
keyframes[keyframes.length - 1] = keyframe;
|
|
139
|
-
}
|
|
140
|
-
else if (((_b = keyframes.at(-1)) === null || _b === void 0 ? void 0 : _b.value) !== keyframe.value) {
|
|
141
|
-
keyframes.push(keyframe);
|
|
142
|
-
}
|
|
143
|
-
return keyframes;
|
|
144
|
-
}, []);
|
|
145
|
-
const customCursor = (_a = movements.find((movement) => customCursorRegex.test(movement.cursor))) === null || _a === void 0 ? void 0 : _a.cursor;
|
|
146
|
-
const cursorProp = cursorKeyframes.length === 1
|
|
147
|
-
? `cursor={${serialize(cursorKeyframes[0].value)}}`
|
|
148
|
-
: `cursor={interpolate(
|
|
149
|
-
frame,
|
|
150
|
-
${serializeArray(cursorKeyframes.map((keyframe) => keyframe.frame), 5)},
|
|
151
|
-
${serializeArray(cursorKeyframes.map((keyframe) => keyframe.value), 5)},
|
|
152
|
-
{
|
|
153
|
-
easing: Easing.step1,
|
|
154
|
-
extrapolateLeft: 'clamp',
|
|
155
|
-
extrapolateRight: 'clamp',
|
|
156
|
-
},
|
|
157
|
-
)}`;
|
|
158
|
-
const scale = scaleKeyframes.length === 1
|
|
159
|
-
? serialize(scaleKeyframes[0].value)
|
|
160
|
-
: `interpolate(
|
|
161
|
-
frame,
|
|
162
|
-
${serializeArray(scaleKeyframes.map((keyframe) => keyframe.frame), 6)},
|
|
163
|
-
${serializeArray(scaleKeyframes.map((keyframe) => keyframe.value), 6)},
|
|
164
|
-
{
|
|
165
|
-
easing: Easing.step1,
|
|
166
|
-
extrapolateLeft: 'clamp',
|
|
167
|
-
extrapolateRight: 'clamp',
|
|
168
|
-
},
|
|
169
|
-
)`;
|
|
170
|
-
const translate = positionKeyframes.length === 1
|
|
171
|
-
? serialize(positionKeyframes[0].value)
|
|
172
|
-
: `interpolate(
|
|
173
|
-
frame,
|
|
174
|
-
${serializeArray(positionKeyframes.map((keyframe) => keyframe.frame), 6)},
|
|
175
|
-
${serializeArray(positionKeyframes.map((keyframe) => keyframe.value), 6)},
|
|
176
|
-
{
|
|
177
|
-
extrapolateLeft: 'clamp',
|
|
178
|
-
extrapolateRight: 'clamp',
|
|
179
|
-
},
|
|
180
|
-
)`;
|
|
181
|
-
const previewComponentName = componentName.endsWith('Composition')
|
|
182
|
-
? `${componentName.slice(0, -'Composition'.length)}Preview`
|
|
183
|
-
: `${componentName}Preview`;
|
|
184
|
-
return `import {MacOSCursor} from '@remotion/mac-cursors';
|
|
185
|
-
import {Video} from '@remotion/media';
|
|
186
|
-
import {
|
|
187
|
-
AbsoluteFill,
|
|
188
|
-
Composition,
|
|
189
|
-
Easing,
|
|
190
|
-
interpolate,
|
|
191
|
-
staticFile,
|
|
192
|
-
useCurrentFrame,
|
|
193
|
-
} from 'remotion';
|
|
194
|
-
|
|
195
|
-
export const ${previewComponentName} = () => {
|
|
196
|
-
const frame = useCurrentFrame();
|
|
197
|
-
|
|
198
|
-
return (
|
|
199
|
-
<AbsoluteFill
|
|
200
|
-
style={{
|
|
201
|
-
width: ${videoWidth},
|
|
202
|
-
height: ${videoHeight},
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<Video
|
|
206
|
-
src={staticFile(${serialize(videoFileName)})}
|
|
207
|
-
style={{
|
|
208
|
-
position: 'absolute',
|
|
209
|
-
}}
|
|
210
|
-
/>
|
|
211
|
-
<MacOSCursor
|
|
212
|
-
${cursorProp}
|
|
213
|
-
${customCursor === undefined ? '' : `\t\t\t\tcustomCursor={${serialize(customCursor)}}\n`} style={{
|
|
214
|
-
position: 'absolute',
|
|
215
|
-
left: 0,
|
|
216
|
-
top: 0,
|
|
217
|
-
scale: ${scale},
|
|
218
|
-
translate: ${translate},
|
|
219
|
-
}}
|
|
220
|
-
/>
|
|
221
|
-
</AbsoluteFill>
|
|
222
|
-
);
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
export const ${componentName} = () => {
|
|
226
|
-
return (
|
|
227
|
-
<Composition
|
|
228
|
-
id={${serialize(compositionId)}}
|
|
229
|
-
component={${previewComponentName}}
|
|
230
|
-
width={${width}}
|
|
231
|
-
height={${height}}
|
|
232
|
-
fps={${fps}}
|
|
233
|
-
durationInFrames={${durationInFrames}}
|
|
234
|
-
/>
|
|
235
|
-
);
|
|
236
|
-
};
|
|
237
|
-
`;
|
|
238
|
-
};
|
|
239
|
-
exports.generateCanvasCaptureComposition = generateCanvasCaptureComposition;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { addEffect, assertValidEffect, ensureEffectImport, makeConfigObjectExpression, } from '@remotion/studio-codemods';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeConfigObjectExpression = exports.ensureEffectImport = exports.assertValidEffect = exports.addEffect = void 0;
|
|
4
|
-
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
-
Object.defineProperty(exports, "addEffect", { enumerable: true, get: function () { return studio_codemods_1.addEffect; } });
|
|
6
|
-
Object.defineProperty(exports, "assertValidEffect", { enumerable: true, get: function () { return studio_codemods_1.assertValidEffect; } });
|
|
7
|
-
Object.defineProperty(exports, "ensureEffectImport", { enumerable: true, get: function () { return studio_codemods_1.ensureEffectImport; } });
|
|
8
|
-
Object.defineProperty(exports, "makeConfigObjectExpression", { enumerable: true, get: function () { return studio_codemods_1.makeConfigObjectExpression; } });
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type CodemodResult } from '@remotion/codemods';
|
|
2
|
-
import type { RecastCodemod, SymbolicatedStackFrame } from '@remotion/studio-shared';
|
|
3
|
-
export declare const resolveFilePathFromSymbolicatedStack: (remotionRoot: string, stack: SymbolicatedStackFrame) => string;
|
|
4
|
-
export declare const applyCodemodToFile: ({ filePath, codeMod, }: {
|
|
5
|
-
filePath: string;
|
|
6
|
-
codeMod: RecastCodemod;
|
|
7
|
-
}) => Promise<CodemodResult>;
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyCodemodToFile = exports.resolveFilePathFromSymbolicatedStack = void 0;
|
|
7
|
-
const node_fs_1 = require("node:fs");
|
|
8
|
-
const promises_1 = require("node:fs/promises");
|
|
9
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
-
const codemods_1 = require("@remotion/codemods");
|
|
11
|
-
const studio_shared_1 = require("@remotion/studio-shared");
|
|
12
|
-
const resolve_file_inside_project_1 = require("../helpers/resolve-file-inside-project");
|
|
13
|
-
const can_update_default_props_1 = require("../preview-server/routes/can-update-default-props");
|
|
14
|
-
const resolveFilePathFromSymbolicatedStack = (remotionRoot, stack) => {
|
|
15
|
-
if (!stack.originalFileName) {
|
|
16
|
-
throw new Error('Could not determine the file where this composition is defined');
|
|
17
|
-
}
|
|
18
|
-
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
19
|
-
remotionRoot,
|
|
20
|
-
fileName: stack.originalFileName,
|
|
21
|
-
action: 'apply codemod to',
|
|
22
|
-
});
|
|
23
|
-
if (!(0, node_fs_1.existsSync)(absolutePath)) {
|
|
24
|
-
throw new Error(`File not found: ${stack.originalFileName}`);
|
|
25
|
-
}
|
|
26
|
-
return absolutePath;
|
|
27
|
-
};
|
|
28
|
-
exports.resolveFilePathFromSymbolicatedStack = resolveFilePathFromSymbolicatedStack;
|
|
29
|
-
const applyCodemodToFile = async ({ filePath, codeMod, }) => {
|
|
30
|
-
var _a, _b, _c, _d;
|
|
31
|
-
(0, can_update_default_props_1.checkIfTypeScriptFile)(filePath);
|
|
32
|
-
const input = await (0, promises_1.readFile)(filePath, 'utf-8');
|
|
33
|
-
const options = {
|
|
34
|
-
project: { files: { [filePath]: input }, rootDir: node_path_1.default.dirname(filePath) },
|
|
35
|
-
compositionFile: filePath,
|
|
36
|
-
};
|
|
37
|
-
if (codeMod.type === 'apply-visual-control') {
|
|
38
|
-
return (0, codemods_1.updateVisualControls)({
|
|
39
|
-
...options,
|
|
40
|
-
filePath,
|
|
41
|
-
changes: codeMod.changes,
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
if (codeMod.type === 'new-composition') {
|
|
45
|
-
const componentFilePath = node_path_1.default.join(node_path_1.default.dirname(filePath), `${codeMod.componentName}.tsx`);
|
|
46
|
-
if ((0, node_fs_1.existsSync)(componentFilePath)) {
|
|
47
|
-
throw new Error(`Cannot create ${componentFilePath} because it already exists`);
|
|
48
|
-
}
|
|
49
|
-
const composition = {
|
|
50
|
-
...options,
|
|
51
|
-
compositionId: codeMod.newId,
|
|
52
|
-
component: {
|
|
53
|
-
filePath: componentFilePath,
|
|
54
|
-
importName: codeMod.componentName,
|
|
55
|
-
importPath: codeMod.componentImportPath,
|
|
56
|
-
},
|
|
57
|
-
metadata: {
|
|
58
|
-
width: codeMod.newWidth,
|
|
59
|
-
height: codeMod.newHeight,
|
|
60
|
-
fps: codeMod.newFps,
|
|
61
|
-
durationInFrames: codeMod.newDurationInFrames,
|
|
62
|
-
},
|
|
63
|
-
folder: codeMod.folderName === null
|
|
64
|
-
? undefined
|
|
65
|
-
: { name: codeMod.folderName, parentName: codeMod.parentName },
|
|
66
|
-
};
|
|
67
|
-
if (codeMod.canvasCapture !== null) {
|
|
68
|
-
return (0, codemods_1.addCanvasCaptureComposition)({
|
|
69
|
-
...composition,
|
|
70
|
-
capture: codeMod.canvasCapture,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const result = (0, codemods_1.addComposition)(composition);
|
|
74
|
-
return {
|
|
75
|
-
...result,
|
|
76
|
-
changes: [
|
|
77
|
-
...result.changes,
|
|
78
|
-
{
|
|
79
|
-
filePath: componentFilePath,
|
|
80
|
-
previousContents: null,
|
|
81
|
-
nextContents: codeMod.asset === null
|
|
82
|
-
? (0, studio_shared_1.emptyCompositionComponent)(codeMod.componentName)
|
|
83
|
-
: (0, studio_shared_1.assetCompositionComponent)({
|
|
84
|
-
asset: codeMod.asset,
|
|
85
|
-
componentName: codeMod.componentName,
|
|
86
|
-
}),
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if (codeMod.type === 'rename-composition') {
|
|
92
|
-
return (0, codemods_1.renameComposition)({
|
|
93
|
-
...options,
|
|
94
|
-
compositionId: codeMod.idToRename,
|
|
95
|
-
newId: codeMod.newId,
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (codeMod.type === 'delete-composition') {
|
|
99
|
-
return (0, codemods_1.deleteComposition)({ ...options, compositionId: codeMod.idToDelete });
|
|
100
|
-
}
|
|
101
|
-
if (codeMod.type === 'duplicate-composition' ||
|
|
102
|
-
codeMod.type === 'update-composition-metadata') {
|
|
103
|
-
const metadata = {
|
|
104
|
-
width: (_a = codeMod.newWidth) !== null && _a !== void 0 ? _a : undefined,
|
|
105
|
-
height: (_b = codeMod.newHeight) !== null && _b !== void 0 ? _b : undefined,
|
|
106
|
-
fps: codeMod.type === 'duplicate-composition' && codeMod.tag === 'Still'
|
|
107
|
-
? undefined
|
|
108
|
-
: ((_c = codeMod.newFps) !== null && _c !== void 0 ? _c : undefined),
|
|
109
|
-
durationInFrames: codeMod.type === 'duplicate-composition' && codeMod.tag === 'Still'
|
|
110
|
-
? undefined
|
|
111
|
-
: ((_d = codeMod.newDurationInFrames) !== null && _d !== void 0 ? _d : undefined),
|
|
112
|
-
};
|
|
113
|
-
const result = codeMod.type === 'duplicate-composition'
|
|
114
|
-
? (0, codemods_1.duplicateComposition)({
|
|
115
|
-
...options,
|
|
116
|
-
compositionId: codeMod.idToDuplicate,
|
|
117
|
-
newId: codeMod.newId,
|
|
118
|
-
tag: codeMod.tag,
|
|
119
|
-
metadata,
|
|
120
|
-
})
|
|
121
|
-
: (0, codemods_1.updateCompositionMetadata)({
|
|
122
|
-
...options,
|
|
123
|
-
compositionId: codeMod.idToUpdate,
|
|
124
|
-
metadata,
|
|
125
|
-
});
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
if (codeMod.type === 'move-composition-or-folder') {
|
|
129
|
-
const target = codeMod.destination;
|
|
130
|
-
const destination = target.type === 'root'
|
|
131
|
-
? target
|
|
132
|
-
: target.type === 'folder'
|
|
133
|
-
? {
|
|
134
|
-
type: 'folder',
|
|
135
|
-
folder: { name: target.folderName, parentName: target.parentName },
|
|
136
|
-
}
|
|
137
|
-
: {
|
|
138
|
-
type: target.type,
|
|
139
|
-
target: target.target.type === 'composition'
|
|
140
|
-
? target.target
|
|
141
|
-
: {
|
|
142
|
-
type: 'folder',
|
|
143
|
-
name: target.target.folderName,
|
|
144
|
-
parentName: target.target.parentName,
|
|
145
|
-
},
|
|
146
|
-
};
|
|
147
|
-
const result = codeMod.source.type === 'composition'
|
|
148
|
-
? (0, codemods_1.moveComposition)({
|
|
149
|
-
...options,
|
|
150
|
-
compositionId: codeMod.source.compositionId,
|
|
151
|
-
destination,
|
|
152
|
-
})
|
|
153
|
-
: (0, codemods_1.moveFolder)({
|
|
154
|
-
...options,
|
|
155
|
-
folder: {
|
|
156
|
-
name: codeMod.source.folderName,
|
|
157
|
-
parentName: codeMod.source.parentName,
|
|
158
|
-
},
|
|
159
|
-
destination,
|
|
160
|
-
});
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
const folder = { name: codeMod.folderName, parentName: codeMod.parentName };
|
|
164
|
-
const folderResult = codeMod.type === 'new-folder'
|
|
165
|
-
? (0, codemods_1.addFolder)({ ...options, folder })
|
|
166
|
-
: codeMod.type === 'rename-folder'
|
|
167
|
-
? (0, codemods_1.renameFolder)({ ...options, folder, newName: codeMod.newName })
|
|
168
|
-
: (0, codemods_1.unwrapFolder)({ ...options, folder });
|
|
169
|
-
return folderResult;
|
|
170
|
-
};
|
|
171
|
-
exports.applyCodemodToFile = applyCodemodToFile;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { File } from '@babel/types';
|
|
2
|
-
import { type ApplyVisualControlCodemod } from '@remotion/studio-shared';
|
|
3
|
-
import type { ApplyCodeModReturnType, Change } from './recast-mods';
|
|
4
|
-
export declare const applyVisualControl: ({ file, transformation, changesMade, }: {
|
|
5
|
-
file: File;
|
|
6
|
-
transformation: ApplyVisualControlCodemod;
|
|
7
|
-
changesMade: Change[];
|
|
8
|
-
}) => ApplyCodeModReturnType;
|