@remotion/studio-server 4.0.526 → 4.0.528
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/apply-codemod-to-file.d.ts +2 -1
- package/dist/codemods/apply-codemod-to-file.js +142 -8
- package/dist/codemods/{delete-jsx-node.d.ts → delete-jsx-nodes.d.ts} +1 -10
- package/dist/codemods/delete-jsx-nodes.js +10 -0
- package/dist/codemods/paste-effects.d.ts +15 -1
- package/dist/codemods/paste-effects.js +3 -2
- package/dist/codemods/split-jsx-sequence.d.ts +14 -0
- package/dist/codemods/split-jsx-sequence.js +10 -3
- package/dist/codemods/update-effect-props/update-effect-props.d.ts +11 -3
- package/dist/codemods/update-effect-props/update-effect-props.js +17 -10
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +31 -10
- package/dist/codemods/update-keyframes/update-keyframes.js +24 -7
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +3 -6
- package/dist/codemods/update-sequence-props/update-sequence-props.js +16 -9
- package/dist/helpers/open-file-for-writing-without-symlinks.d.ts +6 -1
- package/dist/helpers/open-file-for-writing-without-symlinks.js +9 -6
- package/dist/helpers/resolve-composition-component.d.ts +1 -1
- package/dist/helpers/resolve-composition-component.js +5 -4
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -6
- package/dist/preview-server/api-routes.js +8 -2
- package/dist/preview-server/hot-middleware/index.js +13 -46
- package/dist/preview-server/routes/add-effect.js +17 -8
- package/dist/preview-server/routes/apply-codemod.d.ts +0 -19
- package/dist/preview-server/routes/apply-codemod.js +24 -26
- package/dist/preview-server/routes/apply-visual-control-change.js +13 -65
- package/dist/preview-server/routes/can-update-default-props.d.ts +1 -1
- package/dist/preview-server/routes/can-update-default-props.js +3 -4
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +0 -10
- package/dist/preview-server/routes/can-update-sequence-props.js +62 -495
- package/dist/preview-server/routes/delete-effect.js +15 -13
- package/dist/preview-server/routes/delete-jsx-nodes.d.ts +3 -0
- package/dist/preview-server/routes/{delete-jsx-node.js → delete-jsx-nodes.js} +23 -12
- package/dist/preview-server/routes/download-remote-asset.d.ts +5 -0
- package/dist/preview-server/routes/download-remote-asset.js +25 -20
- package/dist/preview-server/routes/duplicate-effect.js +12 -4
- package/dist/preview-server/routes/duplicate-jsx-node.js +15 -4
- package/dist/preview-server/routes/element-install-plan.d.ts +1 -1
- package/dist/preview-server/routes/find-in-file.d.ts +9 -1
- package/dist/preview-server/routes/find-in-file.js +3 -4
- package/dist/preview-server/routes/insert-basic-captions.d.ts +3 -0
- package/dist/preview-server/routes/insert-basic-captions.js +119 -0
- package/dist/preview-server/routes/insert-element.js +399 -280
- package/dist/preview-server/routes/install-dependency.js +14 -4
- package/dist/preview-server/routes/prepare-element-install.js +3 -0
- package/dist/preview-server/routes/reorder-effect.js +12 -5
- package/dist/preview-server/routes/reorder-sequence.js +10 -5
- package/dist/preview-server/routes/replace-video-source.d.ts +3 -0
- package/dist/preview-server/routes/replace-video-source.js +81 -0
- package/dist/preview-server/routes/save-sequence-props.js +8 -28
- package/dist/preview-server/routes/split-jsx-sequence.js +82 -42
- package/dist/preview-server/routes/split-video-from-audio.js +9 -4
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +6 -10
- package/dist/preview-server/routes/update-config.js +38 -2
- package/dist/preview-server/routes/update-default-props.js +12 -8
- package/dist/preview-server/routes/wrap-jsx-node.d.ts +3 -0
- package/dist/preview-server/routes/wrap-jsx-node.js +97 -0
- package/dist/preview-server/studio-protocol/handle-discovery.js +1 -1
- package/dist/preview-server/studio-protocol/handle-element-library.js +3 -3
- package/dist/preview-server/undo-stack.d.ts +2 -1
- package/dist/preview-server/undo-stack.js +19 -0
- package/dist/routes.js +2 -0
- 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-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.js +0 -17
- 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/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-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/preview-server/routes/delete-jsx-node.d.ts +0 -3
- package/dist/preview-server/routes/update-public-license.d.ts +0 -11
- package/dist/preview-server/routes/update-public-license.js +0 -97
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type CodemodResult } from '@remotion/codemods';
|
|
1
2
|
import type { RecastCodemod, SymbolicatedStackFrame } from '@remotion/studio-shared';
|
|
2
3
|
export declare const resolveFilePathFromSymbolicatedStack: (remotionRoot: string, stack: SymbolicatedStackFrame) => string;
|
|
3
4
|
export declare const applyCodemodToFile: ({ filePath, codeMod, }: {
|
|
4
5
|
filePath: string;
|
|
5
6
|
codeMod: RecastCodemod;
|
|
6
|
-
}) => Promise<
|
|
7
|
+
}) => Promise<CodemodResult>;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.applyCodemodToFile = exports.resolveFilePathFromSymbolicatedStack = void 0;
|
|
4
7
|
const node_fs_1 = require("node:fs");
|
|
5
|
-
const
|
|
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");
|
|
6
12
|
const resolve_file_inside_project_1 = require("../helpers/resolve-file-inside-project");
|
|
7
13
|
const can_update_default_props_1 = require("../preview-server/routes/can-update-default-props");
|
|
8
14
|
const resolveFilePathFromSymbolicatedStack = (remotionRoot, stack) => {
|
|
@@ -20,13 +26,141 @@ const resolveFilePathFromSymbolicatedStack = (remotionRoot, stack) => {
|
|
|
20
26
|
return absolutePath;
|
|
21
27
|
};
|
|
22
28
|
exports.resolveFilePathFromSymbolicatedStack = resolveFilePathFromSymbolicatedStack;
|
|
23
|
-
const applyCodemodToFile = ({ filePath, codeMod, }) => {
|
|
29
|
+
const applyCodemodToFile = async ({ filePath, codeMod, }) => {
|
|
30
|
+
var _a, _b, _c, _d;
|
|
24
31
|
(0, can_update_default_props_1.checkIfTypeScriptFile)(filePath);
|
|
25
|
-
const input = (0,
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
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: (0, studio_shared_1.emptyCompositionComponent)(codeMod.componentName),
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (codeMod.type === 'rename-composition') {
|
|
87
|
+
return (0, codemods_1.renameComposition)({
|
|
88
|
+
...options,
|
|
89
|
+
compositionId: codeMod.idToRename,
|
|
90
|
+
newId: codeMod.newId,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if (codeMod.type === 'delete-composition') {
|
|
94
|
+
return (0, codemods_1.deleteComposition)({ ...options, compositionId: codeMod.idToDelete });
|
|
95
|
+
}
|
|
96
|
+
if (codeMod.type === 'duplicate-composition' ||
|
|
97
|
+
codeMod.type === 'update-composition-metadata') {
|
|
98
|
+
const metadata = {
|
|
99
|
+
width: (_a = codeMod.newWidth) !== null && _a !== void 0 ? _a : undefined,
|
|
100
|
+
height: (_b = codeMod.newHeight) !== null && _b !== void 0 ? _b : undefined,
|
|
101
|
+
fps: codeMod.type === 'duplicate-composition' && codeMod.tag === 'Still'
|
|
102
|
+
? undefined
|
|
103
|
+
: ((_c = codeMod.newFps) !== null && _c !== void 0 ? _c : undefined),
|
|
104
|
+
durationInFrames: codeMod.type === 'duplicate-composition' && codeMod.tag === 'Still'
|
|
105
|
+
? undefined
|
|
106
|
+
: ((_d = codeMod.newDurationInFrames) !== null && _d !== void 0 ? _d : undefined),
|
|
107
|
+
};
|
|
108
|
+
const result = codeMod.type === 'duplicate-composition'
|
|
109
|
+
? (0, codemods_1.duplicateComposition)({
|
|
110
|
+
...options,
|
|
111
|
+
compositionId: codeMod.idToDuplicate,
|
|
112
|
+
newId: codeMod.newId,
|
|
113
|
+
tag: codeMod.tag,
|
|
114
|
+
metadata,
|
|
115
|
+
})
|
|
116
|
+
: (0, codemods_1.updateCompositionMetadata)({
|
|
117
|
+
...options,
|
|
118
|
+
compositionId: codeMod.idToUpdate,
|
|
119
|
+
metadata,
|
|
120
|
+
});
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
if (codeMod.type === 'move-composition-or-folder') {
|
|
124
|
+
const target = codeMod.destination;
|
|
125
|
+
const destination = target.type === 'root'
|
|
126
|
+
? target
|
|
127
|
+
: target.type === 'folder'
|
|
128
|
+
? {
|
|
129
|
+
type: 'folder',
|
|
130
|
+
folder: { name: target.folderName, parentName: target.parentName },
|
|
131
|
+
}
|
|
132
|
+
: {
|
|
133
|
+
type: target.type,
|
|
134
|
+
target: target.target.type === 'composition'
|
|
135
|
+
? target.target
|
|
136
|
+
: {
|
|
137
|
+
type: 'folder',
|
|
138
|
+
name: target.target.folderName,
|
|
139
|
+
parentName: target.target.parentName,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
const result = codeMod.source.type === 'composition'
|
|
143
|
+
? (0, codemods_1.moveComposition)({
|
|
144
|
+
...options,
|
|
145
|
+
compositionId: codeMod.source.compositionId,
|
|
146
|
+
destination,
|
|
147
|
+
})
|
|
148
|
+
: (0, codemods_1.moveFolder)({
|
|
149
|
+
...options,
|
|
150
|
+
folder: {
|
|
151
|
+
name: codeMod.source.folderName,
|
|
152
|
+
parentName: codeMod.source.parentName,
|
|
153
|
+
},
|
|
154
|
+
destination,
|
|
155
|
+
});
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
const folder = { name: codeMod.folderName, parentName: codeMod.parentName };
|
|
159
|
+
const folderResult = codeMod.type === 'new-folder'
|
|
160
|
+
? (0, codemods_1.addFolder)({ ...options, folder })
|
|
161
|
+
: codeMod.type === 'rename-folder'
|
|
162
|
+
? (0, codemods_1.renameFolder)({ ...options, folder, newName: codeMod.newName })
|
|
163
|
+
: (0, codemods_1.unwrapFolder)({ ...options, folder });
|
|
164
|
+
return folderResult;
|
|
31
165
|
};
|
|
32
166
|
exports.applyCodemodToFile = applyCodemodToFile;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { deleteJsxElementAtPath, findJsxElementPathForDeletion, getJsxElementTagLabel } from '@remotion/studio-codemods';
|
|
2
1
|
import type { SequenceNodePath } from 'remotion';
|
|
2
|
+
declare const deleteJsxElementAtPath: (jsxPath: import("ast-types/lib/node-path").NodePath<N, V>) => void, findJsxElementPathForDeletion: (ast: import("@babel/types").File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null, getJsxElementTagLabel: (element: import("@babel/types").JSXElement) => string;
|
|
3
3
|
export { deleteJsxElementAtPath, findJsxElementPathForDeletion, getJsxElementTagLabel, };
|
|
4
4
|
export declare const deleteJsxNodes: ({ input, nodePaths, }: {
|
|
5
5
|
input: string;
|
|
@@ -11,12 +11,3 @@ export declare const deleteJsxNodes: ({ input, nodePaths, }: {
|
|
|
11
11
|
logLines: number[];
|
|
12
12
|
nodePathRemappings: import("@remotion/studio-shared").SequenceNodePathRemapping[];
|
|
13
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
|
-
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteJsxNodes = exports.getJsxElementTagLabel = exports.findJsxElementPathForDeletion = exports.deleteJsxElementAtPath = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const { deleteJsxElementAtPath, deleteJsxNodes: deleteJsxNodesCodemod, findJsxElementPathForDeletion, getJsxElementTagLabel, } = codemods_1.CodemodsInternals;
|
|
6
|
+
const deleteJsxNodes = ({ input, nodePaths, }) => deleteJsxNodesCodemod({
|
|
7
|
+
input,
|
|
8
|
+
nodePaths,
|
|
9
|
+
});
|
|
10
|
+
exports.deleteJsxNodes = deleteJsxNodes;
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
declare const pasteEffectsCodemod: ({ effects, input, insertAtIndices, prettierConfigOverride, targetSequenceNodePath, type, }: {
|
|
2
|
+
effects: import("@remotion/studio-shared").EffectClipboardSnapshot[];
|
|
3
|
+
input: string;
|
|
4
|
+
insertAtIndices: number[] | null;
|
|
5
|
+
targetSequenceNodePath: import("remotion").SequenceNodePath;
|
|
6
|
+
type: import("@remotion/studio-shared").EffectClipboardPasteType;
|
|
7
|
+
} & {
|
|
8
|
+
formatFile?: import("@remotion/codemods").FormatEffectFile | undefined;
|
|
9
|
+
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
10
|
+
}) => Promise<{
|
|
11
|
+
output: string;
|
|
12
|
+
formatted: boolean;
|
|
13
|
+
effectLabels: string[];
|
|
14
|
+
logLine: number;
|
|
15
|
+
}>;
|
|
2
16
|
type PasteEffectsInput = Parameters<typeof pasteEffectsCodemod>[0] & {
|
|
3
17
|
readonly targetFileName: string;
|
|
4
18
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.pasteEffects = void 0;
|
|
4
|
-
const
|
|
5
|
-
const pasteEffects
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const { pasteEffects: pasteEffectsCodemod } = codemods_1.CodemodsInternals;
|
|
6
|
+
const pasteEffects = (input) => pasteEffectsCodemod(input);
|
|
6
7
|
exports.pasteEffects = pasteEffects;
|
|
@@ -11,3 +11,17 @@ export declare const splitJsxSequence: ({ input, nodePath, sequenceKeys, splitFr
|
|
|
11
11
|
logLine: number;
|
|
12
12
|
nodePathRemappings: import("@remotion/studio-shared").SequenceNodePathRemapping[];
|
|
13
13
|
}>;
|
|
14
|
+
export declare const splitJsxSequences: ({ input, splits, prettierConfigOverride, }: {
|
|
15
|
+
input: string;
|
|
16
|
+
splits: {
|
|
17
|
+
nodePath: SequenceNodePath;
|
|
18
|
+
sequenceKeys: string[];
|
|
19
|
+
splitFrame: number;
|
|
20
|
+
}[];
|
|
21
|
+
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
22
|
+
}) => Promise<{
|
|
23
|
+
output: string;
|
|
24
|
+
nodeLabels: string[];
|
|
25
|
+
logLines: number[];
|
|
26
|
+
nodePathRemappings: import("@remotion/studio-shared").SequenceNodePathRemapping[];
|
|
27
|
+
}>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.splitJsxSequence = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
3
|
+
exports.splitJsxSequences = exports.splitJsxSequence = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const { splitJsxSequence: splitJsxSequenceCodemod, splitJsxSequences: splitJsxSequencesCodemod, } = codemods_1.CodemodsInternals;
|
|
6
|
+
const splitJsxSequence = ({ input, nodePath, sequenceKeys, splitFrame, prettierConfigOverride, }) => splitJsxSequenceCodemod({
|
|
6
7
|
input,
|
|
7
8
|
nodePath,
|
|
8
9
|
sequenceKeys,
|
|
@@ -10,3 +11,9 @@ const splitJsxSequence = ({ input, nodePath, sequenceKeys, splitFrame, prettierC
|
|
|
10
11
|
prettierConfigOverride,
|
|
11
12
|
});
|
|
12
13
|
exports.splitJsxSequence = splitJsxSequence;
|
|
14
|
+
const splitJsxSequences = ({ input, splits, prettierConfigOverride, }) => splitJsxSequencesCodemod({
|
|
15
|
+
input,
|
|
16
|
+
splits,
|
|
17
|
+
prettierConfigOverride,
|
|
18
|
+
});
|
|
19
|
+
exports.splitJsxSequences = splitJsxSequences;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { type EffectArrayElement, type EffectPropUpdate, type PropDelta, type UpdateEffectPropsResult } from '@remotion/codemods';
|
|
2
|
+
import type { InteractivitySchema, SequenceNodePath } from 'remotion';
|
|
3
|
+
export type { EffectArrayElement, EffectPropUpdate, PropDelta, UpdateEffectPropsResult, };
|
|
4
|
+
export declare const enumerateEffectArrayElements: (arr: import("@babel/types").ArrayExpression) => EffectArrayElement[];
|
|
5
|
+
export declare const updateEffectProps: ({ input, sequenceNodePath, effectIndex, update, schema, }: {
|
|
6
|
+
input: string;
|
|
7
|
+
sequenceNodePath: SequenceNodePath;
|
|
8
|
+
effectIndex: number;
|
|
9
|
+
update: EffectPropUpdate;
|
|
10
|
+
schema: InteractivitySchema;
|
|
11
|
+
}) => Promise<UpdateEffectPropsResult>;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
exports.updateEffectProps = exports.enumerateEffectArrayElements = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
({ enumerateEffectArrayElements: exports.enumerateEffectArrayElements } = codemods_1.CodemodsInternals);
|
|
6
|
+
const updateEffectProps = async ({ input, sequenceNodePath, effectIndex, update, schema, }) => {
|
|
7
|
+
var _a;
|
|
8
|
+
var _b;
|
|
9
|
+
const result = await (0, codemods_1.updateEffectProps)({
|
|
10
|
+
project: { files: { 'source.tsx': input }, rootDir: '/' },
|
|
11
|
+
effect: { filePath: 'source.tsx', nodePath: sequenceNodePath, effectIndex },
|
|
12
|
+
updates: [update],
|
|
13
|
+
schema,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
...result.results[0],
|
|
17
|
+
output: (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : input,
|
|
18
|
+
};
|
|
12
19
|
};
|
|
13
|
-
exports.
|
|
20
|
+
exports.updateEffectProps = updateEffectProps;
|
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type EffectKeyframeUpdate, type IntroducedKeyframeIdentifiers, type KeyframeOperation, type SequenceKeyframeUpdate } from '@remotion/codemods';
|
|
2
|
+
import type { InteractivitySchema, SequenceNodePath, VideoConfigValues } from 'remotion';
|
|
3
|
+
export type { EffectKeyframeUpdate, IntroducedKeyframeIdentifiers, KeyframeOperation, SequenceKeyframeUpdate, };
|
|
4
|
+
type KeyframeInput = {
|
|
5
|
+
input: string;
|
|
6
|
+
updates: SequenceKeyframeUpdate[];
|
|
7
|
+
schema?: InteractivitySchema;
|
|
8
|
+
prettierConfigOverride?: Record<string, unknown> | null;
|
|
9
|
+
videoConfigValues: VideoConfigValues | null;
|
|
10
|
+
};
|
|
11
|
+
export declare const updateSequenceKeyframes: ({ input, nodePath, videoConfigValues, ...options }: KeyframeInput & {
|
|
12
|
+
nodePath: SequenceNodePath;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
changes: import("@remotion/codemods").CodemodFileChange[];
|
|
15
|
+
nodePathRemappings: import("@remotion/codemods").JsxNodePathRemapping[];
|
|
7
16
|
formatted: boolean;
|
|
8
17
|
oldValueStrings: string[];
|
|
9
18
|
newValueStrings: string[];
|
|
10
19
|
logLine: number;
|
|
11
|
-
updatedNodePath:
|
|
12
|
-
|
|
13
|
-
export declare const updateEffectKeyframes: (input: UpdateEffectKeyframesInput) => Promise<{
|
|
20
|
+
updatedNodePath: SequenceNodePath;
|
|
21
|
+
updatedNode: import("@remotion/codemods").JsxNodeReference;
|
|
14
22
|
output: string;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const updateEffectKeyframes: ({ input, sequenceNodePath, effectIndex, videoConfigValues, ...options }: KeyframeInput & {
|
|
25
|
+
sequenceNodePath: SequenceNodePath;
|
|
26
|
+
effectIndex: number;
|
|
27
|
+
}) => Promise<{
|
|
28
|
+
changes: import("@remotion/codemods").CodemodFileChange[];
|
|
29
|
+
nodePathRemappings: import("@remotion/codemods").JsxNodePathRemapping[];
|
|
15
30
|
formatted: boolean;
|
|
16
31
|
oldValueStrings: string[];
|
|
17
32
|
newValueStrings: string[];
|
|
18
33
|
logLine: number;
|
|
19
34
|
effectCallee: string;
|
|
20
|
-
updatedSequenceNodePath:
|
|
35
|
+
updatedSequenceNodePath: SequenceNodePath;
|
|
36
|
+
updatedEffect: {
|
|
37
|
+
filePath: string;
|
|
38
|
+
nodePath: SequenceNodePath;
|
|
39
|
+
effectIndex: number;
|
|
40
|
+
};
|
|
41
|
+
output: string;
|
|
21
42
|
}>;
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEffectKeyframes = exports.updateSequenceKeyframes =
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
3
|
+
exports.updateEffectKeyframes = exports.updateSequenceKeyframes = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const updateSequenceKeyframes = async ({ input, nodePath, videoConfigValues, ...options }) => {
|
|
6
|
+
var _a;
|
|
7
|
+
var _b;
|
|
8
|
+
const result = await (0, codemods_1.updateJsxNodeKeyframes)({
|
|
9
|
+
project: { files: { 'source.tsx': input }, rootDir: '/' },
|
|
10
|
+
node: { filePath: 'source.tsx', nodePath },
|
|
11
|
+
videoConfig: videoConfigValues !== null && videoConfigValues !== void 0 ? videoConfigValues : undefined,
|
|
12
|
+
...options,
|
|
13
|
+
});
|
|
14
|
+
return { ...result, output: (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : input };
|
|
15
|
+
};
|
|
9
16
|
exports.updateSequenceKeyframes = updateSequenceKeyframes;
|
|
10
|
-
const updateEffectKeyframes = (input
|
|
17
|
+
const updateEffectKeyframes = async ({ input, sequenceNodePath, effectIndex, videoConfigValues, ...options }) => {
|
|
18
|
+
var _a;
|
|
19
|
+
var _b;
|
|
20
|
+
const result = await (0, codemods_1.updateEffectKeyframes)({
|
|
21
|
+
project: { files: { 'source.tsx': input }, rootDir: '/' },
|
|
22
|
+
effect: { filePath: 'source.tsx', nodePath: sequenceNodePath, effectIndex },
|
|
23
|
+
videoConfig: videoConfigValues !== null && videoConfigValues !== void 0 ? videoConfigValues : undefined,
|
|
24
|
+
...options,
|
|
25
|
+
});
|
|
26
|
+
return { ...result, output: (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : input };
|
|
27
|
+
};
|
|
11
28
|
exports.updateEffectKeyframes = updateEffectKeyframes;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate, updateSequencePropsAst } from '@remotion/studio-codemods';
|
|
1
|
+
import { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate } from '@remotion/codemods';
|
|
3
2
|
import type { InteractivitySchema, SequenceNodePath, VideoConfigValues } from 'remotion';
|
|
4
|
-
export { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate,
|
|
3
|
+
export { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate, };
|
|
5
4
|
type PrettierConfigOverride = Record<string, unknown> | null;
|
|
6
5
|
type UpdateMultipleSequencePropsResult = {
|
|
7
6
|
output: string;
|
|
8
7
|
formatted: boolean;
|
|
9
8
|
results: SequencePropsNodeUpdateResult[];
|
|
10
|
-
ast: File;
|
|
11
9
|
};
|
|
12
10
|
type UpdateSequencePropsResult = {
|
|
13
11
|
output: string;
|
|
@@ -16,11 +14,10 @@ type UpdateSequencePropsResult = {
|
|
|
16
14
|
logLine: number;
|
|
17
15
|
removedProps: RemovedProp[];
|
|
18
16
|
};
|
|
19
|
-
export declare const updateMultipleSequenceProps: ({ input, changes, prettierConfigOverride,
|
|
17
|
+
export declare const updateMultipleSequenceProps: ({ input, changes, prettierConfigOverride, }: {
|
|
20
18
|
input: string;
|
|
21
19
|
changes: SequencePropsNodeUpdate[];
|
|
22
20
|
prettierConfigOverride: PrettierConfigOverride;
|
|
23
|
-
ast?: File | undefined;
|
|
24
21
|
}) => Promise<UpdateMultipleSequencePropsResult>;
|
|
25
22
|
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, videoConfigValues, }: {
|
|
26
23
|
input: string;
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateSequenceProps = exports.updateMultipleSequenceProps =
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const updateMultipleSequenceProps = ({ input, changes, prettierConfigOverride, ast: providedAst, }) => {
|
|
3
|
+
exports.updateSequenceProps = exports.updateMultipleSequenceProps = void 0;
|
|
4
|
+
const codemods_1 = require("@remotion/codemods");
|
|
5
|
+
const updateMultipleSequenceProps = ({ input, changes, prettierConfigOverride, }) => {
|
|
7
6
|
return Promise.resolve().then(() => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
var _a;
|
|
8
|
+
var _b;
|
|
9
|
+
const result = (0, codemods_1.updateMultipleJsxNodeProps)({
|
|
10
|
+
project: { files: { 'source.tsx': input }, rootDir: '/' },
|
|
11
|
+
changes: changes.map(({ nodePath, updates, schema, videoConfigValues }) => ({
|
|
12
|
+
node: { filePath: 'source.tsx', nodePath },
|
|
13
|
+
updates,
|
|
14
|
+
schema,
|
|
15
|
+
videoConfig: videoConfigValues !== null && videoConfigValues !== void 0 ? videoConfigValues : undefined,
|
|
16
|
+
})),
|
|
12
17
|
prettierConfigOverride,
|
|
13
18
|
});
|
|
14
|
-
|
|
19
|
+
const output = (_b = (_a = result.changes[0]) === null || _a === void 0 ? void 0 : _a.nextContents) !== null && _b !== void 0 ? _b : input;
|
|
20
|
+
const { results } = result;
|
|
21
|
+
return { output, formatted: true, results };
|
|
15
22
|
});
|
|
16
23
|
};
|
|
17
24
|
exports.updateMultipleSequenceProps = updateMultipleSequenceProps;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
export declare const
|
|
1
|
+
export declare const assertNoSymlinks: ({ rootDirectory, absolutePath, }: {
|
|
2
2
|
rootDirectory: string;
|
|
3
3
|
absolutePath: string;
|
|
4
|
+
}) => void;
|
|
5
|
+
export declare const openFileForWritingWithoutSymlinks: ({ rootDirectory, absolutePath, exclusive, }: {
|
|
6
|
+
rootDirectory: string;
|
|
7
|
+
absolutePath: string;
|
|
8
|
+
exclusive: boolean;
|
|
4
9
|
}) => number;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.openFileForWritingWithoutSymlinks = void 0;
|
|
6
|
+
exports.openFileForWritingWithoutSymlinks = exports.assertNoSymlinks = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const assertNoSymlinks = ({ rootDirectory, absolutePath, }) => {
|
|
@@ -29,23 +29,26 @@ const assertNoSymlinks = ({ rootDirectory, absolutePath, }) => {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
exports.assertNoSymlinks = assertNoSymlinks;
|
|
33
|
+
const openFileForWritingWithoutSymlinks = ({ rootDirectory, absolutePath, exclusive, }) => {
|
|
33
34
|
const resolvedRootDirectory = node_path_1.default.resolve(rootDirectory);
|
|
34
35
|
const resolvedAbsolutePath = node_path_1.default.resolve(absolutePath);
|
|
35
|
-
assertNoSymlinks({
|
|
36
|
+
(0, exports.assertNoSymlinks)({
|
|
36
37
|
rootDirectory: resolvedRootDirectory,
|
|
37
38
|
absolutePath: resolvedAbsolutePath,
|
|
38
39
|
});
|
|
39
40
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(resolvedAbsolutePath), { recursive: true });
|
|
40
|
-
assertNoSymlinks({
|
|
41
|
+
(0, exports.assertNoSymlinks)({
|
|
41
42
|
rootDirectory: resolvedRootDirectory,
|
|
42
43
|
absolutePath: resolvedAbsolutePath,
|
|
43
44
|
});
|
|
44
45
|
const flags = process.platform === 'win32'
|
|
45
|
-
?
|
|
46
|
+
? exclusive
|
|
47
|
+
? 'wx'
|
|
48
|
+
: 'w'
|
|
46
49
|
: node_fs_1.default.constants.O_CREAT |
|
|
47
50
|
node_fs_1.default.constants.O_WRONLY |
|
|
48
|
-
node_fs_1.default.constants.O_TRUNC |
|
|
51
|
+
(exclusive ? node_fs_1.default.constants.O_EXCL : node_fs_1.default.constants.O_TRUNC) |
|
|
49
52
|
node_fs_1.default.constants.O_NOFOLLOW;
|
|
50
53
|
return node_fs_1.default.openSync(resolvedAbsolutePath, flags);
|
|
51
54
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ResolvedCompositionComponent, type ResolvedCompositionComponentWithFile } from '@remotion/
|
|
1
|
+
import { type ResolvedCompositionComponent, type ResolvedCompositionComponentWithFile } from '@remotion/codemods';
|
|
2
2
|
import type { InsertableCompositionElement, InsertableCompositionElementPosition, SequenceNodePathRemapping } from '@remotion/studio-shared';
|
|
3
3
|
import type { SequenceNodePath } from 'remotion';
|
|
4
4
|
export type { ResolvedCompositionComponent, ResolvedCompositionComponentWithFile, };
|
|
@@ -6,8 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.insertJsxElementIntoComposition = exports.resolveCompositionComponent = exports.resolveCompositionComponentWithFile = void 0;
|
|
7
7
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const
|
|
9
|
+
const codemods_1 = require("@remotion/codemods");
|
|
10
10
|
const svg_to_jsx_1 = require("./svg-to-jsx");
|
|
11
|
+
const { insertJsxElementIntoComposition: insertJsxElementIntoCompositionCodemod, resolveCompositionComponent: resolveCompositionComponentCodemod, resolveCompositionComponentWithFile: resolveCompositionComponentWithFileCodemod, } = codemods_1.CodemodsInternals;
|
|
11
12
|
const makeCodemodEnvironment = (remotionRoot, sourceFileOverrides) => ({
|
|
12
13
|
dirname: node_path_1.default.dirname,
|
|
13
14
|
extname: node_path_1.default.extname,
|
|
@@ -27,13 +28,13 @@ const makeCodemodEnvironment = (remotionRoot, sourceFileOverrides) => ({
|
|
|
27
28
|
rootDir: remotionRoot,
|
|
28
29
|
svgMarkupToJsx: svg_to_jsx_1.svgMarkupToJsx,
|
|
29
30
|
});
|
|
30
|
-
const resolveCompositionComponentWithFile = ({ remotionRoot, compositionFile, compositionId, }) => (
|
|
31
|
+
const resolveCompositionComponentWithFile = ({ remotionRoot, compositionFile, compositionId, }) => resolveCompositionComponentWithFileCodemod({
|
|
31
32
|
compositionFile,
|
|
32
33
|
compositionId,
|
|
33
34
|
environment: makeCodemodEnvironment(remotionRoot, null),
|
|
34
35
|
});
|
|
35
36
|
exports.resolveCompositionComponentWithFile = resolveCompositionComponentWithFile;
|
|
36
|
-
const resolveCompositionComponent = ({ remotionRoot, compositionFile, compositionId, }) => (
|
|
37
|
+
const resolveCompositionComponent = ({ remotionRoot, compositionFile, compositionId, }) => resolveCompositionComponentCodemod({
|
|
37
38
|
compositionFile,
|
|
38
39
|
compositionId,
|
|
39
40
|
environment: makeCodemodEnvironment(remotionRoot, null),
|
|
@@ -41,7 +42,7 @@ const resolveCompositionComponent = ({ remotionRoot, compositionFile, compositio
|
|
|
41
42
|
exports.resolveCompositionComponent = resolveCompositionComponent;
|
|
42
43
|
const insertJsxElementIntoComposition = ({ remotionRoot, compositionFile, compositionId, element, from, prettierConfigOverride, wrapInSequence = null, sourceFileOverrides, }) => {
|
|
43
44
|
var _a;
|
|
44
|
-
return (
|
|
45
|
+
return insertJsxElementIntoCompositionCodemod({
|
|
45
46
|
compositionFile,
|
|
46
47
|
compositionId,
|
|
47
48
|
element,
|
package/dist/index.d.ts
CHANGED
|
@@ -88,25 +88,6 @@ export declare const StudioServerInternals: {
|
|
|
88
88
|
binary?: boolean | undefined;
|
|
89
89
|
signed: boolean;
|
|
90
90
|
}) | undefined) => string;
|
|
91
|
-
parseAndApplyCodemod: ({ input, codeMod, }: {
|
|
92
|
-
input: string;
|
|
93
|
-
codeMod: import("@remotion/studio-shared").RecastCodemod;
|
|
94
|
-
}) => {
|
|
95
|
-
newContents: string;
|
|
96
|
-
changesMade: import("@remotion/studio-codemods").Change[];
|
|
97
|
-
};
|
|
98
|
-
applyCodemodToFile: ({ filePath, codeMod, }: {
|
|
99
|
-
filePath: string;
|
|
100
|
-
codeMod: import("@remotion/studio-shared").RecastCodemod;
|
|
101
|
-
}) => Promise<string>;
|
|
102
|
-
updateDefaultProps: ({ input, compositionId, newDefaultProps, enumPaths, }: {
|
|
103
|
-
input: string;
|
|
104
|
-
compositionId: string;
|
|
105
|
-
newDefaultProps: Record<string, unknown>;
|
|
106
|
-
enumPaths: import("@remotion/studio-shared").EnumPath[];
|
|
107
|
-
}) => {
|
|
108
|
-
output: string;
|
|
109
|
-
};
|
|
110
91
|
getInstalledDependencies: (remotionRoot: string) => {
|
|
111
92
|
dependencies: string[];
|
|
112
93
|
devDependencies: string[];
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,8 @@ exports.StudioServerInternals = exports.remotionSkillNames = exports.parseRemoti
|
|
|
4
4
|
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
5
|
const studio_shared_2 = require("@remotion/studio-shared");
|
|
6
6
|
Object.defineProperty(exports, "getDefaultOutLocation", { enumerable: true, get: function () { return studio_shared_2.getDefaultOutLocation; } });
|
|
7
|
-
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
8
7
|
const ansi_diff_1 = require("./ansi-diff");
|
|
9
8
|
const client_render_queue_1 = require("./client-render-queue");
|
|
10
|
-
const apply_codemod_to_file_1 = require("./codemods/apply-codemod-to-file");
|
|
11
|
-
const update_default_props_1 = require("./codemods/update-default-props");
|
|
12
9
|
const detect_outdated_remotion_skills_1 = require("./detect-outdated-remotion-skills");
|
|
13
10
|
Object.defineProperty(exports, "detectOutdatedRemotionSkills", { enumerable: true, get: function () { return detect_outdated_remotion_skills_1.detectOutdatedRemotionSkills; } });
|
|
14
11
|
Object.defineProperty(exports, "parseRemotionSkillVersion", { enumerable: true, get: function () { return detect_outdated_remotion_skills_1.parseRemotionSkillVersion; } });
|
|
@@ -42,9 +39,6 @@ exports.StudioServerInternals = {
|
|
|
42
39
|
setFileWatcherRegistry: file_watcher_1.setFileWatcherRegistry,
|
|
43
40
|
AnsiDiff: ansi_diff_1.AnsiDiff,
|
|
44
41
|
formatBytes: studio_shared_1.formatBytes,
|
|
45
|
-
parseAndApplyCodemod: studio_codemods_1.parseAndApplyCodemod,
|
|
46
|
-
applyCodemodToFile: apply_codemod_to_file_1.applyCodemodToFile,
|
|
47
|
-
updateDefaultProps: update_default_props_1.updateDefaultProps,
|
|
48
42
|
getInstalledDependencies: get_installed_dependencies_1.getInstalledDependencies,
|
|
49
43
|
getInstalledDependenciesWithVersions: get_installed_dependencies_1.getInstalledDependenciesWithVersions,
|
|
50
44
|
getInstallCommand: install_command_1.getInstallCommand,
|