@remotion/studio-server 4.0.466 → 4.0.467

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.
@@ -1,5 +1,5 @@
1
1
  import type { ArrayExpression, CallExpression, JSXAttribute } from '@babel/types';
2
- import type { SequenceNodePath } from 'remotion';
2
+ import type { SequenceNodePath, SequenceSchema } from 'remotion';
3
3
  export type EffectPropUpdate = {
4
4
  key: string;
5
5
  value: unknown;
@@ -11,6 +11,11 @@ export type UpdateEffectPropsResult = {
11
11
  oldValueString: string;
12
12
  logLine: number;
13
13
  effectCallee: string;
14
+ removedProps: PropDelta[];
15
+ };
16
+ export type PropDelta = {
17
+ key: string;
18
+ valueString: string;
14
19
  };
15
20
  export declare const findEffectsAttr: (attrs: readonly unknown[]) => JSXAttribute | null;
16
21
  export type EffectArrayElement = {
@@ -33,21 +38,24 @@ export declare const findEffectCallExpression: ({ attr, effectIndex, }: {
33
38
  kind: "error";
34
39
  reason: "not-call-expression" | "not-found";
35
40
  };
36
- export declare const updateEffectPropsAst: ({ input, sequenceNodePath, effectIndex, update, }: {
41
+ export declare const updateEffectPropsAst: ({ input, sequenceNodePath, effectIndex, update, schema, }: {
37
42
  input: string;
38
43
  sequenceNodePath: SequenceNodePath;
39
44
  effectIndex: number;
40
45
  update: EffectPropUpdate;
46
+ schema: SequenceSchema;
41
47
  }) => {
42
48
  serialized: string;
43
49
  oldValueString: string;
44
50
  logLine: number;
45
51
  effectCallee: string;
52
+ removedProps: PropDelta[];
46
53
  };
47
- export declare const updateEffectProps: ({ input, sequenceNodePath, effectIndex, update, prettierConfigOverride, }: {
54
+ export declare const updateEffectProps: ({ input, sequenceNodePath, effectIndex, update, schema, prettierConfigOverride, }: {
48
55
  input: string;
49
56
  sequenceNodePath: SequenceNodePath;
50
57
  effectIndex: number;
51
58
  update: EffectPropUpdate;
59
+ schema: SequenceSchema;
52
60
  prettierConfigOverride?: Record<string, unknown> | null | undefined;
53
61
  }) => Promise<UpdateEffectPropsResult>;
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.updateEffectProps = exports.updateEffectPropsAst = exports.findEffectCallExpression = exports.enumerateEffectArrayElements = exports.findEffectsAttr = void 0;
37
37
  const studio_shared_1 = require("@remotion/studio-shared");
38
38
  const recast = __importStar(require("recast"));
39
+ const no_react_1 = require("remotion/no-react");
39
40
  const can_update_sequence_props_1 = require("../../preview-server/routes/can-update-sequence-props");
40
41
  const format_file_content_1 = require("../format-file-content");
41
42
  const parse_ast_1 = require("../parse-ast");
@@ -132,7 +133,24 @@ const findObjectProperty = (objExpr, propertyName) => {
132
133
  : undefined,
133
134
  };
134
135
  };
135
- const updateEffectPropsAst = ({ input, sequenceNodePath, effectIndex, update, }) => {
136
+ const printObjectPropertyValue = (prop) => recast
137
+ .print(prop.value)
138
+ .code.replace(/[\n\r\t]+/g, ' ')
139
+ .replace(/,(\s*[}\]])/g, '$1')
140
+ .trim();
141
+ const removeObjectProperty = ({ objExpr, propertyName, }) => {
142
+ const { propIndex, prop } = findObjectProperty(objExpr, propertyName);
143
+ if (!prop || propIndex === -1) {
144
+ return null;
145
+ }
146
+ const valueString = printObjectPropertyValue(prop);
147
+ objExpr.properties.splice(propIndex, 1);
148
+ return {
149
+ key: propertyName,
150
+ valueString,
151
+ };
152
+ };
153
+ const updateEffectPropsAst = ({ input, sequenceNodePath, effectIndex, update, schema, }) => {
136
154
  var _a, _b, _c, _d;
137
155
  var _e, _f, _g, _h, _j;
138
156
  const ast = (0, parse_ast_1.parseAst)(input);
@@ -162,6 +180,7 @@ const updateEffectPropsAst = ({ input, sequenceNodePath, effectIndex, update, })
162
180
  oldValueString: '',
163
181
  logLine: (_g = (_f = (_a = call.loc) === null || _a === void 0 ? void 0 : _a.start.line) !== null && _f !== void 0 ? _f : (_b = jsx.loc) === null || _b === void 0 ? void 0 : _b.start.line) !== null && _g !== void 0 ? _g : 1,
164
182
  effectCallee,
183
+ removedProps: [],
165
184
  };
166
185
  }
167
186
  objExpr = b.objectExpression([]);
@@ -174,6 +193,7 @@ const updateEffectPropsAst = ({ input, sequenceNodePath, effectIndex, update, })
174
193
  objExpr = call.arguments[0];
175
194
  }
176
195
  const { prop } = findObjectProperty(objExpr, update.key);
196
+ const removedProps = [];
177
197
  let oldValueString = '';
178
198
  if (prop) {
179
199
  oldValueString = recast.print(prop.value).code;
@@ -198,21 +218,40 @@ const updateEffectPropsAst = ({ input, sequenceNodePath, effectIndex, update, })
198
218
  objExpr.properties.push(b.objectProperty(b.identifier(update.key), newValueExpr));
199
219
  }
200
220
  }
221
+ const fieldSchema = schema[update.key];
222
+ if (fieldSchema && fieldSchema.type === 'enum') {
223
+ const propsToDelete = no_react_1.NoReactInternals.findPropsToDelete({
224
+ schema,
225
+ key: update.key,
226
+ value: update.value,
227
+ });
228
+ for (const propToDelete of propsToDelete) {
229
+ const removed = removeObjectProperty({
230
+ objExpr,
231
+ propertyName: propToDelete,
232
+ });
233
+ if (removed) {
234
+ removedProps.push(removed);
235
+ }
236
+ }
237
+ }
201
238
  const logLine = (_j = (_h = (_c = call.loc) === null || _c === void 0 ? void 0 : _c.start.line) !== null && _h !== void 0 ? _h : (_d = jsx.loc) === null || _d === void 0 ? void 0 : _d.start.line) !== null && _j !== void 0 ? _j : 1;
202
239
  return {
203
240
  serialized: (0, parse_ast_1.serializeAst)(ast),
204
241
  oldValueString,
205
242
  logLine,
206
243
  effectCallee,
244
+ removedProps,
207
245
  };
208
246
  };
209
247
  exports.updateEffectPropsAst = updateEffectPropsAst;
210
- const updateEffectProps = async ({ input, sequenceNodePath, effectIndex, update, prettierConfigOverride, }) => {
211
- const { serialized, oldValueString, logLine, effectCallee } = (0, exports.updateEffectPropsAst)({
248
+ const updateEffectProps = async ({ input, sequenceNodePath, effectIndex, update, schema, prettierConfigOverride, }) => {
249
+ const { serialized, oldValueString, logLine, effectCallee, removedProps } = (0, exports.updateEffectPropsAst)({
212
250
  input,
213
251
  sequenceNodePath,
214
252
  effectIndex,
215
253
  update,
254
+ schema,
216
255
  });
217
256
  const { output, formatted } = await (0, format_file_content_1.formatFileContent)({
218
257
  input: serialized,
@@ -224,6 +263,7 @@ const updateEffectProps = async ({ input, sequenceNodePath, effectIndex, update,
224
263
  formatted,
225
264
  logLine,
226
265
  effectCallee,
266
+ removedProps,
227
267
  };
228
268
  };
229
269
  exports.updateEffectProps = updateEffectProps;
@@ -28,7 +28,7 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
28
28
  }
29
29
  const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
30
30
  const parsedDefault = defaultValue !== null ? JSON.parse(defaultValue) : null;
31
- const { output, oldValueString, formatted, logLine, effectCallee } = await (0, update_effect_props_1.updateEffectProps)({
31
+ const { output, oldValueString, formatted, logLine, effectCallee, removedProps, } = await (0, update_effect_props_1.updateEffectProps)({
32
32
  input: fileContents,
33
33
  sequenceNodePath: sequenceNodePath.nodePath,
34
34
  effectIndex,
@@ -37,11 +37,16 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
37
37
  value: JSON.parse(value),
38
38
  defaultValue: parsedDefault,
39
39
  },
40
+ schema,
40
41
  });
41
42
  const defaultValueString = parsedDefault !== null ? JSON.stringify(parsedDefault) : null;
42
43
  const normalizedOld = (0, log_update_1.normalizeQuotes)(oldValueString);
43
44
  const normalizedNew = (0, log_update_1.normalizeQuotes)(value);
44
45
  const normalizedDefault = defaultValueString !== null ? (0, log_update_1.normalizeQuotes)(defaultValueString) : null;
46
+ const normalizedRemovedProps = removedProps.map((prop) => ({
47
+ ...prop,
48
+ valueString: (0, log_update_1.normalizeQuotes)(prop.valueString),
49
+ }));
45
50
  const undoPropChange = (0, format_effect_prop_change_1.formatEffectPropChange)({
46
51
  effectName: effectCallee,
47
52
  key,
@@ -49,7 +54,7 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
49
54
  newValueString: normalizedOld,
50
55
  defaultValueString: normalizedDefault,
51
56
  removedProps: [],
52
- addedProps: [],
57
+ addedProps: normalizedRemovedProps,
53
58
  });
54
59
  const redoPropChange = (0, format_effect_prop_change_1.formatEffectPropChange)({
55
60
  effectName: effectCallee,
@@ -57,7 +62,7 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
57
62
  oldValueString: normalizedOld,
58
63
  newValueString: normalizedNew,
59
64
  defaultValueString: normalizedDefault,
60
- removedProps: [],
65
+ removedProps: normalizedRemovedProps,
61
66
  addedProps: [],
62
67
  });
63
68
  (0, undo_stack_1.pushToUndoStack)({
@@ -86,7 +91,7 @@ const saveEffectPropsHandler = ({ input: { fileName, sequenceNodePath, effectInd
86
91
  defaultValueString,
87
92
  formatted,
88
93
  logLevel,
89
- removedProps: [],
94
+ removedProps,
90
95
  addedProps: [],
91
96
  });
92
97
  (0, undo_stack_1.printUndoHint)(logLevel);
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.466",
6
+ "version": "4.0.467",
7
7
  "description": "Run a Remotion Studio with a server backend",
8
8
  "main": "dist",
9
9
  "scripts": {
@@ -27,11 +27,11 @@
27
27
  "@babel/parser": "7.24.1",
28
28
  "semver": "7.5.3",
29
29
  "prettier": "3.8.1",
30
- "remotion": "4.0.466",
30
+ "remotion": "4.0.467",
31
31
  "recast": "0.23.11",
32
- "@remotion/bundler": "4.0.466",
33
- "@remotion/renderer": "4.0.466",
34
- "@remotion/studio-shared": "4.0.466",
32
+ "@remotion/bundler": "4.0.467",
33
+ "@remotion/renderer": "4.0.467",
34
+ "@remotion/studio-shared": "4.0.467",
35
35
  "memfs": "3.4.3",
36
36
  "open": "8.4.2"
37
37
  },
@@ -39,7 +39,7 @@
39
39
  "ast-types": "0.16.1",
40
40
  "react": "19.2.3",
41
41
  "@types/semver": "7.5.3",
42
- "@remotion/eslint-config-internal": "4.0.466",
42
+ "@remotion/eslint-config-internal": "4.0.467",
43
43
  "eslint": "9.19.0",
44
44
  "@types/node": "20.12.14",
45
45
  "@typescript/native-preview": "7.0.0-dev.20260217.1"