@remotion/studio-server 4.0.460 → 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.
Files changed (32) hide show
  1. package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +35 -0
  2. package/dist/codemods/update-sequence-props/update-sequence-props.js +224 -0
  3. package/dist/codemods/update-sequence-props.d.ts +6 -0
  4. package/dist/codemods/update-sequence-props.js +37 -3
  5. package/dist/index.d.ts +1 -2
  6. package/dist/preview-server/routes/apply-visual-control-change.js +4 -4
  7. package/dist/preview-server/routes/can-update-sequence-props.d.ts +6 -4
  8. package/dist/preview-server/routes/can-update-sequence-props.js +20 -24
  9. package/dist/preview-server/routes/delete-jsx-node.js +4 -4
  10. package/dist/preview-server/routes/duplicate-jsx-node.js +4 -4
  11. package/dist/preview-server/routes/log-update.d.ts +13 -2
  12. package/dist/preview-server/routes/log-update.js +40 -31
  13. package/dist/preview-server/routes/log-updates/format-prop-change.d.ts +9 -0
  14. package/dist/preview-server/routes/log-updates/format-prop-change.js +29 -0
  15. package/dist/preview-server/routes/log-updates/format-side-props.d.ts +5 -0
  16. package/dist/preview-server/routes/log-updates/format-side-props.js +18 -0
  17. package/dist/preview-server/routes/log-updates/formatting.d.ts +19 -0
  18. package/dist/preview-server/routes/log-updates/formatting.js +67 -0
  19. package/dist/preview-server/routes/log-updates/log-update.d.ts +15 -0
  20. package/dist/preview-server/routes/log-updates/log-update.js +39 -0
  21. package/dist/preview-server/routes/save-sequence-props.d.ts +3 -2
  22. package/dist/preview-server/routes/save-sequence-props.js +80 -85
  23. package/dist/preview-server/routes/update-default-props.js +4 -4
  24. package/dist/preview-server/sequence-props-watchers.d.ts +3 -2
  25. package/dist/preview-server/sequence-props-watchers.js +4 -3
  26. package/dist/preview-server/start-server.d.ts +0 -1
  27. package/dist/preview-server/start-server.js +0 -1
  28. package/dist/preview-server/undo-stack.js +1 -1
  29. package/dist/routes.js +0 -14
  30. package/dist/start-studio.d.ts +1 -2
  31. package/dist/start-studio.js +1 -2
  32. package/package.json +8 -9
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logUpdate = exports.formatPropChange = exports.normalizeQuotes = exports.warnAboutPrettierOnce = void 0;
3
+ exports.logUpdate = exports.formatPropChange = exports.strikeThrough = exports.bg = exports.fg = exports.normalizeQuotes = exports.warnAboutPrettierOnce = void 0;
4
4
  const renderer_1 = require("@remotion/renderer");
5
5
  let warnedAboutPrettier = false;
