@remotion/studio-server 4.0.513 → 4.0.515
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codemods/delete-jsx-node.d.ts +2 -5
- package/dist/codemods/delete-jsx-node.js +23 -341
- package/dist/codemods/duplicate-composition.d.ts +1 -9
- package/dist/codemods/duplicate-composition.js +3 -49
- package/dist/codemods/format-inline-content.d.ts +0 -4
- package/dist/codemods/format-inline-content.js +7 -46
- package/dist/codemods/recast-mods.js +0 -18
- package/dist/codemods/reorder-sequence.d.ts +2 -2
- package/dist/codemods/reorder-sequence.js +12 -112
- package/dist/codemods/split-jsx-sequence.d.ts +1 -2
- package/dist/codemods/split-jsx-sequence.js +11 -298
- package/dist/codemods/split-video-from-audio.d.ts +15 -0
- package/dist/codemods/split-video-from-audio.js +15 -0
- package/dist/codemods/update-default-props.d.ts +2 -6
- package/dist/codemods/update-default-props.js +12 -220
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +1 -4
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +5 -102
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +8 -93
- package/dist/codemods/update-keyframes/update-keyframes.js +11 -1302
- package/dist/detect-outdated-remotion-skills.d.ts +7 -0
- package/dist/detect-outdated-remotion-skills.js +11 -5
- package/dist/helpers/open-file-for-writing-without-symlinks.d.ts +4 -0
- package/dist/helpers/open-file-for-writing-without-symlinks.js +52 -0
- package/dist/helpers/resolve-composition-component.d.ts +3 -11
- package/dist/helpers/resolve-composition-component.js +38 -1495
- package/dist/helpers/video-config-values.js +25 -6
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/max-timeline-tracks.d.ts +2 -1
- package/dist/max-timeline-tracks.js +10 -4
- package/dist/preview-server/api-routes.js +4 -0
- package/dist/preview-server/routes/add-effect.js +1 -1
- package/dist/preview-server/routes/apply-codemod.js +3 -3
- package/dist/preview-server/routes/apply-visual-control-change.js +3 -3
- package/dist/preview-server/routes/can-update-sequence-props.js +107 -24
- package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
- package/dist/preview-server/routes/delete-effect.js +1 -1
- package/dist/preview-server/routes/delete-jsx-node.js +1 -1
- package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
- package/dist/preview-server/routes/duplicate-effect.js +1 -1
- package/dist/preview-server/routes/duplicate-jsx-node.js +1 -1
- package/dist/preview-server/routes/element-install-plan.d.ts +1 -1
- package/dist/preview-server/routes/insert-element.js +2 -2
- package/dist/preview-server/routes/insert-jsx-element.js +1 -1
- package/dist/preview-server/routes/install-dependency.js +8 -2
- package/dist/preview-server/routes/log-updates/log-effect-update.js +2 -1
- package/dist/preview-server/routes/log-updates/log-update.js +2 -1
- package/dist/preview-server/routes/paste-effects.js +1 -1
- package/dist/preview-server/routes/remotion-skills-info.d.ts +7 -0
- package/dist/preview-server/routes/remotion-skills-info.js +24 -0
- package/dist/preview-server/routes/reorder-effect.js +1 -1
- package/dist/preview-server/routes/reorder-sequence.js +1 -1
- package/dist/preview-server/routes/save-props-mutex.d.ts +1 -0
- package/dist/preview-server/routes/save-props-mutex.js +11 -0
- package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -0
- package/dist/preview-server/routes/source-file-write-queue.js +11 -2
- package/dist/preview-server/routes/split-jsx-sequence.js +1 -1
- package/dist/preview-server/routes/split-video-from-audio.d.ts +3 -0
- package/dist/preview-server/routes/split-video-from-audio.js +80 -0
- package/dist/preview-server/routes/update-default-props.js +1 -1
- package/dist/preview-server/start-server.js +188 -140
- package/dist/preview-server/undo-stack.d.ts +3 -52
- package/dist/preview-server/update-available.js +4 -4
- package/dist/routes.js +36 -5
- package/package.json +8 -8
|
@@ -1,117 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.reorderSequence = void 0;
|
|
37
|
-
const
|
|
38
|
-
const delete_jsx_node_1 = require("./delete-jsx-node");
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
39
5
|
const format_file_content_1 = require("./format-file-content");
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
if (namedTypes.JSXFragment.check(parent)) {
|
|
53
|
-
return parent;
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
};
|
|
57
|
-
const reorderSequence = async ({ input, sourceNodePath, targetNodePath, position, prettierConfigOverride, }) => {
|
|
58
|
-
var _a, _b;
|
|
59
|
-
var _c, _d;
|
|
60
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
61
|
-
const capturedNodePaths = (0, get_node_path_remappings_1.captureJsxNodePaths)(ast);
|
|
62
|
-
const sourcePath = (0, delete_jsx_node_1.findJsxElementPathForDeletion)(ast, sourceNodePath);
|
|
63
|
-
if (!sourcePath) {
|
|
64
|
-
throw new Error('Could not find a JSX element at the source location to reorder sequence');
|
|
65
|
-
}
|
|
66
|
-
const targetPath = (0, delete_jsx_node_1.findJsxElementPathForDeletion)(ast, targetNodePath);
|
|
67
|
-
if (!targetPath) {
|
|
68
|
-
throw new Error('Could not find a JSX element at the target location to reorder sequence');
|
|
69
|
-
}
|
|
70
|
-
const sourceParent = getJsxChildrenParent(sourcePath);
|
|
71
|
-
const targetParent = getJsxChildrenParent(targetPath);
|
|
72
|
-
if (!sourceParent || !targetParent || sourceParent !== targetParent) {
|
|
73
|
-
throw new Error('Cannot reorder sequence: source and target are not JSX siblings');
|
|
74
|
-
}
|
|
75
|
-
const sourceElement = sourcePath.node;
|
|
76
|
-
const targetElement = targetPath.node;
|
|
77
|
-
if (sourceElement === targetElement) {
|
|
78
|
-
throw new Error('Cannot reorder sequence: source and target are identical');
|
|
79
|
-
}
|
|
80
|
-
const { children } = sourceParent;
|
|
81
|
-
const sourceIndex = children.indexOf(sourceElement);
|
|
82
|
-
const targetIndex = children.indexOf(targetElement);
|
|
83
|
-
if (sourceIndex === -1 || targetIndex === -1) {
|
|
84
|
-
throw new Error('Cannot reorder sequence: JSX sibling was not found');
|
|
85
|
-
}
|
|
86
|
-
const sequenceLabel = (0, delete_jsx_node_1.getJsxElementTagLabel)(sourceElement);
|
|
87
|
-
const logLine = (_d = (_c = (_a = sourceElement.openingElement.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _c !== void 0 ? _c : (_b = sourceElement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
88
|
-
const [moved] = children.splice(sourceIndex, 1);
|
|
89
|
-
if (!moved) {
|
|
90
|
-
throw new Error('Cannot reorder sequence: source sequence was not found');
|
|
91
|
-
}
|
|
92
|
-
const targetIndexAfterRemoval = children.indexOf(targetElement);
|
|
93
|
-
if (targetIndexAfterRemoval === -1) {
|
|
94
|
-
throw new Error('Cannot reorder sequence: target sequence was not found');
|
|
95
|
-
}
|
|
96
|
-
children.splice(position === 'before'
|
|
97
|
-
? targetIndexAfterRemoval
|
|
98
|
-
: targetIndexAfterRemoval + 1, 0, moved);
|
|
99
|
-
const finalFile = (0, parse_ast_1.serializeAst)(ast);
|
|
100
|
-
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
101
|
-
input: finalFile,
|
|
102
|
-
prettierConfigOverride,
|
|
103
|
-
});
|
|
104
|
-
const { nodePathRemappings } = (0, get_node_path_remappings_1.getNodePathRemappings)({
|
|
105
|
-
ast,
|
|
106
|
-
captured: capturedNodePaths,
|
|
107
|
-
output,
|
|
108
|
-
});
|
|
109
|
-
return {
|
|
110
|
-
output,
|
|
111
|
-
formatted,
|
|
112
|
-
sequenceLabel,
|
|
113
|
-
logLine,
|
|
114
|
-
nodePathRemappings,
|
|
115
|
-
};
|
|
116
|
-
};
|
|
6
|
+
const reorderSequence = ({ input, sourceNodePath, targetNodePath, position, prettierConfigOverride, }) => (0, studio_codemods_1.reorderSequence)({
|
|
7
|
+
input,
|
|
8
|
+
sourceNodePath,
|
|
9
|
+
targetNodePath,
|
|
10
|
+
position,
|
|
11
|
+
formatFile: ({ contents, prettierConfigOverride: override }) => (0, format_file_content_1.formatFileContent)({
|
|
12
|
+
input: contents,
|
|
13
|
+
prettierConfigOverride: override,
|
|
14
|
+
}),
|
|
15
|
+
prettierConfigOverride,
|
|
16
|
+
});
|
|
117
17
|
exports.reorderSequence = reorderSequence;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SequenceNodePathRemapping } from '@remotion/studio-shared';
|
|
2
1
|
import type { SequenceNodePath } from 'remotion';
|
|
3
2
|
export declare const splitJsxSequence: ({ input, nodePath, sequenceKeys, splitFrame, prettierConfigOverride, }: {
|
|
4
3
|
input: string;
|
|
@@ -11,5 +10,5 @@ export declare const splitJsxSequence: ({ input, nodePath, sequenceKeys, splitFr
|
|
|
11
10
|
formatted: boolean;
|
|
12
11
|
nodeLabel: string;
|
|
13
12
|
logLine: number;
|
|
14
|
-
nodePathRemappings: SequenceNodePathRemapping[];
|
|
13
|
+
nodePathRemappings: import("@remotion/studio-shared").SequenceNodePathRemapping[];
|
|
15
14
|
}>;
|
|
@@ -1,304 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.splitJsxSequence = void 0;
|
|
37
|
-
const
|
|
38
|
-
const studio_shared_1 = require("@remotion/studio-shared");
|
|
39
|
-
const recast = __importStar(require("recast"));
|
|
40
|
-
const delete_jsx_node_1 = require("./delete-jsx-node");
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
41
5
|
const format_file_content_1 = require("./format-file-content");
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
});
|
|
54
|
-
const getAttributeName = (attribute) => {
|
|
55
|
-
if (attribute.type !== 'JSXAttribute' ||
|
|
56
|
-
attribute.name.type !== 'JSXIdentifier') {
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
return attribute.name.name;
|
|
60
|
-
};
|
|
61
|
-
const getStaticNumber = (attribute) => {
|
|
62
|
-
if (attribute.type !== 'JSXAttribute') {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
if (!attribute.value) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
if (attribute.value.type === 'StringLiteral') {
|
|
69
|
-
const parsed = Number(attribute.value.value);
|
|
70
|
-
return Number.isFinite(parsed) ? parsed : null;
|
|
71
|
-
}
|
|
72
|
-
if (attribute.value.type !== 'JSXExpressionContainer') {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
const { expression } = attribute.value;
|
|
76
|
-
if (expression.type === 'NumericLiteral') {
|
|
77
|
-
return expression.value;
|
|
78
|
-
}
|
|
79
|
-
if (expression.type === 'UnaryExpression' &&
|
|
80
|
-
expression.operator === '-' &&
|
|
81
|
-
expression.argument.type === 'NumericLiteral') {
|
|
82
|
-
return -expression.argument.value;
|
|
83
|
-
}
|
|
84
|
-
if (expression.type === 'Identifier' && expression.name === 'Infinity') {
|
|
85
|
-
return Infinity;
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
};
|
|
89
|
-
const readSequenceTiming = (element) => {
|
|
90
|
-
let from = 0;
|
|
91
|
-
let durationInFrames = Infinity;
|
|
92
|
-
let trimBefore = 0;
|
|
93
|
-
let hasFrom = false;
|
|
94
|
-
let hasDurationInFrames = false;
|
|
95
|
-
let hasTrimBefore = false;
|
|
96
|
-
for (const attribute of element.openingElement.attributes) {
|
|
97
|
-
const name = getAttributeName(attribute);
|
|
98
|
-
if (!name) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
if (name !== 'from' &&
|
|
102
|
-
name !== 'durationInFrames' &&
|
|
103
|
-
name !== 'trimBefore') {
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
const value = getStaticNumber(attribute);
|
|
107
|
-
if (value === null) {
|
|
108
|
-
throw new Error(`Cannot split sequence with dynamic ${name}`);
|
|
109
|
-
}
|
|
110
|
-
if (name === 'from') {
|
|
111
|
-
from = value;
|
|
112
|
-
hasFrom = true;
|
|
113
|
-
}
|
|
114
|
-
if (name === 'durationInFrames') {
|
|
115
|
-
durationInFrames = value;
|
|
116
|
-
hasDurationInFrames = true;
|
|
117
|
-
}
|
|
118
|
-
if (name === 'trimBefore') {
|
|
119
|
-
trimBefore = value;
|
|
120
|
-
hasTrimBefore = true;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return {
|
|
124
|
-
from,
|
|
125
|
-
durationInFrames,
|
|
126
|
-
trimBefore,
|
|
127
|
-
hasFrom,
|
|
128
|
-
hasDurationInFrames,
|
|
129
|
-
hasTrimBefore,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const setNumericAttribute = ({ element, name, value, omitIfMissing, }) => {
|
|
133
|
-
const { openingElement: { attributes }, } = element;
|
|
134
|
-
const index = attributes.findIndex((attribute) => getAttributeName(attribute) === name);
|
|
135
|
-
if (value === null || (index === -1 && omitIfMissing)) {
|
|
136
|
-
if (index !== -1) {
|
|
137
|
-
attributes.splice(index, 1);
|
|
138
|
-
}
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
const next = numericAttribute(name, value);
|
|
142
|
-
if (index === -1) {
|
|
143
|
-
attributes.push(next);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
attributes[index] = next;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const timingAttributeOrder = ['from', 'durationInFrames', 'trimBefore'];
|
|
150
|
-
const orderTimingAttributes = (element) => {
|
|
151
|
-
const { openingElement: { attributes }, } = element;
|
|
152
|
-
const timingAttributes = new Map();
|
|
153
|
-
const otherAttributes = [];
|
|
154
|
-
let firstTimingIndex = null;
|
|
155
|
-
for (let i = 0; i < attributes.length; i++) {
|
|
156
|
-
const attribute = attributes[i];
|
|
157
|
-
const name = getAttributeName(attribute);
|
|
158
|
-
if (name && timingAttributeOrder.includes(name)) {
|
|
159
|
-
timingAttributes.set(name, attribute);
|
|
160
|
-
firstTimingIndex = firstTimingIndex === null ? i : firstTimingIndex;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
otherAttributes.push(attribute);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (firstTimingIndex === null) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
const orderedTimingAttributes = timingAttributeOrder.flatMap((name) => {
|
|
170
|
-
const attribute = timingAttributes.get(name);
|
|
171
|
-
return attribute ? [attribute] : [];
|
|
172
|
-
});
|
|
173
|
-
const insertionIndex = Math.min(firstTimingIndex, otherAttributes.length);
|
|
174
|
-
attributes.splice(0, attributes.length, ...otherAttributes.slice(0, insertionIndex), ...orderedTimingAttributes, ...otherAttributes.slice(insertionIndex));
|
|
175
|
-
};
|
|
176
|
-
const jsxMemberNameToString = (name) => {
|
|
177
|
-
if (name.type === 'JSXIdentifier') {
|
|
178
|
-
return name.name;
|
|
179
|
-
}
|
|
180
|
-
return `${jsxMemberNameToString(name.object)}.${name.property.name}`;
|
|
181
|
-
};
|
|
182
|
-
const jsxNameToString = (name) => {
|
|
183
|
-
if (name.type === 'JSXNamespacedName') {
|
|
184
|
-
return `${name.namespace.name}:${name.name.name}`;
|
|
185
|
-
}
|
|
186
|
-
return jsxMemberNameToString(name);
|
|
187
|
-
};
|
|
188
|
-
const getSplittableSequenceTagName = (element) => {
|
|
189
|
-
return jsxNameToString(element.openingElement.name);
|
|
190
|
-
};
|
|
191
|
-
const makeFragment = (first, second) => ({
|
|
192
|
-
type: 'JSXFragment',
|
|
193
|
-
openingFragment: { type: 'JSXOpeningFragment' },
|
|
194
|
-
closingFragment: { type: 'JSXClosingFragment' },
|
|
195
|
-
children: [first, second],
|
|
6
|
+
const splitJsxSequence = ({ input, nodePath, sequenceKeys, splitFrame, prettierConfigOverride, }) => (0, studio_codemods_1.splitJsxSequence)({
|
|
7
|
+
input,
|
|
8
|
+
nodePath,
|
|
9
|
+
sequenceKeys,
|
|
10
|
+
splitFrame,
|
|
11
|
+
formatFile: ({ contents, prettierConfigOverride: override }) => (0, format_file_content_1.formatFileContent)({
|
|
12
|
+
input: contents,
|
|
13
|
+
prettierConfigOverride: override,
|
|
14
|
+
}),
|
|
15
|
+
prettierConfigOverride,
|
|
196
16
|
});
|
|
197
|
-
const insertAfter = (parentNode, node, clone) => {
|
|
198
|
-
if (namedTypes.JSXElement.check(parentNode) ||
|
|
199
|
-
namedTypes.JSXFragment.check(parentNode)) {
|
|
200
|
-
const idx = parentNode.children.indexOf(node);
|
|
201
|
-
if (idx !== -1) {
|
|
202
|
-
parentNode.children.splice(idx + 1, 0, clone);
|
|
203
|
-
return true;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
if (namedTypes.ReturnStatement.check(parentNode)) {
|
|
207
|
-
const parent = parentNode;
|
|
208
|
-
if (parent.argument === node) {
|
|
209
|
-
parent.argument = makeFragment(node, clone);
|
|
210
|
-
return true;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (namedTypes.ArrowFunctionExpression.check(parentNode)) {
|
|
214
|
-
const parent = parentNode;
|
|
215
|
-
if (parent.body === node) {
|
|
216
|
-
parent.body = makeFragment(node, clone);
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return false;
|
|
221
|
-
};
|
|
222
|
-
const splitJsxSequence = async ({ input, nodePath, sequenceKeys, splitFrame, prettierConfigOverride, }) => {
|
|
223
|
-
var _a, _b;
|
|
224
|
-
var _c, _d;
|
|
225
|
-
if (!Number.isInteger(splitFrame)) {
|
|
226
|
-
throw new Error('Split frame must be an integer');
|
|
227
|
-
}
|
|
228
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
229
|
-
const capturedNodePaths = (0, get_node_path_remappings_1.captureJsxNodePaths)(ast);
|
|
230
|
-
const jsxPath = (0, delete_jsx_node_1.findJsxElementPathForDeletion)(ast, nodePath);
|
|
231
|
-
if (!jsxPath) {
|
|
232
|
-
throw new Error('Could not find a JSX sequence at the specified location to split');
|
|
233
|
-
}
|
|
234
|
-
const jsxElement = jsxPath.node;
|
|
235
|
-
const tagName = getSplittableSequenceTagName(jsxElement);
|
|
236
|
-
if (!(0, studio_shared_1.hasSequenceTimingTraits)(sequenceKeys)) {
|
|
237
|
-
throw new Error(`<${tagName}> cannot be split`);
|
|
238
|
-
}
|
|
239
|
-
const timing = readSequenceTiming(jsxElement);
|
|
240
|
-
const finiteEnd = timing.durationInFrames === Infinity
|
|
241
|
-
? Infinity
|
|
242
|
-
: timing.from + timing.durationInFrames;
|
|
243
|
-
if (splitFrame <= timing.from) {
|
|
244
|
-
throw new Error('Cannot split at or before the sequence start');
|
|
245
|
-
}
|
|
246
|
-
if (splitFrame >= finiteEnd) {
|
|
247
|
-
throw new Error('Cannot split at or after the sequence end');
|
|
248
|
-
}
|
|
249
|
-
const right = (0, types_1.cloneNode)(jsxElement, true);
|
|
250
|
-
const leftDuration = splitFrame - timing.from;
|
|
251
|
-
const rightDuration = timing.durationInFrames === Infinity ? Infinity : finiteEnd - splitFrame;
|
|
252
|
-
const rightTrimBefore = timing.trimBefore + leftDuration;
|
|
253
|
-
setNumericAttribute({
|
|
254
|
-
element: jsxElement,
|
|
255
|
-
name: 'durationInFrames',
|
|
256
|
-
value: leftDuration,
|
|
257
|
-
omitIfMissing: false,
|
|
258
|
-
});
|
|
259
|
-
setNumericAttribute({
|
|
260
|
-
element: right,
|
|
261
|
-
name: 'from',
|
|
262
|
-
value: splitFrame,
|
|
263
|
-
omitIfMissing: false,
|
|
264
|
-
});
|
|
265
|
-
setNumericAttribute({
|
|
266
|
-
element: right,
|
|
267
|
-
name: 'durationInFrames',
|
|
268
|
-
value: rightDuration === Infinity ? null : rightDuration,
|
|
269
|
-
omitIfMissing: !timing.hasDurationInFrames,
|
|
270
|
-
});
|
|
271
|
-
setNumericAttribute({
|
|
272
|
-
element: right,
|
|
273
|
-
name: 'trimBefore',
|
|
274
|
-
value: rightTrimBefore === 0 ? null : rightTrimBefore,
|
|
275
|
-
omitIfMissing: !timing.hasTrimBefore && rightTrimBefore === 0,
|
|
276
|
-
});
|
|
277
|
-
orderTimingAttributes(jsxElement);
|
|
278
|
-
orderTimingAttributes(right);
|
|
279
|
-
const { parentPath } = jsxPath;
|
|
280
|
-
if (!parentPath) {
|
|
281
|
-
throw new Error('Cannot split JSX sequence with no parent');
|
|
282
|
-
}
|
|
283
|
-
if (!insertAfter(parentPath.node, jsxElement, right)) {
|
|
284
|
-
jsxPath.replace(makeFragment(jsxElement, right));
|
|
285
|
-
}
|
|
286
|
-
const finalFile = (0, parse_ast_1.serializeAst)(ast);
|
|
287
|
-
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
288
|
-
input: finalFile,
|
|
289
|
-
prettierConfigOverride,
|
|
290
|
-
});
|
|
291
|
-
const { nodePathRemappings } = (0, get_node_path_remappings_1.getNodePathRemappings)({
|
|
292
|
-
ast,
|
|
293
|
-
captured: capturedNodePaths,
|
|
294
|
-
output,
|
|
295
|
-
});
|
|
296
|
-
return {
|
|
297
|
-
output,
|
|
298
|
-
formatted,
|
|
299
|
-
nodeLabel: (0, delete_jsx_node_1.getJsxElementTagLabel)(jsxElement),
|
|
300
|
-
logLine: (_d = (_c = (_a = jsxElement.openingElement.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _c !== void 0 ? _c : (_b = jsxElement.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _d !== void 0 ? _d : 1,
|
|
301
|
-
nodePathRemappings,
|
|
302
|
-
};
|
|
303
|
-
};
|
|
304
17
|
exports.splitJsxSequence = splitJsxSequence;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SequenceNodePath } from 'remotion';
|
|
2
|
+
export declare const splitVideoFromAudio: ({ input, nodePath, prettierConfigOverride, }: {
|
|
3
|
+
input: string;
|
|
4
|
+
nodePath: SequenceNodePath;
|
|
5
|
+
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
output: string;
|
|
8
|
+
formatted: boolean;
|
|
9
|
+
nodeLabel: string;
|
|
10
|
+
logLine: number;
|
|
11
|
+
nodePathRemappings: {
|
|
12
|
+
oldNodePath: SequenceNodePath;
|
|
13
|
+
newNodePath: SequenceNodePath | null;
|
|
14
|
+
}[];
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitVideoFromAudio = void 0;
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
+
const format_file_content_1 = require("./format-file-content");
|
|
6
|
+
const splitVideoFromAudio = ({ input, nodePath, prettierConfigOverride, }) => (0, studio_codemods_1.splitVideoFromAudio)({
|
|
7
|
+
input,
|
|
8
|
+
nodePath,
|
|
9
|
+
formatFile: ({ contents, prettierConfigOverride: override }) => (0, format_file_content_1.formatFileContent)({
|
|
10
|
+
input: contents,
|
|
11
|
+
prettierConfigOverride: override,
|
|
12
|
+
}),
|
|
13
|
+
prettierConfigOverride,
|
|
14
|
+
});
|
|
15
|
+
exports.splitVideoFromAudio = splitVideoFromAudio;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { EnumPath } from '@remotion/studio-shared';
|
|
2
|
+
export { getCompositionDefaultPropsLine } from '@remotion/studio-codemods';
|
|
2
3
|
export declare const updateDefaultProps: ({ input, compositionId, newDefaultProps, enumPaths, }: {
|
|
3
4
|
input: string;
|
|
4
5
|
compositionId: string;
|
|
@@ -8,8 +9,3 @@ export declare const updateDefaultProps: ({ input, compositionId, newDefaultProp
|
|
|
8
9
|
output: string;
|
|
9
10
|
formatted: boolean;
|
|
10
11
|
}>;
|
|
11
|
-
/** Line of the matching `<Composition>` / `<Still>` opening tag (for log links). */
|
|
12
|
-
export declare const getCompositionDefaultPropsLine: ({ input, compositionId, }: {
|
|
13
|
-
input: string;
|
|
14
|
-
compositionId: string;
|
|
15
|
-
}) => number;
|