@remotion/studio-server 4.0.535 → 4.0.537
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/api-routes.js +2 -0
- package/dist/preview-server/default-props-watchers.d.ts +3 -2
- package/dist/preview-server/default-props-watchers.js +48 -77
- package/dist/preview-server/routes/can-update-default-props.d.ts +9 -3
- package/dist/preview-server/routes/can-update-default-props.js +43 -10
- 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/dist/preview-server/routes/subscribe-to-default-props.js +2 -1
- package/dist/preview-server/routes/unsubscribe-from-sequence-props.d.ts +2 -2
- package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +12 -10
- package/dist/preview-server/routes/unwrap-node.d.ts +3 -0
- package/dist/preview-server/routes/{wrap-jsx-node.js → unwrap-node.js} +24 -23
- package/dist/preview-server/routes/update-default-props.js +15 -15
- package/dist/preview-server/sequence-props-watchers.js +7 -2
- package/dist/preview-server/undo-stack.d.ts +1 -1
- 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
|
@@ -144,8 +144,13 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: pr
|
|
|
144
144
|
return initialResult;
|
|
145
145
|
}
|
|
146
146
|
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
147
|
-
//
|
|
148
|
-
|
|
147
|
+
// A preferred path may have been remapped while these coordinates still
|
|
148
|
+
// come from the previous bundle. Caching that pair can make a later mount
|
|
149
|
+
// at the same location inherit a different sibling's props after Refresh.
|
|
150
|
+
// Only a location-based subscription can establish a location cache entry.
|
|
151
|
+
if (preferredNodePath === null) {
|
|
152
|
+
(0, node_path_cache_1.setCachedNodePath)(fileName, line, column, initialResult.nodePath.nodePath);
|
|
153
|
+
}
|
|
149
154
|
const { nodePath } = initialResult;
|
|
150
155
|
const watcherKey = getWatcherKey(nodePath, assetKeys);
|
|
151
156
|
const existingWatcher = (_a = sequencePropsWatchers[clientId]) === null || _a === void 0 ? void 0 : _a[watcherKey];
|
|
@@ -4,7 +4,7 @@ export interface UndoEntryDescription {
|
|
|
4
4
|
undoMessage: string;
|
|
5
5
|
redoMessage: string;
|
|
6
6
|
}
|
|
7
|
-
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-nodes' | 'duplicate-nodes' | 'wrap-node' | 'precompose-jsx-nodes' | 'split-sequences' | 'split-video-from-audio' | 'insert-basic-captions' | 'replace-video-source' | 'insert-composition-element' | 'delete-composition' | 'rename-composition' | 'update-composition-metadata' | 'new-composition' | 'duplicate-composition' | 'move-composition-or-folder' | 'new-folder' | 'delete-folder' | 'rename-folder';
|
|
7
|
+
type UndoEntryType = 'visual-control' | 'default-props' | 'sequence-props' | 'effect-props' | 'keyframe-add' | 'keyframe-delete' | 'add-effect' | 'delete-effect' | 'duplicate-effect' | 'paste-effects' | 'reorder-effect' | 'reorder-sequence' | 'delete-nodes' | 'duplicate-nodes' | 'wrap-node' | 'unwrap-node' | 'precompose-jsx-nodes' | 'split-sequences' | 'split-video-from-audio' | 'insert-basic-captions' | 'replace-video-source' | 'insert-composition-element' | 'delete-composition' | 'rename-composition' | 'update-composition-metadata' | 'new-composition' | 'duplicate-composition' | 'move-composition-or-folder' | 'new-folder' | 'delete-folder' | 'rename-folder';
|
|
8
8
|
type UndoEntrySnapshot = {
|
|
9
9
|
filePath: string;
|
|
10
10
|
oldContents: string | 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.537",
|
|
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.537",
|
|
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.537",
|
|
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.537",
|
|
37
|
+
"@remotion/renderer": "4.0.537",
|
|
38
|
+
"@remotion/codemods": "4.0.537",
|
|
39
|
+
"@remotion/studio-shared": "4.0.537",
|
|
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.537",
|
|
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;
|
|
@@ -1,89 +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.applyVisualControl = void 0;
|
|
37
|
-
const studio_shared_1 = require("@remotion/studio-shared");
|
|
38
|
-
const recast = __importStar(require("recast"));
|
|
39
|
-
const parse_ast_1 = require("./parse-ast");
|
|
40
|
-
const expectString = (node) => {
|
|
41
|
-
if (node.type === 'StringLiteral') {
|
|
42
|
-
return node.value;
|
|
43
|
-
}
|
|
44
|
-
if (node.type === 'TemplateLiteral') {
|
|
45
|
-
if (node.expressions.length > 0) {
|
|
46
|
-
throw new Error('applyVisualControl() must use a static identifier, the string may not be dynamic.');
|
|
47
|
-
}
|
|
48
|
-
return node.quasis[0].value.raw;
|
|
49
|
-
}
|
|
50
|
-
throw new Error('Expected a string literal');
|
|
51
|
-
};
|
|
52
|
-
const applyVisualControl = ({ file, transformation, changesMade, }) => {
|
|
53
|
-
recast.types.visit(file.program, {
|
|
54
|
-
visitCallExpression(path) {
|
|
55
|
-
const { node } = path;
|
|
56
|
-
if (node.type !== 'CallExpression') {
|
|
57
|
-
throw new Error('Expected a call expression');
|
|
58
|
-
}
|
|
59
|
-
if (node.callee.type !== 'Identifier') {
|
|
60
|
-
return this.traverse(path);
|
|
61
|
-
}
|
|
62
|
-
if (node.callee.name !== 'visualControl') {
|
|
63
|
-
return this.traverse(path);
|
|
64
|
-
}
|
|
65
|
-
const firstArgument = node.arguments[0];
|
|
66
|
-
const str = expectString(firstArgument);
|
|
67
|
-
for (const change of transformation.changes) {
|
|
68
|
-
if (change.id !== str) {
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
let parsed;
|
|
72
|
-
if (change.newValueIsUndefined) {
|
|
73
|
-
parsed = (0, parse_ast_1.parseAst)('a = undefined').program
|
|
74
|
-
.body[0].expression.right;
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
parsed = (0, parse_ast_1.parseAst)(`a = ${(0, studio_shared_1.stringifyDefaultProps)({ props: JSON.parse(change.newValueSerialized), enumPaths: change.enumPaths })}`).program.body[0].expression.right;
|
|
78
|
-
}
|
|
79
|
-
node.arguments[1] = parsed;
|
|
80
|
-
changesMade.push({
|
|
81
|
-
description: `Applied visual control ${change.id}`,
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return this.traverse(path);
|
|
85
|
-
},
|
|
86
|
-
});
|
|
87
|
-
return { newAst: file, changesMade };
|
|
88
|
-
};
|
|
89
|
-
exports.applyVisualControl = applyVisualControl;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { deleteEffect, deleteEffects, type EffectDeletionTarget, } from '@remotion/studio-codemods';
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteEffects = exports.deleteEffect = void 0;
|
|
4
|
-
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
-
Object.defineProperty(exports, "deleteEffect", { enumerable: true, get: function () { return studio_codemods_1.deleteEffect; } });
|
|
6
|
-
Object.defineProperty(exports, "deleteEffects", { enumerable: true, get: function () { return studio_codemods_1.deleteEffects; } });
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { deleteJsxElementAtPath, findJsxElementPathForDeletion, getJsxElementTagLabel } from '@remotion/studio-codemods';
|
|
2
|
-
import type { SequenceNodePath } from 'remotion';
|
|
3
|
-
export { deleteJsxElementAtPath, findJsxElementPathForDeletion, getJsxElementTagLabel, };
|
|
4
|
-
export declare const deleteJsxNodes: ({ input, nodePaths, }: {
|
|
5
|
-
input: string;
|
|
6
|
-
nodePaths: SequenceNodePath[];
|
|
7
|
-
}) => Promise<{
|
|
8
|
-
output: string;
|
|
9
|
-
formatted: boolean;
|
|
10
|
-
nodeLabels: string[];
|
|
11
|
-
logLines: number[];
|
|
12
|
-
nodePathRemappings: import("@remotion/studio-shared").SequenceNodePathRemapping[];
|
|
13
|
-
}>;
|
|
14
|
-
export declare const deleteJsxNode: ({ input, nodePath, }: {
|
|
15
|
-
input: string;
|
|
16
|
-
nodePath: SequenceNodePath;
|
|
17
|
-
}) => Promise<{
|
|
18
|
-
output: string;
|
|
19
|
-
formatted: boolean;
|
|
20
|
-
nodeLabel: string;
|
|
21
|
-
logLine: number;
|
|
22
|
-
}>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteJsxNode = exports.deleteJsxNodes = exports.getJsxElementTagLabel = exports.findJsxElementPathForDeletion = exports.deleteJsxElementAtPath = void 0;
|
|
4
|
-
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
-
Object.defineProperty(exports, "deleteJsxElementAtPath", { enumerable: true, get: function () { return studio_codemods_1.deleteJsxElementAtPath; } });
|
|
6
|
-
Object.defineProperty(exports, "findJsxElementPathForDeletion", { enumerable: true, get: function () { return studio_codemods_1.findJsxElementPathForDeletion; } });
|
|
7
|
-
Object.defineProperty(exports, "getJsxElementTagLabel", { enumerable: true, get: function () { return studio_codemods_1.getJsxElementTagLabel; } });
|
|
8
|
-
const deleteJsxNodes = ({ input, nodePaths, }) => (0, studio_codemods_1.deleteJsxNodes)({
|
|
9
|
-
input,
|
|
10
|
-
nodePaths,
|
|
11
|
-
});
|
|
12
|
-
exports.deleteJsxNodes = deleteJsxNodes;
|
|
13
|
-
const deleteJsxNode = ({ input, nodePath, }) => (0, studio_codemods_1.deleteJsxNode)({
|
|
14
|
-
input,
|
|
15
|
-
nodePath,
|
|
16
|
-
});
|
|
17
|
-
exports.deleteJsxNode = deleteJsxNode;
|