6
6
  const warnAboutPrettierOnce = (logLevel) => {
@@ -22,13 +22,19 @@ const normalizeQuotes = (str) => {
22
22
  exports.normalizeQuotes = normalizeQuotes;
23
23
  // 24-bit ANSI helpers
24
24
  const fg = (r, g, b, str) => `\u001b[38;2;${r};${g};${b}m${str}\u001b[39m`;
25
+ exports.fg = fg;
25
26
  const bg = (r, g, b, str) => `\u001b[48;2;${r};${g};${b}m${str}\u001b[49m`;
27
+ exports.bg = bg;
28
+ // eslint-disable-next-line no-control-regex
29
+ const stripAnsi = (str) => str.replace(/\u001b\[[0-9;]*m/g, '');
30
+ const strikeThrough = (str) => `\u001b[9m\u001b[38;2;255;85;85m${stripAnsi(str)}\u001b[39m\u001b[29m`;
31
+ exports.strikeThrough = strikeThrough;
26
32
  // Monokai-inspired syntax colors
27
- const attrName = (str) => fg(166, 226, 46, str);
28
- const equals = (str) => fg(249, 38, 114, str);
29
- const punctuation = (str) => fg(248, 248, 242, str);
30
- const stringValue = (str) => fg(230, 219, 116, str);
31
- const numberValue = (str) => fg(174, 129, 255, str);
33
+ const attrName = (str) => (0, exports.fg)(166, 226, 46, str);
34
+ const equals = (str) => (0, exports.fg)(249, 38, 114, str);
35
+ const punctuation = (str) => (0, exports.fg)(248, 248, 242, str);
36
+ const stringValue = (str) => (0, exports.fg)(230, 219, 116, str);
37
+ const numberValue = (str) => (0, exports.fg)(174, 129, 255, str);
32
38
  const colorValue = (str) => {
33
39
  if ((str.startsWith("'") && str.endsWith("'")) ||
34
40
  (str.startsWith('"') && str.endsWith('"'))) {
@@ -39,9 +45,6 @@ const colorValue = (str) => {
39
45
  }
40
46
  return punctuation(str);
41
47
  };
42
- // Subtle background tints
43
- const removedBg = (str) => bg(80, 20, 20, str);
44
- const addedBg = (str) => bg(30, 80, 30, str);
45
48
  const colorEnabled = () => renderer_1.RenderInternals.chalk.enabled();
46
49
  // Format key={value} with Monokai syntax highlighting
47
50
  const formatSimpleProp = (key, value) => {
@@ -51,46 +54,52 @@ const formatSimpleProp = (key, value) => {
51
54
  const formatNestedProp = (parentKey, childKey, value) => {
52
55
  return `${attrName(parentKey)}${equals('=')}${punctuation('{{')}${punctuation(childKey)}${punctuation(':')} ${colorValue(value)}${punctuation('}}')}`;
53
56
  };
54
- const formatPropChange = ({ key, oldValueString, newValueString, defaultValueString, }) => {
57
+ const formatSideProps = ({ removedProps, addedProps, }) => {
58
+ const parts = [];
59
+ for (const { valueString } of removedProps) {
60
+ parts.push(colorEnabled() ? (0, exports.strikeThrough)(valueString) : valueString);
61
+ }
62
+ for (const { valueString } of addedProps) {
63
+ parts.push(valueString);
64
+ }
65
+ if (parts.length === 0) {
66
+ return '';
67
+ }
68
+ return `, ${parts.join(', ')}`;
69
+ };
70
+ const formatPropChange = ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }) => {
71
+ const suffix = formatSideProps({ removedProps, addedProps });
55
72
  if (!colorEnabled()) {
56
73
  const dotIdx = key.indexOf('.');
57
74
  if (dotIdx === -1) {
58
- return `${key}={${oldValueString}} \u2192 ${key}={${newValueString}}`;
75
+ return `${key}={${oldValueString}} \u2192 ${key}={${newValueString}}${suffix}`;
59
76
  }
60
77
  const parent = key.slice(0, dotIdx);
61
78
  const child = key.slice(dotIdx + 1);
62
- return `${parent}={{${child}: ${oldValueString}}} \u2192 ${parent}={{${child}: ${newValueString}}}`;
79
+ return `${parent}={{${child}: ${oldValueString}}} \u2192 ${parent}={{${child}: ${newValueString}}}${suffix}`;
63
80
  }
64
- const isResetToDefault = defaultValueString !== null && newValueString === defaultValueString;
65
- const isChangeFromDefault = defaultValueString !== null && oldValueString === defaultValueString;
66
81
  const dotIndex = key.indexOf('.');
67
- if (dotIndex === -1) {
68
- if (isResetToDefault) {
69
- return removedBg(formatSimpleProp(key, oldValueString));
70
- }
71
- if (isChangeFromDefault) {
72
- return addedBg(formatSimpleProp(key, newValueString));
73
- }
74
- return `${removedBg(formatSimpleProp(key, oldValueString))} \u2192 ${addedBg(formatSimpleProp(key, newValueString))}`;
75
- }
76
- const parentKey = key.slice(0, dotIndex);
77
- const childKey = key.slice(dotIndex + 1);
78
- if (isResetToDefault) {
79
- return removedBg(formatNestedProp(parentKey, childKey, oldValueString));
82
+ const formatProp = (value) => dotIndex === -1
83
+ ? formatSimpleProp(key, value)
84
+ : formatNestedProp(key.slice(0, dotIndex), key.slice(dotIndex + 1), value);
85
+ if (defaultValueString !== null && newValueString === defaultValueString) {
86
+ return `${(0, exports.strikeThrough)(formatProp(oldValueString))}${suffix}`;
80
87
  }
81
- if (isChangeFromDefault) {
82
- return addedBg(formatNestedProp(parentKey, childKey, newValueString));
88
+ if (defaultValueString !== null && oldValueString === defaultValueString) {
89
+ return `${formatProp(newValueString)}${suffix}`;
83
90
  }
84
- return `${removedBg(formatNestedProp(parentKey, childKey, oldValueString))} \u2192 ${addedBg(formatNestedProp(parentKey, childKey, newValueString))}`;
91
+ return `${formatProp(oldValueString)} \u2192 ${formatProp(newValueString)}${suffix}`;
85
92
  };
86
93
  exports.formatPropChange = formatPropChange;
87
- const logUpdate = ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, }) => {
94
+ const logUpdate = ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }) => {
88
95
  const locationLabel = `${fileRelativeToRoot}:${line}`;
89
96
  const propChange = (0, exports.formatPropChange)({
90
97
  key,
91
98
  oldValueString: (0, exports.normalizeQuotes)(oldValueString),
92
99
  newValueString: (0, exports.normalizeQuotes)(newValueString),
93
100
  defaultValueString: defaultValueString !== null ? (0, exports.normalizeQuotes)(defaultValueString) : null,
101
+ removedProps,
102
+ addedProps,
94
103
  });
95
104
  renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}:`)} ${propChange}`);
96
105
  if (!formatted) {
@@ -0,0 +1,9 @@
1
+ import { type PropDelta } from './formatting';
2
+ export declare const formatPropChange: ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }: {
3
+ key: string;
4
+ oldValueString: string;
5
+ newValueString: string;
6
+ defaultValueString: string | null;
7
+ removedProps: PropDelta[];
8
+ addedProps: PropDelta[];
9
+ }) => string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatPropChange = void 0;
4
+ const format_side_props_1 = require("./format-side-props");
5
+ const formatting_1 = require("./formatting");
6
+ const formatInnerPropChange = ({ key, oldValueString, newValueString, defaultValueString, }) => {
7
+ if (defaultValueString !== null && newValueString === defaultValueString) {
8
+ return (0, formatting_1.formatDeletion)({ valueString: oldValueString, key });
9
+ }
10
+ if (defaultValueString !== null && oldValueString === defaultValueString) {
11
+ return (0, formatting_1.formatAddition)({ valueString: newValueString, key });
12
+ }
13
+ return `${(0, formatting_1.formatPropDelta)({ valueString: oldValueString, key })} \u2192 ${(0, formatting_1.formatPropDelta)({ valueString: newValueString, key })}`;
14
+ };
15
+ const formatPropChange = ({ key, oldValueString, newValueString, defaultValueString, removedProps, addedProps, }) => {
16
+ const suffix = (0, format_side_props_1.formatSideProps)({ removedProps, addedProps });
17
+ return [
18
+ formatInnerPropChange({
19
+ key,
20
+ oldValueString,
21
+ newValueString,
22
+ defaultValueString,
23
+ }),
24
+ suffix,
25
+ ]
26
+ .filter(Boolean)
27
+ .join(', ');
28
+ };
29
+ exports.formatPropChange = formatPropChange;
@@ -0,0 +1,5 @@
1
+ import { type PropDelta } from './formatting';
2
+ export declare const formatSideProps: ({ removedProps, addedProps, }: {
3
+ removedProps: PropDelta[];
4
+ addedProps: PropDelta[];
5
+ }) => string | null;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSideProps = void 0;
4
+ const formatting_1 = require("./formatting");
5
+ const formatSideProps = ({ removedProps, addedProps, }) => {
6
+ const parts = [];
7
+ for (const prop of removedProps) {
8
+ parts.push((0, formatting_1.formatDeletion)(prop));
9
+ }
10
+ for (const prop of addedProps) {
11
+ parts.push((0, formatting_1.formatAddition)(prop));
12
+ }
13
+ if (parts.length === 0) {
14
+ return null;
15
+ }
16
+ return parts.join(', ');
17
+ };
18
+ exports.formatSideProps = formatSideProps;
@@ -0,0 +1,19 @@
1
+ export declare const colorEnabled: () => boolean;
2
+ export declare const colorValue: (str: string) => string;
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 attrName: (str: string) => string;
6
+ export declare const equals: (str: string) => string;
7
+ export declare const punctuation: (str: string) => string;
8
+ export declare const stringValue: (str: string) => string;
9
+ export declare const numberValue: (str: string) => string;
10
+ export declare const strikeThrough: (str: string) => string;
11
+ export declare const strikeThroughOrRemovedPrefix: (str: string) => string;
12
+ export declare const addedPrefixIfNoColor: (str: string) => string;
13
+ export type PropDelta = {
14
+ key: string;
15
+ valueString: string;
16
+ };
17
+ export declare const formatPropDelta: ({ key, valueString }: PropDelta) => string;
18
+ export declare const formatDeletion: (prop: PropDelta) => string;
19
+ export declare const formatAddition: (prop: PropDelta) => string;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatAddition = exports.formatDeletion = exports.formatPropDelta = exports.addedPrefixIfNoColor = exports.strikeThroughOrRemovedPrefix = exports.strikeThrough = exports.numberValue = exports.stringValue = exports.punctuation = exports.equals = exports.attrName = exports.bg = exports.fg = exports.colorValue = exports.colorEnabled = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const colorEnabled = () => renderer_1.RenderInternals.chalk.enabled();
6
+ exports.colorEnabled = colorEnabled;
7
+ const colorValue = (str) => {
8
+ if ((str.startsWith("'") && str.endsWith("'")) ||
9
+ (str.startsWith('"') && str.endsWith('"'))) {
10
+ return (0, exports.stringValue)(str);
11
+ }
12
+ if (/^-?\d+(\.\d+)?$/.test(str)) {
13
+ return (0, exports.numberValue)(str);
14
+ }
15
+ return (0, exports.punctuation)(str);
16
+ };
17
+ exports.colorValue = colorValue;
18
+ // eslint-disable-next-line no-control-regex
19
+ const stripAnsi = (str) => str.replace(/\u001b\[[0-9;]*m/g, '');
20
+ // 24-bit ANSI helpers
21
+ const fg = (r, g, b, str) => (0, exports.colorEnabled)() ? `\u001b[38;2;${r};${g};${b}m${str}\u001b[39m` : str;
22
+ exports.fg = fg;
23
+ const bg = (r, g, b, str) => (0, exports.colorEnabled)() ? `\u001b[48;2;${r};${g};${b}m${str}\u001b[49m` : str;
24
+ exports.bg = bg;
25
+ // Monokai-inspired syntax colors
26
+ const attrName = (str) => (0, exports.fg)(166, 226, 46, str);
27
+ exports.attrName = attrName;
28
+ const equals = (str) => (0, exports.fg)(249, 38, 114, str);
29
+ exports.equals = equals;
30
+ const punctuation = (str) => (0, exports.fg)(248, 248, 242, str);
31
+ exports.punctuation = punctuation;
32
+ const stringValue = (str) => (0, exports.fg)(230, 219, 116, str);
33
+ exports.stringValue = stringValue;
34
+ const numberValue = (str) => (0, exports.fg)(174, 129, 255, str);
35
+ exports.numberValue = numberValue;
36
+ const strikeThrough = (str) => `\u001b[9m\u001b[38;2;255;85;85m${stripAnsi(str)}\u001b[39m\u001b[29m`;
37
+ exports.strikeThrough = strikeThrough;
38
+ const strikeThroughOrRemovedPrefix = (str) => (0, exports.colorEnabled)() ? (0, exports.strikeThrough)(str) : 'removed: ' + str;
39
+ exports.strikeThroughOrRemovedPrefix = strikeThroughOrRemovedPrefix;
40
+ const addedPrefixIfNoColor = (str) => (0, exports.colorEnabled)() ? str : 'added: ' + stripAnsi(str);
41
+ exports.addedPrefixIfNoColor = addedPrefixIfNoColor;
42
+ // Format key={value} with Monokai syntax highlighting
43
+ const formatSimpleProp = (key, value) => {
44
+ return `${(0, exports.attrName)(key)}${(0, exports.equals)('=')}${(0, exports.punctuation)('{')}${(0, exports.colorValue)(value)}${(0, exports.punctuation)('}')}`;
45
+ };
46
+ // Format parentKey={{childKey: value}} with Monokai syntax highlighting
47
+ const formatNestedProp = (parentKey, childKey, value) => {
48
+ return `${(0, exports.attrName)(parentKey)}${(0, exports.equals)('=')}${(0, exports.punctuation)('{{')}${(0, exports.punctuation)(childKey)}${(0, exports.punctuation)(':')} ${(0, exports.colorValue)(value)}${(0, exports.punctuation)('}}')}`;
49
+ };
50
+ const formatPropDelta = ({ key, valueString }) => {
51
+ const dotIdx = key.indexOf('.');
52
+ if (dotIdx === -1) {
53
+ return formatSimpleProp(key, valueString);
54
+ }
55
+ return formatNestedProp(key.slice(0, dotIdx), key.slice(dotIdx + 1), valueString);
56
+ };
57
+ exports.formatPropDelta = formatPropDelta;
58
+ const formatDeletion = (prop) => {
59
+ const formatted = (0, exports.formatPropDelta)(prop);
60
+ return (0, exports.strikeThroughOrRemovedPrefix)(formatted);
61
+ };
62
+ exports.formatDeletion = formatDeletion;
63
+ const formatAddition = (prop) => {
64
+ const formatted = (0, exports.formatPropDelta)(prop);
65
+ return (0, exports.addedPrefixIfNoColor)(formatted);
66
+ };
67
+ exports.formatAddition = formatAddition;
@@ -0,0 +1,15 @@
1
+ import type { PropDelta } from './formatting';
2
+ export declare const warnAboutPrettierOnce: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => void;
3
+ export declare const normalizeQuotes: (str: string) => string;
4
+ export declare const logUpdate: ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }: {
5
+ fileRelativeToRoot: string;
6
+ line: number;
7
+ key: string;
8
+ oldValueString: string;
9
+ newValueString: string;
10
+ defaultValueString: string | null;
11
+ formatted: boolean;
12
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
13
+ removedProps: PropDelta[];
14
+ addedProps: PropDelta[];
15
+ }) => void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logUpdate = exports.normalizeQuotes = exports.warnAboutPrettierOnce = void 0;
4
+ const renderer_1 = require("@remotion/renderer");
5
+ const format_prop_change_1 = require("./format-prop-change");
6
+ let warnedAboutPrettier = false;
7
+ const warnAboutPrettierOnce = (logLevel) => {
8
+ if (warnedAboutPrettier) {
9
+ return;
10
+ }
11
+ warnedAboutPrettier = true;
12
+ renderer_1.RenderInternals.Log.warn({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.yellow('Could not format with Prettier. File will need to be formatted manually.'));
13
+ };
14
+ exports.warnAboutPrettierOnce = warnAboutPrettierOnce;
15
+ const normalizeQuotes = (str) => {
16
+ if (str.length >= 2 &&
17
+ ((str.startsWith("'") && str.endsWith("'")) ||
18
+ (str.startsWith('"') && str.endsWith('"')))) {
19
+ return `'${str.slice(1, -1)}'`;
20
+ }
21
+ return str;
22
+ };
23
+ exports.normalizeQuotes = normalizeQuotes;
24
+ const logUpdate = ({ fileRelativeToRoot, line, key, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }) => {
25
+ const locationLabel = `${fileRelativeToRoot}:${line}`;
26
+ const propChange = (0, format_prop_change_1.formatPropChange)({
27
+ key,
28
+ oldValueString: (0, exports.normalizeQuotes)(oldValueString),
29
+ newValueString: (0, exports.normalizeQuotes)(newValueString),
30
+ defaultValueString: defaultValueString !== null ? (0, exports.normalizeQuotes)(defaultValueString) : null,
31
+ removedProps,
32
+ addedProps,
33
+ });
34
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${propChange}`);
35
+ if (!formatted) {
36
+ (0, exports.warnAboutPrettierOnce)(logLevel);
37
+ }
38
+ };
39
+ exports.logUpdate = logUpdate;
@@ -1,3 +1,4 @@
1
- import type { SaveSequencePropsRequest, SaveSequencePropsResponse } from '@remotion/studio-shared';
1
+ import type { SaveSequencePropsRequest } from '@remotion/studio-shared';
2
+ import type { CanUpdateSequencePropsResponse } from 'remotion';
2
3
  import type { ApiHandler } from '../api-types';
3
- export declare const saveSequencePropsHandler: ApiHandler<SaveSequencePropsRequest, SaveSequencePropsResponse>;
4
+ export declare const saveSequencePropsHandler: ApiHandler<SaveSequencePropsRequest, CanUpdateSequencePropsResponse>;
@@ -9,96 +9,91 @@ const node_path_1 = __importDefault(require("node:path"));
9
9
  const renderer_1 = require("@remotion/renderer");
10
10
  const remotion_1 = require("remotion");
11
11
  const get_all_schema_keys_1 = require("../../codemods/get-all-schema-keys");
12
- const update_sequence_props_1 = require("../../codemods/update-sequence-props");
12
+ const update_sequence_props_1 = require("../../codemods/update-sequence-props/update-sequence-props");
13
13
  const file_watcher_1 = require("../../file-watcher");
14
14
  const undo_stack_1 = require("../undo-stack");
15
15
  const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
16
16
  const can_update_sequence_props_1 = require("./can-update-sequence-props");
17
- const log_update_1 = require("./log-update");
17
+ const format_prop_change_1 = require("./log-updates/format-prop-change");
18
+ const log_update_1 = require("./log-updates/log-update");
18
19
  const saveSequencePropsHandler = async ({ input: { fileName, nodePath, key, value, defaultValue, schema }, remotionRoot, logLevel, }) => {
19
- try {
20
- renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[save-sequence-props] Received request for fileName="${fileName}" key="${key}"`);
21
- const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
22
- const fileRelativeToRoot = node_path_1.default.relative(remotionRoot, absolutePath);
23
- if (fileRelativeToRoot.startsWith('..')) {
24
- throw new Error('Cannot modify a file outside the project');
25
- }
26
- const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
27
- const { output, oldValueStrings, formatted, logLine } = await (0, update_sequence_props_1.updateSequenceProps)({
28
- input: fileContents,
29
- nodePath,
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,
38
- });
39
- const oldValueString = oldValueStrings[0];
40
- const newValueString = JSON.stringify(JSON.parse(value));
41
- const parsedDefault = defaultValue !== null ? JSON.parse(defaultValue) : null;
42
- const defaultValueString = parsedDefault !== null ? JSON.stringify(parsedDefault) : null;
43
- const normalizedOld = (0, log_update_1.normalizeQuotes)(oldValueString);
44
- const normalizedNew = (0, log_update_1.normalizeQuotes)(newValueString);
45
- const normalizedDefault = defaultValueString !== null ? (0, log_update_1.normalizeQuotes)(defaultValueString) : null;
46
- const undoPropChange = (0, log_update_1.formatPropChange)({
47
- key,
48
- oldValueString: normalizedNew,
49
- newValueString: normalizedOld,
50
- defaultValueString: normalizedDefault,
51
- });
52
- const redoPropChange = (0, log_update_1.formatPropChange)({
53
- key,
54
- oldValueString: normalizedOld,
55
- newValueString: normalizedNew,
56
- defaultValueString: normalizedDefault,
57
- });
58
- (0, undo_stack_1.pushToUndoStack)({
59
- filePath: absolutePath,
60
- oldContents: fileContents,
61
- logLevel,
62
- remotionRoot,
63
- logLine,
64
- description: {
65
- undoMessage: `Undo: ${undoPropChange}`,
66
- redoMessage: `Redo: ${redoPropChange}`,
67
- },
68
- entryType: 'sequence-props',
69
- suppressHmrOnFileRestore: true,
70
- });
71
- (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
72
- (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
73
- (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output);
74
- (0, log_update_1.logUpdate)({
75
- fileRelativeToRoot,
76
- line: logLine,
77
- key,
78
- oldValueString,
79
- newValueString,
80
- defaultValueString,
81
- formatted,
82
- logLevel,
83
- });
84
- (0, undo_stack_1.printUndoHint)(logLevel);
85
- const newStatus = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
86
- fileName,
87
- keys: (0, get_all_schema_keys_1.getAllSchemaKeys)(schema),
88
- nodePath,
89
- remotionRoot,
90
- });
91
- return {
92
- success: true,
93
- newStatus,
94
- };
95
- }
96
- catch (err) {
97
- return {
98
- success: false,
99
- reason: err.message,
100
- stack: err.stack,
101
- };
20
+ renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[save-sequence-props] Received request for fileName="${fileName}" key="${key}"`);
21
+ const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
22
+ const fileRelativeToRoot = node_path_1.default.relative(remotionRoot, absolutePath);
23
+ if (fileRelativeToRoot.startsWith('..')) {
24
+ throw new Error('Cannot modify a file outside the project');
102
25
  }
26
+ const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
27
+ const { output, oldValueStrings, formatted, logLine, removedProps } = await (0, update_sequence_props_1.updateSequenceProps)({
28
+ input: fileContents,
29
+ nodePath,
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,
38
+ });
39
+ const oldValueString = oldValueStrings[0];
40
+ const newValueString = JSON.stringify(JSON.parse(value));
41
+ const parsedDefault = defaultValue !== null ? JSON.parse(defaultValue) : null;
42
+ const defaultValueString = parsedDefault !== null ? JSON.stringify(parsedDefault) : null;
43
+ const normalizedOld = (0, log_update_1.normalizeQuotes)(oldValueString);
44
+ const normalizedNew = (0, log_update_1.normalizeQuotes)(newValueString);
45
+ const normalizedDefault = defaultValueString !== null ? (0, log_update_1.normalizeQuotes)(defaultValueString) : null;
46
+ const undoPropChange = (0, format_prop_change_1.formatPropChange)({
47
+ key,
48
+ oldValueString: normalizedNew,
49
+ newValueString: normalizedOld,
50
+ defaultValueString: normalizedDefault,
51
+ removedProps: [],
52
+ addedProps: removedProps,
53
+ });
54
+ const redoPropChange = (0, format_prop_change_1.formatPropChange)({
55
+ key,
56
+ oldValueString: normalizedOld,
57
+ newValueString: normalizedNew,
58
+ defaultValueString: normalizedDefault,
59
+ removedProps,
60
+ addedProps: [],
61
+ });
62
+ (0, undo_stack_1.pushToUndoStack)({
63
+ filePath: absolutePath,
64
+ oldContents: fileContents,
65
+ logLevel,
66
+ remotionRoot,
67
+ logLine,
68
+ description: {
69
+ undoMessage: `↩️ ${undoPropChange}`,
70
+ redoMessage: `↪️ ${redoPropChange}`,
71
+ },
72
+ entryType: 'sequence-props',
73
+ suppressHmrOnFileRestore: true,
74
+ });
75
+ (0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
76
+ (0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
77
+ (0, file_watcher_1.writeFileAndNotifyFileWatchers)(absolutePath, output);
78
+ (0, log_update_1.logUpdate)({
79
+ fileRelativeToRoot,
80
+ line: logLine,
81
+ key,
82
+ oldValueString,
83
+ newValueString,
84
+ defaultValueString,
85
+ formatted,
86
+ logLevel,
87
+ removedProps,
88
+ addedProps: [],
89
+ });
90
+ (0, undo_stack_1.printUndoHint)(logLevel);
91
+ const newStatus = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
92
+ fileName,
93
+ keys: (0, get_all_schema_keys_1.getAllSchemaKeys)(schema),
94
+ nodePath,
95
+ remotionRoot,
96
+ });
97
+ return newStatus;
103
98
  };
104
99
  exports.saveSequencePropsHandler = saveSequencePropsHandler;
@@ -10,7 +10,7 @@ const project_info_1 = require("../project-info");
10
10
  const undo_stack_1 = require("../undo-stack");
11
11
  const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
12
12
  const can_update_default_props_1 = require("./can-update-default-props");
13
- const log_update_1 = require("./log-update");
13
+ const log_update_1 = require("./log-updates/log-update");
14
14
  const updateDefaultPropsHandler = async ({ input: { compositionId, defaultProps, enumPaths }, remotionRoot, entryPoint, logLevel, }) => {
15
15
  try {
16
16
  renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[update-default-props] Received request for compositionId="${compositionId}"`);
@@ -37,8 +37,8 @@ const updateDefaultPropsHandler = async ({ input: { compositionId, defaultProps,
37
37
  remotionRoot,
38
38
  logLine,
39
39
  description: {
40
- undoMessage: `Undo: default props update for "${compositionId}"`,
41
- redoMessage: `Redo: default props update for "${compositionId}"`,
40
+ undoMessage: `↩️ default props update for "${compositionId}"`,
41
+ redoMessage: `↪️ default props update for "${compositionId}"`,
42
42
  },
43
43
  entryType: 'default-props',
44
44
  suppressHmrOnFileRestore: true,
@@ -51,7 +51,7 @@ const updateDefaultPropsHandler = async ({ input: { compositionId, defaultProps,
51
51
  absolutePath: projectInfo.rootFile,
52
52
  line: logLine,
53
53
  });
54
- renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}:`)} Updated default props for "${compositionId}"`);
54
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Updated default props for "${compositionId}"`);
55
55
  if (!formatted) {
56
56
  (0, log_update_1.warnAboutPrettierOnce)(logLevel);
57
57
  }
@@ -1,4 +1,5 @@
1
- import type { CanUpdateSequencePropsResponse, SequenceNodePath } from 'remotion';
1
+ import type { SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
2
+ import type { SequenceNodePath } from 'remotion';
2
3
  export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column, keys, remotionRoot, clientId, }: {
3
4
  fileName: string;
4
5
  line: number;
@@ -6,7 +7,7 @@ export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column
6
7
  keys: string[];
7
8
  remotionRoot: string;
8
9
  clientId: string;
9
- }) => CanUpdateSequencePropsResponse;
10
+ }) => SubscribeToSequencePropsResponse;
10
11
  export declare const unsubscribeFromSequencePropsWatchers: ({ fileName, nodePath, remotionRoot, clientId, }: {
11
12
  fileName: string;
12
13
  nodePath: SequenceNodePath;
@@ -24,15 +24,16 @@ const getSequencePropsStatus = ({ fileName, line, column, keys, remotionRoot, })
24
24
  remotionRoot,
25
25
  });
26
26
  if (cachedResult.canUpdate) {
27
- return cachedResult;
27
+ return { status: cachedResult, nodePath: cachedNodePath, success: true };
28
28
  }
29
29
  }
30
- return (0, can_update_sequence_props_1.computeSequencePropsStatusFromFilenameByLine)({
30
+ const status = (0, can_update_sequence_props_1.computeSequencePropsStatusFromFilenameByLine)({
31
31
  fileName,
32
32
  line,
33
33
  keys,
34
34
  remotionRoot,
35
35
  });
36
+ return status;
36
37
  };
37
38
  const subscribeToSequencePropsWatchers = ({ fileName, line, column, keys, remotionRoot, clientId, }) => {
38
39
  var _a;
@@ -43,7 +44,7 @@ const subscribeToSequencePropsWatchers = ({ fileName, line, column, keys, remoti
43
44
  keys,
44
45
  remotionRoot,
45
46
  });
46
- if (!initialResult.canUpdate) {
47
+ if (!initialResult.success) {
47
48
  return initialResult;
48
49
  }
49
50
  const absolutePath = node_path_1.default.resolve(remotionRoot, fileName);
@@ -23,7 +23,6 @@ export declare const startServer: (options: {
23
23
  remotionRoot: string;
24
24
  keyboardShortcutsEnabled: boolean;
25
25
  experimentalClientSideRenderingEnabled: boolean;
26
- experimentalVisualModeEnabled: boolean;
27
26
  publicDir: string;
28
27
  poll: number | null;
29
28
  staticHash: string;
@@ -42,7 +42,6 @@ const startServer = async (options) => {
42
42
  remotionRoot: options.remotionRoot,
43
43
  keyboardShortcutsEnabled: options.keyboardShortcutsEnabled,
44
44
  experimentalClientSideRenderingEnabled: options.experimentalClientSideRenderingEnabled,
45
- experimentalVisualModeEnabled: options.experimentalVisualModeEnabled,
46
45
  poll: options.poll,
47
46
  bufferStateDelayInMilliseconds: options.bufferStateDelayInMilliseconds,
48
47
  askAIEnabled: options.askAIEnabled,
@@ -175,7 +175,7 @@ function logFileAction(action, filePath, logLine) {
175
175
  line: logLine,
176
176
  })
177
177
  : `${filePath}:${logLine}`;
178
- renderer_1.RenderInternals.Log.info({ indent: false, logLevel: storedLogLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}:`)} ${action}`);
178
+ renderer_1.RenderInternals.Log.info({ indent: false, logLevel: storedLogLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${action}`);
179
179
  }
