@remotion/studio-server 4.0.457 → 4.0.458
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/get-all-schema-keys.d.ts +2 -0
- package/dist/codemods/get-all-schema-keys.js +8 -0
- package/dist/codemods/update-sequence-props.d.ts +20 -5
- package/dist/codemods/update-sequence-props.js +126 -61
- package/dist/preview-server/routes/apply-visual-control-change.js +2 -2
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -1
- package/dist/preview-server/routes/can-update-sequence-props.js +3 -3
- package/dist/preview-server/routes/delete-jsx-node.js +2 -2
- package/dist/preview-server/routes/duplicate-jsx-node.js +2 -2
- package/dist/preview-server/routes/save-sequence-props.js +16 -8
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +3 -2
- package/dist/preview-server/routes/update-default-props.js +2 -2
- package/dist/preview-server/sequence-props-watchers.js +19 -22
- package/package.json +6 -6
- package/dist/preview-server/hmr-suppression.d.ts +0 -2
- package/dist/preview-server/hmr-suppression.js +0 -18
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllSchemaKeys = void 0;
|
|
4
|
+
const remotion_1 = require("remotion");
|
|
5
|
+
const getAllSchemaKeys = (schema) => {
|
|
6
|
+
return Object.keys(remotion_1.Internals.getFlatSchemaWithAllKeys(schema));
|
|
7
|
+
};
|
|
8
|
+
exports.getAllSchemaKeys = getAllSchemaKeys;
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import type { SequenceNodePath } from '@remotion/studio-shared';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
nodePath: SequenceNodePath;
|
|
2
|
+
import type { SequenceSchema } from 'remotion';
|
|
3
|
+
export type SequencePropUpdate = {
|
|
5
4
|
key: string;
|
|
6
5
|
value: unknown;
|
|
7
|
-
defaultValue: unknown;
|
|
6
|
+
defaultValue: unknown | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const updateSequencePropsAst: ({ input, nodePath, updates, schema, }: {
|
|
9
|
+
input: string;
|
|
10
|
+
nodePath: SequenceNodePath;
|
|
11
|
+
updates: SequencePropUpdate[];
|
|
12
|
+
schema?: SequenceSchema | undefined;
|
|
13
|
+
}) => {
|
|
14
|
+
serialized: string;
|
|
15
|
+
oldValueStrings: string[];
|
|
16
|
+
logLine: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const updateSequenceProps: ({ input, nodePath, updates, schema, prettierConfigOverride, }: {
|
|
19
|
+
input: string;
|
|
20
|
+
nodePath: SequenceNodePath;
|
|
21
|
+
updates: SequencePropUpdate[];
|
|
22
|
+
schema: SequenceSchema;
|
|
8
23
|
prettierConfigOverride?: Record<string, unknown> | null | undefined;
|
|
9
24
|
}) => Promise<{
|
|
10
25
|
output: string;
|
|
11
|
-
|
|
26
|
+
oldValueStrings: string[];
|
|
12
27
|
formatted: boolean;
|
|
13
28
|
logLine: number;
|
|
14
29
|
}>;
|
|
@@ -33,95 +33,160 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.updateSequenceProps = void 0;
|
|
36
|
+
exports.updateSequenceProps = exports.updateSequencePropsAst = void 0;
|
|
37
37
|
const recast = __importStar(require("recast"));
|
|
38
38
|
const can_update_sequence_props_1 = require("../preview-server/routes/can-update-sequence-props");
|
|
39
39
|
const format_file_content_1 = require("./format-file-content");
|
|
40
40
|
const parse_ast_1 = require("./parse-ast");
|
|
41
41
|
const update_nested_prop_1 = require("./update-nested-prop");
|
|
42
42
|
const b = recast.types.builders;
|
|
43
|
-
const
|
|
43
|
+
const removeVariantKey = ({ node, variantKey, }) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const dotIndex = variantKey.indexOf('.');
|
|
46
|
+
if (dotIndex === -1) {
|
|
47
|
+
const idx = (_a = node.attributes) === null || _a === void 0 ? void 0 : _a.findIndex((a) => a.type === 'JSXAttribute' &&
|
|
48
|
+
a.name.type === 'JSXIdentifier' &&
|
|
49
|
+
a.name.name === variantKey);
|
|
50
|
+
if (idx !== undefined && idx !== -1 && node.attributes) {
|
|
51
|
+
node.attributes.splice(idx, 1);
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
(0, update_nested_prop_1.updateNestedProp)({
|
|
56
|
+
node,
|
|
57
|
+
parentKey: variantKey.slice(0, dotIndex),
|
|
58
|
+
childKey: variantKey.slice(dotIndex + 1),
|
|
59
|
+
value: undefined,
|
|
60
|
+
defaultValue: null,
|
|
61
|
+
isDefault: true,
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const updateSequencePropsAst = ({ input, nodePath, updates, schema, }) => {
|
|
44
65
|
var _a, _b, _c;
|
|
45
66
|
var _d;
|
|
46
67
|
const ast = (0, parse_ast_1.parseAst)(input);
|
|
47
|
-
let oldValueString = '';
|
|
48
|
-
const isDefault = defaultValue !== null &&
|
|
49
|
-
JSON.stringify(value) === JSON.stringify(defaultValue);
|
|
50
|
-
const dotIndex = key.indexOf('.');
|
|
51
|
-
const isNested = dotIndex !== -1;
|
|
52
|
-
const parentKey = isNested ? key.slice(0, dotIndex) : key;
|
|
53
|
-
const childKey = isNested ? key.slice(dotIndex + 1) : '';
|
|
54
68
|
const node = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, nodePath);
|
|
55
69
|
if (!node) {
|
|
56
70
|
throw new Error('Could not find a JSX element at the specified line to update');
|
|
57
71
|
}
|
|
58
72
|
const logLine = (_d = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _d !== void 0 ? _d : 1;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
const oldValueStrings = [];
|
|
74
|
+
for (const { key, value, defaultValue } of updates) {
|
|
75
|
+
let oldValueString = '';
|
|
76
|
+
const isDefault = defaultValue !== null &&
|
|
77
|
+
JSON.stringify(value) === JSON.stringify(defaultValue);
|
|
78
|
+
const dotIndex = key.indexOf('.');
|
|
79
|
+
const isNested = dotIndex !== -1;
|
|
80
|
+
const parentKey = isNested ? key.slice(0, dotIndex) : key;
|
|
81
|
+
const childKey = isNested ? key.slice(dotIndex + 1) : '';
|
|
82
|
+
if (isNested) {
|
|
83
|
+
oldValueString = (0, update_nested_prop_1.updateNestedProp)({
|
|
84
|
+
node,
|
|
85
|
+
parentKey,
|
|
86
|
+
childKey,
|
|
87
|
+
value,
|
|
88
|
+
defaultValue,
|
|
89
|
+
isDefault,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
const attrIndex = (_b = node.attributes) === null || _b === void 0 ? void 0 : _b.findIndex((a) => {
|
|
94
|
+
if (a.type === 'JSXSpreadAttribute') {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (a.name.type === 'JSXNamespacedName') {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
return a.name.name === key;
|
|
101
|
+
});
|
|
102
|
+
const attr = attrIndex !== undefined && attrIndex !== -1
|
|
103
|
+
? (_c = node.attributes) === null || _c === void 0 ? void 0 : _c[attrIndex]
|
|
104
|
+
: undefined;
|
|
105
|
+
if (attr && attr.type !== 'JSXSpreadAttribute' && attr.value) {
|
|
106
|
+
const printed = recast.print(attr.value).code;
|
|
107
|
+
// Strip JSX expression container braces, e.g. "{30}" -> "30"
|
|
108
|
+
oldValueString =
|
|
109
|
+
printed.startsWith('{') && printed.endsWith('}')
|
|
110
|
+
? printed.slice(1, -1)
|
|
111
|
+
: printed;
|
|
73
112
|
}
|
|
74
|
-
if (
|
|
75
|
-
|
|
113
|
+
else if (attr && attr.type !== 'JSXSpreadAttribute' && !attr.value) {
|
|
114
|
+
// JSX shorthand like `loop` (no value) is implicitly `true`
|
|
115
|
+
oldValueString = 'true';
|
|
76
116
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const attr = attrIndex !== undefined && attrIndex !== -1
|
|
80
|
-
? (_c = node.attributes) === null || _c === void 0 ? void 0 : _c[attrIndex]
|
|
81
|
-
: undefined;
|
|
82
|
-
if (attr && attr.type !== 'JSXSpreadAttribute' && attr.value) {
|
|
83
|
-
const printed = recast.print(attr.value).code;
|
|
84
|
-
// Strip JSX expression container braces, e.g. "{30}" -> "30"
|
|
85
|
-
oldValueString =
|
|
86
|
-
printed.startsWith('{') && printed.endsWith('}')
|
|
87
|
-
? printed.slice(1, -1)
|
|
88
|
-
: printed;
|
|
89
|
-
}
|
|
90
|
-
else if (attr && attr.type !== 'JSXSpreadAttribute' && !attr.value) {
|
|
91
|
-
// JSX shorthand like `loop` (no value) is implicitly `true`
|
|
92
|
-
oldValueString = 'true';
|
|
93
|
-
}
|
|
94
|
-
else if (!attr && defaultValue !== null) {
|
|
95
|
-
oldValueString = JSON.stringify(defaultValue);
|
|
96
|
-
}
|
|
97
|
-
if (isDefault) {
|
|
98
|
-
if (attr && attr.type !== 'JSXSpreadAttribute' && node.attributes) {
|
|
99
|
-
node.attributes.splice(attrIndex, 1);
|
|
117
|
+
else if (!attr && defaultValue !== null) {
|
|
118
|
+
oldValueString = JSON.stringify(defaultValue);
|
|
100
119
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const newValue = value === true ? null : b.jsxExpressionContainer(parsed);
|
|
105
|
-
if (!attr || attr.type === 'JSXSpreadAttribute') {
|
|
106
|
-
const newAttr = b.jsxAttribute(b.jsxIdentifier(key), newValue);
|
|
107
|
-
if (!node.attributes) {
|
|
108
|
-
node.attributes = [];
|
|
120
|
+
if (isDefault) {
|
|
121
|
+
if (attr && attr.type !== 'JSXSpreadAttribute' && node.attributes) {
|
|
122
|
+
node.attributes.splice(attrIndex, 1);
|
|
109
123
|
}
|
|
110
|
-
node.attributes.push(newAttr);
|
|
111
124
|
}
|
|
112
125
|
else {
|
|
113
|
-
|
|
126
|
+
const parsed = (0, update_nested_prop_1.parseValueExpression)(value);
|
|
127
|
+
const newValue = value === true ? null : b.jsxExpressionContainer(parsed);
|
|
128
|
+
if (!attr || attr.type === 'JSXSpreadAttribute') {
|
|
129
|
+
const newAttr = b.jsxAttribute(b.jsxIdentifier(key), newValue);
|
|
130
|
+
if (!node.attributes) {
|
|
131
|
+
node.attributes = [];
|
|
132
|
+
}
|
|
133
|
+
node.attributes.push(newAttr);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
attr.value = newValue;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
oldValueStrings.push(oldValueString);
|
|
141
|
+
if (schema && !isNested) {
|
|
142
|
+
const fieldSchema = schema[key];
|
|
143
|
+
if (fieldSchema && fieldSchema.type === 'enum') {
|
|
144
|
+
let oldRawValue;
|
|
145
|
+
try {
|
|
146
|
+
oldRawValue = JSON.parse(oldValueString);
|
|
147
|
+
}
|
|
148
|
+
catch (_e) {
|
|
149
|
+
oldRawValue = oldValueString;
|
|
150
|
+
}
|
|
151
|
+
if (oldRawValue !== value) {
|
|
152
|
+
const oldVariant = typeof oldRawValue === 'string'
|
|
153
|
+
? fieldSchema.variants[oldRawValue]
|
|
154
|
+
: undefined;
|
|
155
|
+
const newVariant = typeof value === 'string' ? fieldSchema.variants[value] : undefined;
|
|
156
|
+
if (oldVariant) {
|
|
157
|
+
const newKeys = new Set(newVariant ? Object.keys(newVariant) : []);
|
|
158
|
+
for (const variantKey of Object.keys(oldVariant)) {
|
|
159
|
+
if (newKeys.has(variantKey)) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
removeVariantKey({ node, variantKey });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
114
166
|
}
|
|
115
167
|
}
|
|
116
168
|
}
|
|
117
|
-
|
|
169
|
+
return {
|
|
170
|
+
serialized: (0, parse_ast_1.serializeAst)(ast),
|
|
171
|
+
oldValueStrings,
|
|
172
|
+
logLine,
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
exports.updateSequencePropsAst = updateSequencePropsAst;
|
|
176
|
+
const updateSequenceProps = async ({ input, nodePath, updates, schema, prettierConfigOverride, }) => {
|
|
177
|
+
const { serialized, oldValueStrings, logLine } = (0, exports.updateSequencePropsAst)({
|
|
178
|
+
input,
|
|
179
|
+
nodePath,
|
|
180
|
+
updates,
|
|
181
|
+
schema,
|
|
182
|
+
});
|
|
118
183
|
const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
|
|
119
|
-
input:
|
|
184
|
+
input: serialized,
|
|
120
185
|
prettierConfigOverride,
|
|
121
186
|
});
|
|
122
187
|
return {
|
|
123
188
|
output,
|
|
124
|
-
|
|
189
|
+
oldValueStrings,
|
|
125
190
|
formatted,
|
|
126
191
|
logLine,
|
|
127
192
|
};
|
|
@@ -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: 'Undo: Visual control change',
|
|
122
|
+
redoMessage: 'Redo: Visual control change',
|
|
123
123
|
},
|
|
124
124
|
entryType: 'visual-control',
|
|
125
125
|
suppressHmrOnFileRestore: true,
|
|
@@ -11,7 +11,7 @@ export declare const computeSequencePropsStatus: ({ fileName, nodePath, keys, re
|
|
|
11
11
|
keys: string[];
|
|
12
12
|
remotionRoot: string;
|
|
13
13
|
}) => CanUpdateSequencePropsResponse;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const computeSequencePropsStatusFromFilenameByLine: ({ fileName, line, keys, remotionRoot, }: {
|
|
15
15
|
fileName: string;
|
|
16
16
|
line: number;
|
|
17
17
|
keys: string[];
|
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.
|
|
39
|
+
exports.computeSequencePropsStatusFromFilenameByLine = exports.computeSequencePropsStatus = exports.computeSequencePropsStatusFromContent = exports.lineColumnToNodePath = exports.findJsxElementAtNodePath = exports.extractStaticValue = exports.isStaticValue = void 0;
|
|
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"));
|
|
@@ -294,7 +294,7 @@ const computeSequencePropsStatus = ({ fileName, nodePath, keys, remotionRoot, })
|
|
|
294
294
|
}
|
|
295
295
|
};
|
|
296
296
|
exports.computeSequencePropsStatus = computeSequencePropsStatus;
|
|
297
|
-
const
|
|
297
|
+
const computeSequencePropsStatusFromFilenameByLine = ({ fileName, line, keys, remotionRoot, }) => {
|
|
298
298
|
try {
|
|
299
299
|
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
300
300
|
const fileRelativeToRoot = node_path_1.default.relative(remotionRoot, absolutePath);
|
|
@@ -321,4 +321,4 @@ const computeSequencePropsStatusByLine = ({ fileName, line, keys, remotionRoot,
|
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
323
|
};
|
|
324
|
-
exports.
|
|
324
|
+
exports.computeSequencePropsStatusFromFilenameByLine = computeSequencePropsStatusFromFilenameByLine;
|
|
@@ -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: `Undo: Deletion of ${nodeLabel}`,
|
|
36
|
+
redoMessage: `Redo: Deletion of ${nodeLabel}`,
|
|
37
37
|
},
|
|
38
38
|
entryType: 'delete-jsx-node',
|
|
39
39
|
suppressHmrOnFileRestore: false,
|
|
@@ -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: `Undo: duplication of ${nodeLabel}`,
|
|
36
|
+
redoMessage: `Redo: duplication of ${nodeLabel}`,
|
|
37
37
|
},
|
|
38
38
|
entryType: 'duplicate-jsx-node',
|
|
39
39
|
suppressHmrOnFileRestore: false,
|
|
@@ -7,13 +7,15 @@ exports.saveSequencePropsHandler = void 0;
|
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const renderer_1 = require("@remotion/renderer");
|
|
10
|
+
const remotion_1 = require("remotion");
|
|
11
|
+
const get_all_schema_keys_1 = require("../../codemods/get-all-schema-keys");
|
|
10
12
|
const update_sequence_props_1 = require("../../codemods/update-sequence-props");
|
|
11
13
|
const file_watcher_1 = require("../../file-watcher");
|
|
12
14
|
const undo_stack_1 = require("../undo-stack");
|
|
13
15
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
14
16
|
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
15
17
|
const log_update_1 = require("./log-update");
|
|
16
|
-
const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, value, defaultValue,
|
|
18
|
+
const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, value, defaultValue, schema }, remotionRoot, logLevel, }) => {
|
|
17
19
|
try {
|
|
18
20
|
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[save-sequence-props] Received request for fileName="${fileName}" key="${key}"`);
|
|
19
21
|
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
@@ -22,13 +24,19 @@ const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, valu
|
|
|
22
24
|
throw new Error('Cannot modify a file outside the project');
|
|
23
25
|
}
|
|
24
26
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
25
|
-
const { output,
|
|
27
|
+
const { output, oldValueStrings, formatted, logLine } = await (0, update_sequence_props_1.updateSequenceProps)({
|
|
26
28
|
input: fileContents,
|
|
27
29
|
nodePath,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
updates: [
|
|
31
|
+
{
|
|
32
|
+
key,
|
|
33
|
+
value: JSON.parse(value),
|
|
34
|
+
defaultValue: defaultValue !== null ? JSON.parse(defaultValue) : null,
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
schema: remotion_1.Internals.sequenceSchema,
|
|
31
38
|
});
|
|
39
|
+
const oldValueString = oldValueStrings[0];
|
|
32
40
|
const newValueString = JSON.stringify(JSON.parse(value));
|
|
33
41
|
const parsedDefault = defaultValue !== null ? JSON.parse(defaultValue) : null;
|
|
34
42
|
const defaultValueString = parsedDefault !== null ? JSON.stringify(parsedDefault) : null;
|
|
@@ -54,8 +62,8 @@ const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, valu
|
|
|
54
62
|
remotionRoot,
|
|
55
63
|
logLine,
|
|
56
64
|
description: {
|
|
57
|
-
undoMessage: `
|
|
58
|
-
redoMessage: `
|
|
65
|
+
undoMessage: `Undo: ${undoPropChange}`,
|
|
66
|
+
redoMessage: `Redo: ${redoPropChange}`,
|
|
59
67
|
},
|
|
60
68
|
entryType: 'sequence-props',
|
|
61
69
|
suppressHmrOnFileRestore: true,
|
|
@@ -76,7 +84,7 @@ const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, valu
|
|
|
76
84
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
77
85
|
const newStatus = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
|
|
78
86
|
fileName,
|
|
79
|
-
keys:
|
|
87
|
+
keys: (0, get_all_schema_keys_1.getAllSchemaKeys)(schema),
|
|
80
88
|
nodePath,
|
|
81
89
|
remotionRoot,
|
|
82
90
|
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribeToSequenceProps = void 0;
|
|
4
|
+
const get_all_schema_keys_1 = require("../../codemods/get-all-schema-keys");
|
|
4
5
|
const sequence_props_watchers_1 = require("../sequence-props-watchers");
|
|
5
|
-
const subscribeToSequenceProps = ({ input: { fileName, line, column,
|
|
6
|
+
const subscribeToSequenceProps = ({ input: { fileName, line, column, schema, clientId }, remotionRoot }) => {
|
|
6
7
|
const result = (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
|
|
7
8
|
fileName,
|
|
8
9
|
line,
|
|
9
10
|
column,
|
|
10
|
-
keys,
|
|
11
|
+
keys: (0, get_all_schema_keys_1.getAllSchemaKeys)(schema),
|
|
11
12
|
remotionRoot,
|
|
12
13
|
clientId,
|
|
13
14
|
});
|
|
@@ -37,8 +37,8 @@ const updateDefaultPropsHandler = async ({ input: { compositionId, defaultProps,
|
|
|
37
37
|
remotionRoot,
|
|
38
38
|
logLine,
|
|
39
39
|
description: {
|
|
40
|
-
undoMessage: `
|
|
41
|
-
redoMessage: `
|
|
40
|
+
undoMessage: `Undo: default props update for "${compositionId}"`,
|
|
41
|
+
redoMessage: `Redo: default props update for "${compositionId}"`,
|
|
42
42
|
},
|
|
43
43
|
entryType: 'default-props',
|
|
44
44
|
suppressHmrOnFileRestore: true,
|
|
@@ -13,12 +13,9 @@ const sequencePropsWatchers = {};
|
|
|
13
13
|
const makeWatcherKey = ({ absolutePath, nodePath, }) => {
|
|
14
14
|
return `${absolutePath}:${JSON.stringify(nodePath)}`;
|
|
15
15
|
};
|
|
16
|
-
const
|
|
17
|
-
var _a;
|
|
18
|
-
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
16
|
+
const getSequencePropsStatus = ({ fileName, line, column, keys, remotionRoot, }) => {
|
|
19
17
|
// Try cached nodePath first (handles stale source maps after suppressed rebuilds)
|
|
20
18
|
const cachedNodePath = (0, node_path_cache_1.getCachedNodePath)(fileName, line, column);
|
|
21
|
-
let initialResult;
|
|
22
19
|
if (cachedNodePath) {
|
|
23
20
|
const cachedResult = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
|
|
24
21
|
fileName,
|
|
@@ -27,29 +24,29 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, keys, remoti
|
|
|
27
24
|
remotionRoot,
|
|
28
25
|
});
|
|
29
26
|
if (cachedResult.canUpdate) {
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// Cached nodePath no longer valid, fall back to line-based lookup
|
|
34
|
-
initialResult = (0, can_update_sequence_props_1.computeSequencePropsStatusByLine)({
|
|
35
|
-
fileName,
|
|
36
|
-
line,
|
|
37
|
-
keys,
|
|
38
|
-
remotionRoot,
|
|
39
|
-
});
|
|
27
|
+
return cachedResult;
|
|
40
28
|
}
|
|
41
29
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
30
|
+
return (0, can_update_sequence_props_1.computeSequencePropsStatusFromFilenameByLine)({
|
|
31
|
+
fileName,
|
|
32
|
+
line,
|
|
33
|
+
keys,
|
|
34
|
+
remotionRoot,
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
const subscribeToSequencePropsWatchers = ({ fileName, line, column, keys, remotionRoot, clientId, }) => {
|
|
38
|
+
var _a;
|
|
39
|
+
const initialResult = getSequencePropsStatus({
|
|
40
|
+
fileName,
|
|
41
|
+
line,
|
|
42
|
+
column,
|
|
43
|
+
keys,
|
|
44
|
+
remotionRoot,
|
|
45
|
+
});
|
|
50
46
|
if (!initialResult.canUpdate) {
|
|
51
47
|
return initialResult;
|
|
52
48
|
}
|
|
49
|
+
const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
|
|
53
50
|
// Cache the resolved nodePath for future lookups with stale source maps
|
|
54
51
|
(0, node_path_cache_1.setCachedNodePath)(fileName, line, column, initialResult.nodePath);
|
|
55
52
|
const { nodePath } = initialResult;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio-server",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.458",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"sideEffects": false,
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"@babel/parser": "7.24.1",
|
|
29
29
|
"semver": "7.5.3",
|
|
30
30
|
"prettier": "3.8.1",
|
|
31
|
-
"remotion": "4.0.
|
|
31
|
+
"remotion": "4.0.458",
|
|
32
32
|
"recast": "0.23.11",
|
|
33
|
-
"@remotion/bundler": "4.0.
|
|
34
|
-
"@remotion/renderer": "4.0.
|
|
35
|
-
"@remotion/studio-shared": "4.0.
|
|
33
|
+
"@remotion/bundler": "4.0.458",
|
|
34
|
+
"@remotion/renderer": "4.0.458",
|
|
35
|
+
"@remotion/studio-shared": "4.0.458",
|
|
36
36
|
"memfs": "3.4.3",
|
|
37
37
|
"source-map": "0.7.3",
|
|
38
38
|
"open": "^8.4.2"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"ast-types": "0.16.1",
|
|
42
42
|
"react": "19.2.3",
|
|
43
43
|
"@types/semver": "^7.3.4",
|
|
44
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
44
|
+
"@remotion/eslint-config-internal": "4.0.458",
|
|
45
45
|
"eslint": "9.19.0",
|
|
46
46
|
"@types/node": "20.12.14",
|
|
47
47
|
"@typescript/native-preview": "7.0.0-dev.20260217.1"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.suppressHmrForFile = suppressHmrForFile;
|
|
4
|
-
exports.shouldSuppressHmr = shouldSuppressHmr;
|
|
5
|
-
const suppressedFiles = new Set();
|
|
6
|
-
function suppressHmrForFile(absolutePath) {
|
|
7
|
-
suppressedFiles.add(absolutePath);
|
|
8
|
-
}
|
|
9
|
-
function shouldSuppressHmr(filename) {
|
|
10
|
-
if (filename === null) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
if (suppressedFiles.has(filename)) {
|
|
14
|
-
suppressedFiles.delete(filename);
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|