@remotion/studio-server 4.0.459 → 4.0.461
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 +1 -1
- package/dist/codemods/duplicate-jsx-node.d.ts +1 -1
- package/dist/codemods/jsx-sequence-context.d.ts +1 -1
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +35 -0
- package/dist/codemods/update-sequence-props/update-sequence-props.js +224 -0
- package/dist/codemods/update-sequence-props.d.ts +7 -1
- package/dist/codemods/update-sequence-props.js +37 -3
- package/dist/helpers/get-ast-node-path.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/preview-server/node-path-cache.d.ts +1 -1
- package/dist/preview-server/routes/apply-visual-control-change.js +4 -4
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +6 -4
- package/dist/preview-server/routes/can-update-sequence-props.js +20 -24
- package/dist/preview-server/routes/delete-jsx-node.js +4 -4
- package/dist/preview-server/routes/duplicate-jsx-node.js +4 -4
- package/dist/preview-server/routes/log-update.d.ts +13 -2
- package/dist/preview-server/routes/log-update.js +40 -31
- package/dist/preview-server/routes/log-updates/format-prop-change.d.ts +9 -0
- package/dist/preview-server/routes/log-updates/format-prop-change.js +29 -0
- package/dist/preview-server/routes/log-updates/format-side-props.d.ts +5 -0
- package/dist/preview-server/routes/log-updates/format-side-props.js +18 -0
- package/dist/preview-server/routes/log-updates/formatting.d.ts +19 -0
- package/dist/preview-server/routes/log-updates/formatting.js +67 -0
- package/dist/preview-server/routes/log-updates/log-update.d.ts +15 -0
- package/dist/preview-server/routes/log-updates/log-update.js +39 -0
- package/dist/preview-server/routes/save-sequence-props.d.ts +3 -2
- package/dist/preview-server/routes/save-sequence-props.js +80 -85
- package/dist/preview-server/routes/update-default-props.js +4 -4
- package/dist/preview-server/sequence-props-watchers.d.ts +3 -2
- package/dist/preview-server/sequence-props-watchers.js +4 -3
- package/dist/preview-server/start-server.d.ts +0 -1
- package/dist/preview-server/start-server.js +0 -1
- package/dist/preview-server/undo-stack.js +1 -1
- package/dist/preview-server/watch-ignore-next-change.d.ts +1 -0
- package/dist/preview-server/watch-ignore-next-change.js +25 -1
- package/dist/routes.js +6 -14
- package/dist/start-studio.d.ts +1 -2
- package/dist/start-studio.js +1 -2
- package/package.json +8 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { File, JSXElement } from '@babel/types';
|
|
2
|
-
import type { SequenceNodePath } from '
|
|
2
|
+
import type { SequenceNodePath } from 'remotion';
|
|
3
3
|
/** e.g. `<Video>` or `<Remotion.Sequence>` for logs and undo copy. */
|
|
4
4
|
export declare const getJsxElementTagLabel: (element: JSXElement) => string;
|
|
5
5
|
export declare const findJsxElementPathForDeletion: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '
|
|
1
|
+
import type { SequenceNodePath } from 'remotion';
|
|
2
2
|
export declare const duplicateJsxElementAtPath: (jsxPath: import("ast-types/lib/node-path").NodePath<N, V>) => void;
|
|
3
3
|
export declare const duplicateJsxNode: ({ input, nodePath, prettierConfigOverride, }: {
|
|
4
4
|
input: string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SequenceNodePath } from 'remotion';
|
|
2
|
+
import type { SequenceSchema } from 'remotion';
|
|
3
|
+
export type SequencePropUpdate = {
|
|
4
|
+
key: string;
|
|
5
|
+
value: unknown;
|
|
6
|
+
defaultValue: unknown | null;
|
|
7
|
+
};
|
|
8
|
+
export type RemovedProp = {
|
|
9
|
+
key: string;
|
|
10
|
+
valueString: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, }: {
|
|
13
|
+
input: string;
|
|
14
|
+
nodePath: SequenceNodePath;
|
|
15
|
+
updates: SequencePropUpdate[];
|
|
16
|
+
schema: SequenceSchema;
|
|
17
|
+
}) => {
|
|
18
|
+
serialized: string;
|
|
19
|
+
oldValueStrings: string[];
|
|
20
|
+
logLine: number;
|
|
21
|
+
removedProps: RemovedProp[];
|
|
22
|
+
};
|
|
23
|
+
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, }: {
|
|
24
|
+
input: string;
|
|
25
|
+
nodePath: SequenceNodePath;
|
|
26
|
+
updates: SequencePropUpdate[];
|
|
27
|
+
schema: SequenceSchema;
|
|
28
|
+
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
29
|
+
}) => Promise<{
|
|
30
|
+
output: string;
|
|
31
|
+
oldValueStrings: string[];
|
|
32
|
+
formatted: boolean;
|
|
33
|
+
logLine: number;
|
|
34
|
+
removedProps: RemovedProp[];
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,224 @@
|
|
|
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.updateSequenceProps = exports.updateSequencePropsAst = void 0;
|
|
37
|
+
const recast = __importStar(require("recast"));
|
|
38
|
+
const no_react_1 = require("remotion/no-react");
|
|
39
|
+
const can_update_sequence_props_1 = require("../../preview-server/routes/can-update-sequence-props");
|
|
40
|
+
const format_file_content_1 = require("../format-file-content");
|
|
41
|
+
const parse_ast_1 = require("../parse-ast");
|
|
42
|
+
const update_nested_prop_1 = require("../update-nested-prop");
|
|
43
|
+
const b = recast.types.builders;
|
|
44
|
+
const removeVariantKey = ({ node, variantKey, }) => {
|
|
45
|
+
var _a;
|
|
46
|
+
const dotIndex = variantKey.indexOf('.');
|
|
47
|
+
if (dotIndex === -1) {
|
|
48
|
+
const idx = (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.findIndex((a) => a.type === 'JSXAttribute' &&
|
|
49
|
+
a.name.type === 'JSXIdentifier' &&
|
|
50
|
+
a.name.name === variantKey);
|
|
51
|
+
if (idx !== undefined && idx !== -1 && node.attributes) {
|
|
52
|
+
node.attributes.splice(idx, 1);
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
(0, update_nested_prop_1.updateNestedProp)({
|
|
57
|
+
node,
|
|
58
|
+
parentKey: variantKey.slice(0, dotIndex),
|
|
59
|
+
childKey: variantKey.slice(dotIndex + 1),
|
|
60
|
+
value: undefined,
|
|
61
|
+
defaultValue: null,
|
|
62
|
+
isDefault: true,
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
const snapshotTopLevelAttrs = (node) => {
|
|
66
|
+
var _a;
|
|
67
|
+
const result = new Map();
|
|
68
|
+
for (const a of (_a = node.attributes) !== null && _a !== void 0 ? _a : []) {
|
|
69
|
+
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
70
|
+
const { name } = a.name;
|
|
71
|
+
const printed = recast
|
|
72
|
+
.print(a)
|
|
73
|
+
.code.replace(/\s+/g, ' ')
|
|
74
|
+
.replace(/,(\s*[}\]])/g, '$1')
|
|
75
|
+
.trim();
|
|
76
|
+
const prefix = `${name}=`;
|
|
77
|
+
let valueOnly = printed.startsWith(prefix)
|
|
78
|
+
? printed.slice(prefix.length)
|
|
79
|
+
: printed;
|
|
80
|
+
if (valueOnly.startsWith('{') && valueOnly.endsWith('}')) {
|
|
81
|
+
valueOnly = valueOnly.slice(1, -1).trim();
|
|
82
|
+
}
|
|
83
|
+
result.set(name, valueOnly);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
};
|
|
88
|
+
const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
89
|
+
var _a, _b, _c;
|
|
90
|
+
var _d, _e;
|
|
91
|
+
const ast = (0, parse_ast_1.parseAst)(input);
|
|
92
|
+
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
93
|
+
if (!node) {
|
|
94
|
+
throw new Error('Could not find a JSX element at the specified line to update');
|
|
95
|
+
}
|
|
96
|
+
const logLine = (_d = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
97
|
+
const oldValueStrings = [];
|
|
98
|
+
const initialAttrs = snapshotTopLevelAttrs(node);
|
|
99
|
+
const updatedTopLevelKeys = new Set(updates.map(({ key }) => {
|
|
100
|
+
const dot = key.indexOf('.');
|
|
101
|
+
return dot === -1 ? key : key.slice(0, dot);
|
|
102
|
+
}));
|
|
103
|
+
for (const { key, value, defaultValue } of updates) {
|
|
104
|
+
let oldValueString = '';
|
|
105
|
+
const isDefault = defaultValue !== null &&
|
|
106
|
+
JSON.stringify(value) === JSON.stringify(defaultValue);
|
|
107
|
+
const dotIndex = key.indexOf('.');
|
|
108
|
+
const isNested = dotIndex !== -1;
|
|
109
|
+
const parentKey = isNested ? key.slice(0, dotIndex) : key;
|
|
110
|
+
const childKey = isNested ? key.slice(dotIndex + 1) : '';
|
|
111
|
+
if (isNested) {
|
|
112
|
+
oldValueString = (0, update_nested_prop_1.updateNestedProp)({
|
|
113
|
+
node,
|
|
114
|
+
parentKey,
|
|
115
|
+
childKey,
|
|
116
|
+
value,
|
|
117
|
+
defaultValue,
|
|
118
|
+
isDefault,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
const attrIndex = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.findIndex((a) => {
|
|
123
|
+
if (a.type === 'JSXSpreadAttribute') {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (a.name.type === 'JSXNamespacedName') {
|
|
127
|
+
return false;
|
|
128
|
+
}
|
|
129
|
+
return a.name.name === key;
|
|
130
|
+
});
|
|
131
|
+
const attr = attrIndex !== undefined && attrIndex !== -1
|
|
132
|
+
? (_c = node.attributes) === null || _c === void 0 ? void 0 : _c[attrIndex]
|
|
133
|
+
: undefined;
|
|
134
|
+
if (attr && attr.type !== 'JSXSpreadAttribute' && attr.value) {
|
|
135
|
+
const printed = recast.print(attr.value).code;
|
|
136
|
+
// Strip JSX expression container braces, e.g. "{30}" -> "30"
|
|
137
|
+
oldValueString =
|
|
138
|
+
printed.startsWith('{') && printed.endsWith('}')
|
|
139
|
+
? printed.slice(1, -1)
|
|
140
|
+
: printed;
|
|
141
|
+
}
|
|
142
|
+
else if (attr && attr.type !== 'JSXSpreadAttribute' && !attr.value) {
|
|
143
|
+
// JSX shorthand like `loop` (no value) is implicitly `true`
|
|
144
|
+
oldValueString = 'true';
|
|
145
|
+
}
|
|
146
|
+
else if (!attr && defaultValue !== null) {
|
|
147
|
+
oldValueString = JSON.stringify(defaultValue);
|
|
148
|
+
}
|
|
149
|
+
if (isDefault) {
|
|
150
|
+
if (attr && attr.type !== 'JSXSpreadAttribute' && node.attributes) {
|
|
151
|
+
node.attributes.splice(attrIndex, 1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
const parsed = (0, update_nested_prop_1.parseValueExpression)(value);
|
|
156
|
+
const newValue = value === true ? null : b.jsxExpressionContainer(parsed);
|
|
157
|
+
if (!attr || attr.type === 'JSXSpreadAttribute') {
|
|
158
|
+
const newAttr = b.jsxAttribute(b.jsxIdentifier(key), newValue);
|
|
159
|
+
if (!node.attributes) {
|
|
160
|
+
node.attributes = [];
|
|
161
|
+
}
|
|
162
|
+
node.attributes.push(newAttr);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
attr.value = newValue;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
oldValueStrings.push(oldValueString);
|
|
170
|
+
if (!isNested) {
|
|
171
|
+
const fieldSchema = schema[key];
|
|
172
|
+
if (fieldSchema && fieldSchema.type === 'enum') {
|
|
173
|
+
const propsToDelete = no_react_1.NoReactInternals.findPropsToDelete({
|
|
174
|
+
schema,
|
|
175
|
+
key,
|
|
176
|
+
value,
|
|
177
|
+
});
|
|
178
|
+
for (const propToDelete of propsToDelete) {
|
|
179
|
+
removeVariantKey({ node, variantKey: propToDelete });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
const finalAttrNames = new Set();
|
|
185
|
+
for (const a of (_e = node.attributes) !== null && _e !== void 0 ? _e : []) {
|
|
186
|
+
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
187
|
+
finalAttrNames.add(a.name.name);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const removedProps = [];
|
|
191
|
+
for (const [name, valueString] of initialAttrs) {
|
|
192
|
+
if (finalAttrNames.has(name) || updatedTopLevelKeys.has(name)) {
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
removedProps.push({ key: name, valueString });
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
199
|
+
oldValueStrings,
|
|
200
|
+
logLine,
|
|
201
|
+
removedProps,
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
exports.updateSequencePropsAst = updateSequencePropsAst;
|
|
205
|
+
const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierConfigOverride, }) => {
|
|
206
|
+
const { serialized, oldValueStrings, logLine, removedProps } = (0, exports.updateSequencePropsAst)({
|
|
207
|
+
input,
|
|
208
|
+
nodePath,
|
|
209
|
+
updates,
|
|
210
|
+
schema,
|
|
211
|
+
});
|
|
212
|
+
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
213
|
+
input: serialized,
|
|
214
|
+
prettierConfigOverride,
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
output,
|
|
218
|
+
oldValueStrings,
|
|
219
|
+
formatted,
|
|
220
|
+
logLine,
|
|
221
|
+
removedProps,
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
exports.updateSequenceProps = updateSequenceProps;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '
|
|
1
|
+
import type { SequenceNodePath } from 'remotion';
|
|
2
2
|
import type { SequenceSchema } from 'remotion';
|
|
3
3
|
export type SequencePropUpdate = {
|
|
4
4
|
key: string;
|
|
5
5
|
value: unknown;
|
|
6
6
|
defaultValue: unknown | null;
|
|
7
7
|
};
|
|
8
|
+
export type RemovedProp = {
|
|
9
|
+
key: string;
|
|
10
|
+
valueString: string;
|
|
11
|
+
};
|
|
8
12
|
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, }: {
|
|
9
13
|
input: string;
|
|
10
14
|
nodePath: SequenceNodePath;
|
|
@@ -14,6 +18,7 @@ export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema
|
|
|
14
18
|
serialized: string;
|
|
15
19
|
oldValueStrings: string[];
|
|
16
20
|
logLine: number;
|
|
21
|
+
removedProps: RemovedProp[];
|
|
17
22
|
};
|
|
18
23
|
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, }: {
|
|
19
24
|
input: string;
|
|
@@ -26,4 +31,5 @@ export declare const updateSequenceProps: ({ input, nodePath, updates, schema, p
|
|
|
26
31
|
oldValueStrings: string[];
|
|
27
32
|
formatted: boolean;
|
|
28
33
|
logLine: number;
|
|
34
|
+
removedProps: RemovedProp[];
|
|
29
35
|
}>;
|
|
@@ -61,9 +61,23 @@ const removeVariantKey = ({ node, variantKey, }) => {
|
|
|
61
61
|
isDefault: true,
|
|
62
62
|
});
|
|
63
63
|
};
|
|
64
|
+
const snapshotTopLevelAttrs = (node) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const result = new Map();
|
|
67
|
+
for (const a of (_a = node.attributes) !== null && _a !== void 0 ? _a : []) {
|
|
68
|
+
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
69
|
+
result.set(a.name.name, recast
|
|
70
|
+
.print(a)
|
|
71
|
+
.code.replace(/\s+/g, ' ')
|
|
72
|
+
.replace(/,(\s*[}\]])/g, '$1')
|
|
73
|
+
.trim());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
};
|
|
64
78
|
const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
65
79
|
var _a, _b, _c;
|
|
66
|
-
var _d;
|
|
80
|
+
var _d, _e;
|
|
67
81
|
const ast = (0, parse_ast_1.parseAst)(input);
|
|
68
82
|
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
69
83
|
if (!node) {
|
|
@@ -71,6 +85,11 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
|
71
85
|
}
|
|
72
86
|
const logLine = (_d = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
73
87
|
const oldValueStrings = [];
|
|
88
|
+
const initialAttrs = snapshotTopLevelAttrs(node);
|
|
89
|
+
const updatedTopLevelKeys = new Set(updates.map(({ key }) => {
|
|
90
|
+
const dot = key.indexOf('.');
|
|
91
|
+
return dot === -1 ? key : key.slice(0, dot);
|
|
92
|
+
}));
|
|
74
93
|
for (const { key, value, defaultValue } of updates) {
|
|
75
94
|
let oldValueString = '';
|
|
76
95
|
const isDefault = defaultValue !== null &&
|
|
@@ -145,7 +164,7 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
|
145
164
|
try {
|
|
146
165
|
oldRawValue = JSON.parse(oldValueString);
|
|
147
166
|
}
|
|
148
|
-
catch (
|
|
167
|
+
catch (_f) {
|
|
149
168
|
oldRawValue = oldValueString;
|
|
150
169
|
}
|
|
151
170
|
if (oldRawValue !== value) {
|
|
@@ -166,15 +185,29 @@ const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
|
166
185
|
}
|
|
167
186
|
}
|
|
168
187
|
}
|
|
188
|
+
const finalAttrNames = new Set();
|
|
189
|
+
for (const a of (_e = node.attributes) !== null && _e !== void 0 ? _e : []) {
|
|
190
|
+
if (a.type === 'JSXAttribute' && a.name.type === 'JSXIdentifier') {
|
|
191
|
+
finalAttrNames.add(a.name.name);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const removedProps = [];
|
|
195
|
+
for (const [name, valueString] of initialAttrs) {
|
|
196
|
+
if (finalAttrNames.has(name) || updatedTopLevelKeys.has(name)) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
removedProps.push({ key: name, valueString });
|
|
200
|
+
}
|
|
169
201
|
return {
|
|
170
202
|
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
171
203
|
oldValueStrings,
|
|
172
204
|
logLine,
|
|
205
|
+
removedProps,
|
|
173
206
|
};
|
|
174
207
|
};
|
|
175
208
|
exports.updateSequencePropsAst = updateSequencePropsAst;
|
|
176
209
|
const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierConfigOverride, }) => {
|
|
177
|
-
const { serialized, oldValueStrings, logLine } = (0, exports.updateSequencePropsAst)({
|
|
210
|
+
const { serialized, oldValueStrings, logLine, removedProps } = (0, exports.updateSequencePropsAst)({
|
|
178
211
|
input,
|
|
179
212
|
nodePath,
|
|
180
213
|
updates,
|
|
@@ -189,6 +222,7 @@ const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierC
|
|
|
189
222
|
oldValueStrings,
|
|
190
223
|
formatted,
|
|
191
224
|
logLine,
|
|
225
|
+
removedProps,
|
|
192
226
|
};
|
|
193
227
|
};
|
|
194
228
|
exports.updateSequenceProps = updateSequenceProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { File } from '@babel/types';
|
|
2
|
-
import type { SequenceNodePath } from '
|
|
2
|
+
import type { SequenceNodePath } from 'remotion';
|
|
3
3
|
export declare const getAstNodePath: (ast: File, nodePath: SequenceNodePath) => import("ast-types/lib/node-path").NodePath<N, V> | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { ApiRoutes, CopyStillToClipboardRequest, getDefaultOutLocation, OpenInFi
|
|
|
2
2
|
export type { AggregateRenderProgress, BundlingState, CopyingState, DownloadProgress, HotMiddlewareOptions, JobProgressCallback, ModuleMap, PackageManager, ProjectInfo, RenderingProgressInput, RenderJob, RenderJobWithCleanup, RequiredChromiumOptions, StitchingProgressInput, UiOpenGlOptions, } from '@remotion/studio-shared';
|
|
3
3
|
import { AnsiDiff } from './ansi-diff';
|
|
4
4
|
export declare const StudioServerInternals: {
|
|
5
|
-
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled,
|
|
5
|
+
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, experimentalClientSideRenderingEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, enableCrossSiteIsolation, askAIEnabled, forceNew, rspack, }: {
|
|
6
6
|
browserArgs: string;
|
|
7
7
|
browserFlag: string;
|
|
8
8
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -16,7 +16,6 @@ export declare const StudioServerInternals: {
|
|
|
16
16
|
remotionRoot: string;
|
|
17
17
|
keyboardShortcutsEnabled: boolean;
|
|
18
18
|
experimentalClientSideRenderingEnabled: boolean;
|
|
19
|
-
experimentalVisualModeEnabled: boolean;
|
|
20
19
|
relativePublicDir: string | null;
|
|
21
20
|
webpackOverride: import("@remotion/bundler").WebpackOverrideFn;
|
|
22
21
|
poll: number | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SequenceNodePath } from '
|
|
1
|
+
import type { SequenceNodePath } from 'remotion';
|
|
2
2
|
export declare const getCachedNodePath: (fileName: string, line: number, column: number) => SequenceNodePath | undefined;
|
|
3
3
|
export declare const setCachedNodePath: (fileName: string, line: number, column: number, nodePath: SequenceNodePath) => void;
|
|
4
4
|
export declare const clearNodePathCache: () => void;
|
|
@@ -48,7 +48,7 @@ const format_log_file_location_1 = require("../format-log-file-location");
|
|
|
48
48
|
const live_events_1 = require("../live-events");
|
|
49
49
|
const undo_stack_1 = require("../undo-stack");
|
|
50
50
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
51
|
-
const log_update_1 = require("./log-update");
|
|
51
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
52
52
|
const getVisualControlChangeLine = (file, changeId) => {
|
|
53
53
|
let line = 1;
|
|
54
54
|
recast.types.visit(file.program, {
|
|
@@ -118,8 +118,8 @@ const applyVisualControlHandler = async ({ input: { fileName, changes }, remotio
|
|
|
118
118
|
remotionRoot,
|
|
119
119
|
logLine,
|
|
120
120
|
description: {
|
|
121
|
-
undoMessage: '
|
|
122
|
-
redoMessage: '
|
|
121
|
+
undoMessage: '↩️ Visual control change',
|
|
122
|
+
redoMessage: '↪️ Visual control change',
|
|
123
123
|
},
|
|
124
124
|
entryType: 'visual-control',
|
|
125
125
|
suppressHmrOnFileRestore: true,
|
|
@@ -144,7 +144,7 @@ const applyVisualControlHandler = async ({ input: { fileName, changes }, remotio
|
|
|
144
144
|
absolutePath,
|
|
145
145
|
line: logLine,
|
|
146
146
|
});
|
|
147
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}
|
|
147
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Applied visual control changes`);
|
|
148
148
|
if (!formatted) {
|
|
149
149
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
150
150
|
}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import type { Expression, File, JSXOpeningElement } from '@babel/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
|
|
3
|
+
import type { CanUpdateSequencePropsResponseTrue } from 'remotion';
|
|
4
|
+
import type { SequenceNodePath } from 'remotion';
|
|
3
5
|
export declare const isStaticValue: (node: Expression) => boolean;
|
|
4
6
|
export declare const extractStaticValue: (node: Expression) => unknown;
|
|
5
7
|
export declare const findJsxElementAtNodePath: (ast: File, nodePath: SequenceNodePath) => JSXOpeningElement | null;
|
|
6
8
|
export declare const lineColumnToNodePath: (ast: File, targetLine: number) => SequenceNodePath | null;
|
|
7
|
-
export declare const computeSequencePropsStatusFromContent: (fileContents: string, nodePath: SequenceNodePath, keys: string[]) =>
|
|
9
|
+
export declare const computeSequencePropsStatusFromContent: (fileContents: string, nodePath: SequenceNodePath, keys: string[]) => CanUpdateSequencePropsResponseTrue;
|
|
8
10
|
export declare const computeSequencePropsStatus: ({ fileName, nodePath, keys, remotionRoot, }: {
|
|
9
11
|
fileName: string;
|
|
10
12
|
nodePath: SequenceNodePath;
|
|
11
13
|
keys: string[];
|
|
12
14
|
remotionRoot: string;
|
|
13
|
-
}) =>
|
|
15
|
+
}) => CanUpdateSequencePropsResponseTrue;
|
|
14
16
|
export declare const computeSequencePropsStatusFromFilenameByLine: ({ fileName, line, keys, remotionRoot, }: {
|
|
15
17
|
fileName: string;
|
|
16
18
|
line: number;
|
|
17
19
|
keys: string[];
|
|
18
20
|
remotionRoot: string;
|
|
19
|
-
}) =>
|
|
21
|
+
}) => SubscribeToSequencePropsResponse;
|
|
@@ -40,7 +40,6 @@ exports.computeSequencePropsStatusFromFilenameByLine = exports.computeSequencePr
|
|
|
40
40
|
const node_fs_1 = require("node:fs");
|
|
41
41
|
const node_path_1 = __importDefault(require("node:path"));
|
|
42
42
|
const recast = __importStar(require("recast"));
|
|
43
|
-
const jsx_sequence_context_1 = require("../../codemods/jsx-sequence-context");
|
|
44
43
|
const parse_ast_1 = require("../../codemods/parse-ast");
|
|
45
44
|
const get_ast_node_path_1 = require("../../helpers/get-ast-node-path");
|
|
46
45
|
const isStaticValue = (node) => {
|
|
@@ -271,27 +270,17 @@ const computeSequencePropsStatusFromContent = (fileContents, nodePath, keys) =>
|
|
|
271
270
|
return {
|
|
272
271
|
canUpdate: true,
|
|
273
272
|
props: filteredProps,
|
|
274
|
-
nodePath,
|
|
275
|
-
jsxInMapCallback: (0, jsx_sequence_context_1.isJsxUnderMapCallback)(ast, nodePath),
|
|
276
273
|
};
|
|
277
274
|
};
|
|
278
275
|
exports.computeSequencePropsStatusFromContent = computeSequencePropsStatusFromContent;
|
|
279
276
|
const computeSequencePropsStatus = ({ fileName, nodePath, keys, remotionRoot, }) => {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
throw new Error('Cannot read a file outside the project');
|
|
285
|
-
}
|
|
286
|
-
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
287
|
-
return (0, exports.computeSequencePropsStatusFromContent)(fileContents, nodePath, keys);
|
|
288
|
-
}
|
|
289
|
-
catch (err) {
|
|
290
|
-
return {
|
|
291
|
-
canUpdate: false,
|
|
292
|
-
reason: err.message,
|
|
293
|
-
};
|
|
277
|
+
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
278
|
+
const fileRelativeToRoot = node_path_1.default.relative(remotionRoot, absolutePath);
|
|
279
|
+
if (fileRelativeToRoot.startsWith('..')) {
|
|
280
|
+
throw new Error('Cannot read a file outside the project');
|
|
294
281
|
}
|
|
282
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
283
|
+
return (0, exports.computeSequencePropsStatusFromContent)(fileContents, nodePath, keys);
|
|
295
284
|
};
|
|
296
285
|
exports.computeSequencePropsStatus = computeSequencePropsStatus;
|
|
297
286
|
const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, keys, remotionRoot, }) => {
|
|
@@ -307,17 +296,24 @@ const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, keys, re
|
|
|
307
296
|
if (!resolvedNodePath) {
|
|
308
297
|
throw new Error('Could not find a JSX element at the specified location');
|
|
309
298
|
}
|
|
310
|
-
return
|
|
311
|
-
|
|
299
|
+
return {
|
|
300
|
+
status: (0, exports.computeSequencePropsStatus)({
|
|
301
|
+
fileName,
|
|
302
|
+
nodePath: resolvedNodePath,
|
|
303
|
+
keys,
|
|
304
|
+
remotionRoot,
|
|
305
|
+
}),
|
|
312
306
|
nodePath: resolvedNodePath,
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
});
|
|
307
|
+
success: true,
|
|
308
|
+
};
|
|
316
309
|
}
|
|
317
310
|
catch (err) {
|
|
318
311
|
return {
|
|
319
|
-
|
|
320
|
-
|
|
312
|
+
status: {
|
|
313
|
+
canUpdate: false,
|
|
314
|
+
reason: err.message,
|
|
315
|
+
},
|
|
316
|
+
success: false,
|
|
321
317
|
};
|
|
322
318
|
}
|
|
323
319
|
};
|
|
@@ -11,7 +11,7 @@ const delete_jsx_node_1 = require("../../codemods/delete-jsx-node");
|
|
|
11
11
|
const file_watcher_1 = require("../../file-watcher");
|
|
12
12
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
13
13
|
const undo_stack_1 = require("../undo-stack");
|
|
14
|
-
const log_update_1 = require("./log-update");
|
|
14
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
15
15
|
const deleteJsxNodeHandler = async ({ input: { fileName, nodePath }, remotionRoot, logLevel }) => {
|
|
16
16
|
try {
|
|
17
17
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[delete-jsx-node] Received request for fileName="${fileName}"`);
|
|
@@ -32,8 +32,8 @@ const deleteJsxNodeHandler = async ({ input: { fileName, nodePath }, remotionRoo
|
|
|
32
32
|
remotionRoot,
|
|
33
33
|
logLine,
|
|
34
34
|
description: {
|
|
35
|
-
undoMessage:
|
|
36
|
-
redoMessage:
|
|
35
|
+
undoMessage: `↩️ Deletion of ${nodeLabel}`,
|
|
36
|
+
redoMessage: `↪️ Deletion of ${nodeLabel}`,
|
|
37
37
|
},
|
|
38
38
|
entryType: 'delete-jsx-node',
|
|
39
39
|
suppressHmrOnFileRestore: false,
|
|
@@ -45,7 +45,7 @@ const deleteJsxNodeHandler = async ({ input: { fileName, nodePath }, remotionRoo
|
|
|
45
45
|
absolutePath,
|
|
46
46
|
line: logLine,
|
|
47
47
|
});
|
|
48
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}
|
|
48
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Deleted ${nodeLabel}`);
|
|
49
49
|
if (!formatted) {
|
|
50
50
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
51
51
|
}
|
|
@@ -11,7 +11,7 @@ const duplicate_jsx_node_1 = require("../../codemods/duplicate-jsx-node");
|
|
|
11
11
|
const file_watcher_1 = require("../../file-watcher");
|
|
12
12
|
const format_log_file_location_1 = require("../format-log-file-location");
|
|
13
13
|
const undo_stack_1 = require("../undo-stack");
|
|
14
|
-
const log_update_1 = require("./log-update");
|
|
14
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
15
15
|
const duplicateJsxNodeHandler = async ({ input: { fileName, nodePath }, remotionRoot, logLevel }) => {
|
|
16
16
|
try {
|
|
17
17
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[duplicate-jsx-node] Received request for fileName="${fileName}"`);
|
|
@@ -32,8 +32,8 @@ const duplicateJsxNodeHandler = async ({ input: { fileName, nodePath }, remotion
|
|
|
32
32
|
remotionRoot,
|
|
33
33
|
logLine,
|
|
34
34
|
description: {
|
|
35
|
-
undoMessage:
|
|
36
|
-
redoMessage:
|
|
35
|
+
undoMessage: `↩️ Duplication of ${nodeLabel}`,
|
|
36
|
+
redoMessage: `↪️ Duplication of ${nodeLabel}`,
|
|
37
37
|
},
|
|
38
38
|
entryType: 'duplicate-jsx-node',
|
|
39
39
|
suppressHmrOnFileRestore: false,
|
|
@@ -45,7 +45,7 @@ const duplicateJsxNodeHandler = async ({ input: { fileName, nodePath }, remotion
|
|
|
45
45
|
absolutePath,
|
|
46
46
|
line: logLine,
|
|
47
47
|
});
|
|
48
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}
|
|
48
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Duplicated ${nodeLabel}`);
|
|
49
49
|
if (!formatted) {
|
|
50
50
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
51
51
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
export declare const warnAboutPrettierOnce: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => void;
|
|
2
2
|
export declare const normalizeQuotes: (str: string) => string;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const fg: (r: number, g: number, b: number, str: string) => string;
|
|
4
|
+
export declare const bg: (r: number, g: number, b: number, str: string) => string;
|
|
5
|
+
export declare const strikeThrough: (str: string) => string;
|
|
6
|
+
export type PropDelta = {
|
|
7
|
+
key: string;
|
|
8
|
+
valueString: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const formatPropChange: ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }: {
|
|
4
11
|
key: string;
|
|
5
12
|
oldValueString: string;
|
|
6
13
|
newValueString: string;
|
|
7
14
|
defaultValueString: string | null;
|
|
15
|
+
removedProps: PropDelta[];
|
|
16
|
+
addedProps: PropDelta[];
|
|
8
17
|
}) => string;
|
|
9
|
-
export declare const logUpdate: ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, }: {
|
|
18
|
+
export declare const logUpdate: ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }: {
|
|
10
19
|
fileRelativeToRoot: string;
|
|
11
20
|
line: number;
|
|
12
21
|
key: string;
|
|
@@ -15,4 +24,6 @@ export declare const logUpdate: ({ fileRelativeToRoot, line, key, oldValueString
|
|
|
15
24
|
defaultValueString: string | null;
|
|
16
25
|
formatted: boolean;
|
|
17
26
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
27
|
+
removedProps: PropDelta[];
|
|
28
|
+
addedProps: PropDelta[];
|
|
18
29
|
}) => void;
|