180
180
  function popUndo() {
181
181
  const entry = undoStack.pop();
package/dist/routes.js CHANGED
@@ -317,17 +317,6 @@ const handleBeep = (_, response) => {
317
317
  readStream.pipe(response);
318
318
  return Promise.resolve();
319
319
  };
320
- const handleWasm = (_, response) => {
321
- const filePath = node_path_1.default.resolve(require.resolve('source-map'), '..', 'lib', 'mappings.wasm');
322
- const stat = (0, node_fs_1.statSync)(filePath);
323
- response.writeHead(200, {
324
- 'Content-Type': 'application/wasm',
325
- 'Content-Length': stat.size,
326
- });
327
- const readStream = (0, node_fs_1.createReadStream)(filePath);
328
- readStream.pipe(response);
329
- return Promise.resolve();
330
- };
331
320
  const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPrefix, request, response, liveEventsServer, getCurrentInputProps, getEnvVariables, remotionRoot, entryPoint, publicDir, logLevel, getRenderQueue, getRenderDefaults, numberOfAudioTags, queueMethods: methods, gitSource, binariesDirectory, audioLatencyHint, enableCrossSiteIsolation, }) => {
332
321
  const url = new URL(request.url, 'http://localhost');
333
322
  if (url.pathname === '/api/file-source') {
@@ -391,9 +380,6 @@ const handleRoutes = ({ staticHash, staticHashPrefix, outputHash, outputHashPref
391
380
  if (url.pathname === '/beep.wav') {
392
381
  return handleBeep(request, response);
393
382
  }
394
- if (url.pathname === studio_shared_1.SOURCE_MAP_ENDPOINT) {
395
- return handleWasm(request, response);
396
- }
397
383
  if (url.pathname === '/__remotion_config') {
398
384
  return handleRemotionConfig(response, remotionRoot);
399
385
  }