@remotion/studio-server 4.0.501 → 4.0.503
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/update-inline-caption-patches.d.ts +1 -11
- package/dist/codemods/update-inline-caption-patches.js +2 -183
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +2 -35
- package/dist/codemods/update-sequence-props/update-sequence-props.js +7 -720
- package/dist/detect-outdated-remotion-skills.d.ts +25 -0
- package/dist/detect-outdated-remotion-skills.js +73 -0
- package/dist/helpers/custom-editor.d.ts +37 -0
- package/dist/helpers/custom-editor.js +167 -0
- package/dist/helpers/editor-registry.d.ts +18 -0
- package/dist/helpers/editor-registry.js +500 -0
- package/dist/helpers/open-in-editor.d.ts +3 -4
- package/dist/helpers/open-in-editor.js +5 -75
- package/dist/helpers/resolve-composition-component.js +18 -6
- package/dist/helpers/resolve-editor.d.ts +27 -0
- package/dist/helpers/resolve-editor.js +90 -0
- package/dist/helpers/resolve-file-inside-project.d.ts +2 -0
- package/dist/helpers/resolve-file-inside-project.js +5 -2
- package/dist/index.d.ts +17 -1
- package/dist/index.js +9 -1
- package/dist/preview-server/api-routes.js +6 -1
- package/dist/preview-server/api-types.d.ts +2 -1
- package/dist/preview-server/element-install-state.d.ts +19 -0
- package/dist/preview-server/element-install-state.js +46 -1
- package/dist/preview-server/handler.d.ts +3 -1
- package/dist/preview-server/handler.js +3 -2
- package/dist/preview-server/parse-body.d.ts +6 -1
- package/dist/preview-server/parse-body.js +60 -9
- package/dist/preview-server/routes/can-update-default-props.d.ts +1 -1
- package/dist/preview-server/routes/can-update-default-props.js +5 -132
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +3 -2
- package/dist/preview-server/routes/can-update-sequence-props.js +52 -9
- package/dist/preview-server/routes/default-editor.d.ts +8 -0
- package/dist/preview-server/routes/default-editor.js +131 -0
- 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-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
- package/dist/preview-server/routes/element-install-plan.d.ts +32 -0
- package/dist/preview-server/routes/element-install-plan.js +122 -0
- package/dist/preview-server/routes/insert-element.d.ts +1 -1
- package/dist/preview-server/routes/insert-element.js +68 -107
- package/dist/preview-server/routes/insert-jsx-element.js +5 -5
- package/dist/preview-server/routes/open-in-editor.d.ts +5 -1
- package/dist/preview-server/routes/open-in-editor.js +42 -12
- package/dist/preview-server/routes/prepare-element-install.d.ts +3 -0
- package/dist/preview-server/routes/prepare-element-install.js +25 -0
- package/dist/preview-server/routes/safe-element-install-path.d.ts +9 -0
- package/dist/preview-server/routes/safe-element-install-path.js +58 -0
- 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/sequence-props-watchers.js +2 -1
- package/dist/preview-server/start-server.d.ts +2 -0
- package/dist/preview-server/start-server.js +1 -0
- package/dist/preview-server/studio-protocol/handle-discovery.d.ts +11 -0
- package/dist/preview-server/studio-protocol/handle-discovery.js +106 -0
- package/dist/preview-server/studio-protocol/handle-install.d.ts +10 -0
- package/dist/preview-server/studio-protocol/handle-install.js +147 -0
- package/dist/preview-server/studio-protocol/origin-policy.d.ts +11 -0
- package/dist/preview-server/studio-protocol/origin-policy.js +43 -0
- package/dist/preview-server/studio-protocol/protocol-response.d.ts +7 -0
- package/dist/preview-server/studio-protocol/protocol-response.js +13 -0
- package/dist/preview-server/update-available.d.ts +6 -0
- package/dist/preview-server/update-available.js +30 -4
- package/dist/remotion-skill-names.d.ts +2 -0
- package/dist/remotion-skill-names.js +16 -0
- package/dist/routes.d.ts +3 -1
- package/dist/routes.js +19 -157
- package/dist/start-studio.d.ts +3 -1
- package/dist/start-studio.js +2 -1
- package/package.json +9 -8
|
@@ -1,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import type { SequenceNodePath } from 'remotion';
|
|
3
|
-
export declare const updateInlineCaptionPatches: ({ input, nodePath, patches, }: {
|
|
4
|
-
input: string;
|
|
5
|
-
nodePath: SequenceNodePath;
|
|
6
|
-
patches: CaptionPatch[];
|
|
7
|
-
}) => {
|
|
8
|
-
output: string;
|
|
9
|
-
logLine: number;
|
|
10
|
-
changedFields: string[][];
|
|
11
|
-
};
|
|
1
|
+
export { updateInlineCaptionPatches } from '@remotion/studio-codemods';
|
|
@@ -1,186 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateInlineCaptionPatches = void 0;
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
const captionKeys = [
|
|
7
|
-
'text',
|
|
8
|
-
'startMs',
|
|
9
|
-
'endMs',
|
|
10
|
-
'timestampMs',
|
|
11
|
-
'confidence',
|
|
12
|
-
];
|
|
13
|
-
const getPropertyKey = (property) => {
|
|
14
|
-
if (property.key.type === 'Identifier') {
|
|
15
|
-
return property.key.name;
|
|
16
|
-
}
|
|
17
|
-
if (property.key.type === 'StringLiteral') {
|
|
18
|
-
return property.key.value;
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
};
|
|
22
|
-
const getStaticValue = (value) => {
|
|
23
|
-
if (value.type === 'StringLiteral' || value.type === 'NumericLiteral') {
|
|
24
|
-
return value.value;
|
|
25
|
-
}
|
|
26
|
-
if (value.type === 'NullLiteral') {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
throw new Error('Captions must use static literal values to be edited');
|
|
30
|
-
};
|
|
31
|
-
const getStaticCaption = (expression) => {
|
|
32
|
-
const values = new Map();
|
|
33
|
-
for (const property of expression.properties) {
|
|
34
|
-
if (property.type !== 'ObjectProperty' || property.computed) {
|
|
35
|
-
throw new Error('Captions must use static object properties to be edited');
|
|
36
|
-
}
|
|
37
|
-
const key = getPropertyKey(property);
|
|
38
|
-
if (key !== null && captionKeys.includes(key)) {
|
|
39
|
-
values.set(key, getStaticValue(property.value));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
const text = values.get('text');
|
|
43
|
-
const startMs = values.get('startMs');
|
|
44
|
-
const endMs = values.get('endMs');
|
|
45
|
-
const timestampMs = values.get('timestampMs');
|
|
46
|
-
const confidence = values.get('confidence');
|
|
47
|
-
if (typeof text !== 'string' ||
|
|
48
|
-
typeof startMs !== 'number' ||
|
|
49
|
-
typeof endMs !== 'number' ||
|
|
50
|
-
(timestampMs !== null && typeof timestampMs !== 'number') ||
|
|
51
|
-
(confidence !== null && typeof confidence !== 'number')) {
|
|
52
|
-
throw new Error('Captions must have the standard static caption shape to edit');
|
|
53
|
-
}
|
|
54
|
-
return { text, startMs, endMs, timestampMs, confidence };
|
|
55
|
-
};
|
|
56
|
-
const isCaptionKey = (key) => captionKeys.includes(key);
|
|
57
|
-
const getReplacementValue = ({ value, previous, }) => {
|
|
58
|
-
var _a;
|
|
59
|
-
if (value === null || typeof value === 'number') {
|
|
60
|
-
return String(value);
|
|
61
|
-
}
|
|
62
|
-
if (previous.type === 'StringLiteral' &&
|
|
63
|
-
typeof ((_a = previous.extra) === null || _a === void 0 ? void 0 : _a.raw) === 'string' &&
|
|
64
|
-
previous.extra.raw.startsWith("'")) {
|
|
65
|
-
return `'${value.replace(/\\/g, '\\\\').replace(/'/g, "\\'")}'`;
|
|
66
|
-
}
|
|
67
|
-
return JSON.stringify(value);
|
|
68
|
-
};
|
|
69
|
-
const getSourceValueRange = ({ input, property, key, }) => {
|
|
70
|
-
var _a, _b;
|
|
71
|
-
const line = (_a = property.loc) === null || _a === void 0 ? void 0 : _a.start.line;
|
|
72
|
-
if (line === null || line === undefined) {
|
|
73
|
-
throw new Error(`Could not locate caption ${key} in the source file`);
|
|
74
|
-
}
|
|
75
|
-
const lines = input.split('\n');
|
|
76
|
-
const lineStart = lines
|
|
77
|
-
.slice(0, line - 1)
|
|
78
|
-
.reduce((length, current) => length + current.length + 1, 0);
|
|
79
|
-
const sourceLine = lines[line - 1];
|
|
80
|
-
if (sourceLine === undefined) {
|
|
81
|
-
throw new Error(`Could not locate caption ${key} in the source file`);
|
|
82
|
-
}
|
|
83
|
-
const keyStart = sourceLine.indexOf(key);
|
|
84
|
-
const valueStart = sourceLine.indexOf(':', keyStart) + 1;
|
|
85
|
-
const rawValue = property.value.type === 'StringLiteral' &&
|
|
86
|
-
typeof ((_b = property.value.extra) === null || _b === void 0 ? void 0 : _b.raw) === 'string'
|
|
87
|
-
? property.value.extra.raw
|
|
88
|
-
: property.value.type === 'StringLiteral'
|
|
89
|
-
? JSON.stringify(property.value.value)
|
|
90
|
-
: String(getStaticValue(property.value));
|
|
91
|
-
const valueOffset = sourceLine.indexOf(rawValue, valueStart);
|
|
92
|
-
if (keyStart === -1 || valueOffset === -1) {
|
|
93
|
-
throw new Error(`Could not locate caption ${key} in the source file`);
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
start: lineStart + valueOffset,
|
|
97
|
-
end: lineStart + valueOffset + rawValue.length,
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
const updateCaption = ({ input, caption, patch, }) => {
|
|
101
|
-
const current = getStaticCaption(caption);
|
|
102
|
-
if (!captionKeys.every((key) => current[key] === patch.before[key])) {
|
|
103
|
-
throw new Error(`Caption ${patch.index} changed in the source file before this edit could be saved`);
|
|
104
|
-
}
|
|
105
|
-
const changedKeys = Object.keys(patch.changes);
|
|
106
|
-
if (changedKeys.length === 0 || !changedKeys.every(isCaptionKey)) {
|
|
107
|
-
throw new Error('Caption patches must change at least one caption field');
|
|
108
|
-
}
|
|
109
|
-
const replacements = [];
|
|
110
|
-
for (const key of changedKeys) {
|
|
111
|
-
const value = patch.changes[key];
|
|
112
|
-
if ((key === 'text' && typeof value !== 'string') ||
|
|
113
|
-
((key === 'startMs' || key === 'endMs') &&
|
|
114
|
-
(typeof value !== 'number' || !Number.isFinite(value))) ||
|
|
115
|
-
((key === 'timestampMs' || key === 'confidence') &&
|
|
116
|
-
value !== null &&
|
|
117
|
-
(typeof value !== 'number' || !Number.isFinite(value)))) {
|
|
118
|
-
throw new Error(`Caption ${key} has an invalid value`);
|
|
119
|
-
}
|
|
120
|
-
const property = caption.properties.find((candidate) => {
|
|
121
|
-
return (candidate.type === 'ObjectProperty' &&
|
|
122
|
-
!candidate.computed &&
|
|
123
|
-
getPropertyKey(candidate) === key);
|
|
124
|
-
});
|
|
125
|
-
if (!property || property.type !== 'ObjectProperty') {
|
|
126
|
-
throw new Error(`Caption ${patch.index} is missing ${key}`);
|
|
127
|
-
}
|
|
128
|
-
const { start, end } = getSourceValueRange({ input, property, key });
|
|
129
|
-
replacements.push({
|
|
130
|
-
start,
|
|
131
|
-
end,
|
|
132
|
-
value: getReplacementValue({
|
|
133
|
-
value: value,
|
|
134
|
-
previous: property.value,
|
|
135
|
-
}),
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return { changedFields: changedKeys, replacements };
|
|
139
|
-
};
|
|
140
|
-
const updateInlineCaptionPatches = ({ input, nodePath, patches, }) => {
|
|
141
|
-
var _a, _b, _c;
|
|
142
|
-
var _d;
|
|
143
|
-
if (patches.length === 0) {
|
|
144
|
-
throw new Error('Expected at least one caption patch');
|
|
145
|
-
}
|
|
146
|
-
const ast = (0, parse_ast_1.parseAst)(input);
|
|
147
|
-
const jsxElement = (0, can_update_sequence_props_1.findJsxElementNodeAtNodePath)(ast, nodePath);
|
|
148
|
-
if (!jsxElement) {
|
|
149
|
-
throw new Error('Could not find a JSX element at the specified line to update');
|
|
150
|
-
}
|
|
151
|
-
const captionsAttribute = (_a = jsxElement.openingElement.attributes) === null || _a === void 0 ? void 0 : _a.find((attribute) => attribute.type === 'JSXAttribute' &&
|
|
152
|
-
attribute.name.type === 'JSXIdentifier' &&
|
|
153
|
-
attribute.name.name === 'captions');
|
|
154
|
-
if (!captionsAttribute ||
|
|
155
|
-
captionsAttribute.type !== 'JSXAttribute' ||
|
|
156
|
-
((_b = captionsAttribute.value) === null || _b === void 0 ? void 0 : _b.type) !== 'JSXExpressionContainer' ||
|
|
157
|
-
captionsAttribute.value.expression.type !== 'ArrayExpression') {
|
|
158
|
-
throw new Error('Captions must be an inline JSX array to edit them');
|
|
159
|
-
}
|
|
160
|
-
const captions = captionsAttribute.value.expression.elements;
|
|
161
|
-
const changedFields = [];
|
|
162
|
-
const replacements = [];
|
|
163
|
-
for (const patch of patches) {
|
|
164
|
-
if (!Number.isInteger(patch.index) || patch.index < 0) {
|
|
165
|
-
throw new Error('Caption patch index must be a non-negative integer');
|
|
166
|
-
}
|
|
167
|
-
const caption = captions[patch.index];
|
|
168
|
-
if (!caption || caption.type !== 'ObjectExpression') {
|
|
169
|
-
throw new Error(`Could not find inline caption ${patch.index}`);
|
|
170
|
-
}
|
|
171
|
-
const result = updateCaption({ input, caption, patch });
|
|
172
|
-
changedFields.push(result.changedFields);
|
|
173
|
-
replacements.push(...result.replacements);
|
|
174
|
-
}
|
|
175
|
-
const output = replacements
|
|
176
|
-
.sort((a, b) => b.start - a.start)
|
|
177
|
-
.reduce((current, replacement) => current.slice(0, replacement.start) +
|
|
178
|
-
replacement.value +
|
|
179
|
-
current.slice(replacement.end), input);
|
|
180
|
-
return {
|
|
181
|
-
output,
|
|
182
|
-
logLine: (_d = (_c = jsxElement.openingElement.loc) === null || _c === void 0 ? void 0 : _c.start.line) !== null && _d !== void 0 ? _d : 1,
|
|
183
|
-
changedFields,
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
exports.updateInlineCaptionPatches = updateInlineCaptionPatches;
|
|
4
|
+
const studio_codemods_1 = require("@remotion/studio-codemods");
|
|
5
|
+
Object.defineProperty(exports, "updateInlineCaptionPatches", { enumerable: true, get: function () { return studio_codemods_1.updateInlineCaptionPatches; } });
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate, updateSequencePropsAst } from '@remotion/studio-codemods';
|
|
2
2
|
import type { InteractivitySchema, SequenceNodePath, VideoConfigValues } from 'remotion';
|
|
3
|
-
export type SequencePropUpdate
|
|
4
|
-
key: string;
|
|
5
|
-
value: unknown;
|
|
6
|
-
defaultValue: unknown | null;
|
|
7
|
-
googleFont?: GoogleFontSourceEdit | null;
|
|
8
|
-
};
|
|
9
|
-
export type RemovedProp = {
|
|
10
|
-
key: string;
|
|
11
|
-
valueString: string;
|
|
12
|
-
};
|
|
13
|
-
export type SequencePropsNodeUpdate = {
|
|
14
|
-
nodePath: SequenceNodePath;
|
|
15
|
-
updates: SequencePropUpdate[];
|
|
16
|
-
schema: InteractivitySchema;
|
|
17
|
-
videoConfigValues: VideoConfigValues | null;
|
|
18
|
-
};
|
|
19
|
-
export type SequencePropsNodeUpdateResult = {
|
|
20
|
-
oldValueStrings: string[];
|
|
21
|
-
logLine: number;
|
|
22
|
-
removedProps: RemovedProp[];
|
|
23
|
-
};
|
|
3
|
+
export { type RemovedProp, type SequencePropsNodeUpdate, type SequencePropsNodeUpdateResult, type SequencePropUpdate, updateSequencePropsAst, };
|
|
24
4
|
type PrettierConfigOverride = Record<string, unknown> | null;
|
|
25
5
|
type UpdateMultipleSequencePropsResult = {
|
|
26
6
|
output: string;
|
|
@@ -34,18 +14,6 @@ type UpdateSequencePropsResult = {
|
|
|
34
14
|
logLine: number;
|
|
35
15
|
removedProps: RemovedProp[];
|
|
36
16
|
};
|
|
37
|
-
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, videoConfigValues, }: {
|
|
38
|
-
input: string;
|
|
39
|
-
nodePath: SequenceNodePath;
|
|
40
|
-
updates: SequencePropUpdate[];
|
|
41
|
-
schema: InteractivitySchema;
|
|
42
|
-
videoConfigValues: VideoConfigValues | null;
|
|
43
|
-
}) => {
|
|
44
|
-
serialized: string;
|
|
45
|
-
oldValueStrings: string[];
|
|
46
|
-
logLine: number;
|
|
47
|
-
removedProps: RemovedProp[];
|
|
48
|
-
};
|
|
49
17
|
export declare const updateMultipleSequenceProps: ({ input, changes, prettierConfigOverride, }: {
|
|
50
18
|
input: string;
|
|
51
19
|
changes: SequencePropsNodeUpdate[];
|
|
@@ -59,4 +27,3 @@ export declare const updateSequenceProps: ({ input, nodePath, updates, schema, p
|
|
|
59
27
|
prettierConfigOverride: PrettierConfigOverride;
|
|
60
28
|
videoConfigValues: VideoConfigValues | null;
|
|
61
29
|
}) => Promise<UpdateSequencePropsResult>;
|
|
62
|
-
export {};
|