@remotion/studio-server 4.0.489 → 4.0.491
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/better-opn/index.d.ts +4 -0
- package/dist/better-opn/index.js +152 -31
- package/dist/codemods/effect-param-expression.js +3 -0
- package/dist/codemods/paste-effects.d.ts +2 -1
- package/dist/codemods/paste-effects.js +33 -6
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +10 -5
- package/dist/codemods/update-keyframes/update-keyframes.js +126 -46
- package/dist/codemods/update-nested-prop.d.ts +3 -2
- package/dist/codemods/update-nested-prop.js +17 -4
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +6 -3
- package/dist/codemods/update-sequence-props/update-sequence-props.js +51 -10
- package/dist/helpers/get-installed-installable-packages.js +4 -12
- package/dist/helpers/resolve-composition-component.js +1 -0
- package/dist/helpers/video-config-numeric-expression.d.ts +12 -0
- package/dist/helpers/video-config-numeric-expression.js +152 -0
- package/dist/helpers/video-config-values.d.ts +7 -0
- package/dist/helpers/video-config-values.js +84 -0
- package/dist/index.d.ts +1 -2
- package/dist/preview-server/element-install-state.d.ts +1 -0
- package/dist/preview-server/routes/add-effect-keyframe.js +6 -0
- package/dist/preview-server/routes/add-keyframes.js +2 -0
- package/dist/preview-server/routes/add-sequence-keyframe.js +2 -0
- package/dist/preview-server/routes/apply-codemod.d.ts +1 -0
- package/dist/preview-server/routes/apply-codemod.js +62 -13
- package/dist/preview-server/routes/can-update-effect-props.d.ts +8 -4
- package/dist/preview-server/routes/can-update-effect-props.js +26 -5
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +9 -5
- package/dist/preview-server/routes/can-update-sequence-props.js +99 -30
- package/dist/preview-server/routes/delete-keyframes.js +8 -0
- package/dist/preview-server/routes/install-dependency.d.ts +1 -0
- package/dist/preview-server/routes/install-dependency.js +17 -15
- package/dist/preview-server/routes/move-keyframes.js +2 -0
- package/dist/preview-server/routes/paste-effects.js +2 -1
- package/dist/preview-server/routes/save-effect-props.js +5 -0
- package/dist/preview-server/routes/save-sequence-props.js +4 -0
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +2 -1
- package/dist/preview-server/routes/unsubscribe-from-sequence-props.js +1 -0
- package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -0
- package/dist/preview-server/routes/update-element-install-target.js +15 -1
- package/dist/preview-server/routes/update-sequence-keyframe-settings.js +3 -0
- package/dist/preview-server/sequence-props-watchers.d.ts +5 -3
- package/dist/preview-server/sequence-props-watchers.js +14 -5
- package/dist/preview-server/start-server.d.ts +0 -1
- package/dist/preview-server/start-server.js +0 -1
- package/dist/routes.js +2 -0
- package/dist/start-studio.d.ts +1 -2
- package/dist/start-studio.js +1 -2
- package/package.json +6 -6
|
@@ -569,6 +569,7 @@ const createSolidElement = ({ localName, width, height, position, }) => {
|
|
|
569
569
|
return recast.types.builders.jsxElement(recast.types.builders.jsxOpeningElement(recast.types.builders.jsxIdentifier(localName), [
|
|
570
570
|
createNumberAttribute('width', width),
|
|
571
571
|
createNumberAttribute('height', height),
|
|
572
|
+
createStringAttribute('color', 'gray'),
|
|
572
573
|
createPositionAbsoluteStyleAttribute(position),
|
|
573
574
|
], true), null, []);
|
|
574
575
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Expression } from '@babel/types';
|
|
2
|
+
import type { ExpressionKind } from 'ast-types/lib/gen/kinds';
|
|
3
|
+
import type { VideoConfigNumericExpression } from 'remotion';
|
|
4
|
+
import type { VideoConfigIdentifierValues } from './video-config-values';
|
|
5
|
+
export declare const parseVideoConfigNumericExpression: ({ node, videoConfigValues, }: {
|
|
6
|
+
node: Expression;
|
|
7
|
+
videoConfigValues: VideoConfigIdentifierValues;
|
|
8
|
+
}) => VideoConfigNumericExpression | null;
|
|
9
|
+
export declare const updateVideoConfigNumericExpression: ({ expression, value, }: {
|
|
10
|
+
expression: VideoConfigNumericExpression;
|
|
11
|
+
value: number;
|
|
12
|
+
}) => ExpressionKind;
|
|
@@ -0,0 +1,152 @@
|
|
|
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.updateVideoConfigNumericExpression = exports.parseVideoConfigNumericExpression = void 0;
|
|
37
|
+
const recast = __importStar(require("recast"));
|
|
38
|
+
const b = recast.types.builders;
|
|
39
|
+
const getNumericLiteral = (node) => {
|
|
40
|
+
if (node.type === 'NumericLiteral') {
|
|
41
|
+
return Number.isFinite(node.value) ? node.value : null;
|
|
42
|
+
}
|
|
43
|
+
if (node.type === 'UnaryExpression' &&
|
|
44
|
+
(node.operator === '-' || node.operator === '+') &&
|
|
45
|
+
node.argument.type === 'NumericLiteral') {
|
|
46
|
+
const value = node.operator === '-' ? -node.argument.value : node.argument.value;
|
|
47
|
+
return Number.isFinite(value) ? value : null;
|
|
48
|
+
}
|
|
49
|
+
if (node.type === 'TSAsExpression') {
|
|
50
|
+
return getNumericLiteral(node.expression);
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
54
|
+
const getVideoConfigValue = ({ node, videoConfigValues, }) => {
|
|
55
|
+
if (node.type === 'TSAsExpression') {
|
|
56
|
+
return getVideoConfigValue({
|
|
57
|
+
node: node.expression,
|
|
58
|
+
videoConfigValues,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (node.type !== 'Identifier') {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const value = videoConfigValues[node.name];
|
|
65
|
+
if (value === undefined || !Number.isFinite(value)) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return { identifier: node.name, value };
|
|
69
|
+
};
|
|
70
|
+
const parseVideoConfigNumericExpression = ({ node, videoConfigValues, }) => {
|
|
71
|
+
if (node.type === 'TSAsExpression') {
|
|
72
|
+
return (0, exports.parseVideoConfigNumericExpression)({
|
|
73
|
+
node: node.expression,
|
|
74
|
+
videoConfigValues,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const literal = getNumericLiteral(node);
|
|
78
|
+
if (literal !== null) {
|
|
79
|
+
return { type: 'literal', value: literal };
|
|
80
|
+
}
|
|
81
|
+
const videoConfigValue = getVideoConfigValue({ node, videoConfigValues });
|
|
82
|
+
if (videoConfigValue !== null) {
|
|
83
|
+
return { type: 'video-config-value', ...videoConfigValue };
|
|
84
|
+
}
|
|
85
|
+
if (node.type !== 'BinaryExpression' || node.operator !== '*') {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
const left = node.left;
|
|
89
|
+
const right = node.right;
|
|
90
|
+
const leftNumber = getNumericLiteral(left);
|
|
91
|
+
const rightNumber = getNumericLiteral(right);
|
|
92
|
+
const leftVideoConfig = getVideoConfigValue({
|
|
93
|
+
node: left,
|
|
94
|
+
videoConfigValues,
|
|
95
|
+
});
|
|
96
|
+
const rightVideoConfig = getVideoConfigValue({
|
|
97
|
+
node: right,
|
|
98
|
+
videoConfigValues,
|
|
99
|
+
});
|
|
100
|
+
const factorPosition = leftNumber !== null && rightVideoConfig !== null
|
|
101
|
+
? 'left'
|
|
102
|
+
: rightNumber !== null && leftVideoConfig !== null
|
|
103
|
+
? 'right'
|
|
104
|
+
: null;
|
|
105
|
+
if (factorPosition === null) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const multiplier = factorPosition === 'left' ? leftNumber : rightNumber;
|
|
109
|
+
const configValue = factorPosition === 'left' ? rightVideoConfig : leftVideoConfig;
|
|
110
|
+
const value = multiplier * configValue.value;
|
|
111
|
+
if (!Number.isFinite(value)) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
type: 'video-config-multiplication',
|
|
116
|
+
identifier: configValue.identifier,
|
|
117
|
+
multiplier,
|
|
118
|
+
multiplicand: configValue.value,
|
|
119
|
+
factorPosition,
|
|
120
|
+
value,
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
exports.parseVideoConfigNumericExpression = parseVideoConfigNumericExpression;
|
|
124
|
+
const numericExpression = (value) => {
|
|
125
|
+
if (value < 0) {
|
|
126
|
+
return b.unaryExpression('-', b.numericLiteral(-value), true);
|
|
127
|
+
}
|
|
128
|
+
return b.numericLiteral(value);
|
|
129
|
+
};
|
|
130
|
+
const updateVideoConfigNumericExpression = ({ expression, value, }) => {
|
|
131
|
+
if (!Number.isFinite(value)) {
|
|
132
|
+
return numericExpression(value);
|
|
133
|
+
}
|
|
134
|
+
if (expression.type === 'video-config-value') {
|
|
135
|
+
return value === expression.value
|
|
136
|
+
? b.identifier(expression.identifier)
|
|
137
|
+
: numericExpression(value);
|
|
138
|
+
}
|
|
139
|
+
if (expression.type !== 'video-config-multiplication' || value === 0) {
|
|
140
|
+
return numericExpression(value);
|
|
141
|
+
}
|
|
142
|
+
const multiplier = value / expression.multiplicand;
|
|
143
|
+
if (!Number.isFinite(multiplier) || multiplier === 0) {
|
|
144
|
+
return numericExpression(value);
|
|
145
|
+
}
|
|
146
|
+
const factor = numericExpression(multiplier);
|
|
147
|
+
const identifier = b.identifier(expression.identifier);
|
|
148
|
+
return expression.factorPosition === 'left'
|
|
149
|
+
? b.binaryExpression('*', factor, identifier)
|
|
150
|
+
: b.binaryExpression('*', identifier, factor);
|
|
151
|
+
};
|
|
152
|
+
exports.updateVideoConfigNumericExpression = updateVideoConfigNumericExpression;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { File } from '@babel/types';
|
|
2
|
+
import type { VideoConfigValues } from 'remotion';
|
|
3
|
+
export type VideoConfigIdentifierValues = Record<string, number>;
|
|
4
|
+
export declare const getVideoConfigIdentifierValues: ({ ast, videoConfigValues, }: {
|
|
5
|
+
ast: File;
|
|
6
|
+
videoConfigValues: VideoConfigValues | null;
|
|
7
|
+
}) => VideoConfigIdentifierValues;
|
|
@@ -0,0 +1,84 @@
|
|
|
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.getVideoConfigIdentifierValues = void 0;
|
|
37
|
+
const recast = __importStar(require("recast"));
|
|
38
|
+
const getVideoConfigIdentifierValues = ({ ast, videoConfigValues, }) => {
|
|
39
|
+
if (videoConfigValues === null) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const candidates = new Map();
|
|
43
|
+
const otherDeclarations = new Set();
|
|
44
|
+
recast.types.visit(ast, {
|
|
45
|
+
visitVariableDeclarator(path) {
|
|
46
|
+
const { id, init } = path.node;
|
|
47
|
+
const isVideoConfigDeclaration = id.type === 'ObjectPattern' &&
|
|
48
|
+
(init === null || init === void 0 ? void 0 : init.type) === 'CallExpression' &&
|
|
49
|
+
init.callee.type === 'Identifier' &&
|
|
50
|
+
init.callee.name === 'useVideoConfig' &&
|
|
51
|
+
init.arguments.length === 0;
|
|
52
|
+
if (isVideoConfigDeclaration) {
|
|
53
|
+
for (const property of id.properties) {
|
|
54
|
+
if (property.type !== 'ObjectProperty' ||
|
|
55
|
+
property.computed ||
|
|
56
|
+
property.value.type !== 'Identifier') {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const configKey = property.key.type === 'Identifier'
|
|
60
|
+
? property.key.name
|
|
61
|
+
: property.key.type === 'StringLiteral'
|
|
62
|
+
? property.key.value
|
|
63
|
+
: null;
|
|
64
|
+
if (configKey === null || !(configKey in videoConfigValues)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const value = videoConfigValues[configKey];
|
|
68
|
+
if (Number.isFinite(value)) {
|
|
69
|
+
candidates.set(property.value.name, value);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else if (id.type === 'Identifier') {
|
|
74
|
+
otherDeclarations.add(id.name);
|
|
75
|
+
}
|
|
76
|
+
this.traverse(path);
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
for (const identifier of otherDeclarations) {
|
|
80
|
+
candidates.delete(identifier);
|
|
81
|
+
}
|
|
82
|
+
return Object.fromEntries(candidates);
|
|
83
|
+
};
|
|
84
|
+
exports.getVideoConfigIdentifierValues = getVideoConfigIdentifierValues;
|
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,
|
|
5
|
+
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, maxTimelineTracks, remotionRoot, keyboardShortcutsEnabled, relativePublicDir, webpackOverride, poll, getRenderDefaults, getRenderQueue, numberOfAudioTags, queueMethods, previewEntry, gitSource, bufferStateDelayInMilliseconds, binariesDirectory, forceIPv4, audioLatencyHint, previewSampleRate, enableCrossSiteIsolation, askAIEnabled, interactivityEnabled, forceNew, rspack, getStudioRuntimeConfig, }: {
|
|
6
6
|
browserArgs: string;
|
|
7
7
|
browserFlag: string;
|
|
8
8
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -15,7 +15,6 @@ export declare const StudioServerInternals: {
|
|
|
15
15
|
bufferStateDelayInMilliseconds: number | null;
|
|
16
16
|
remotionRoot: string;
|
|
17
17
|
keyboardShortcutsEnabled: boolean;
|
|
18
|
-
experimentalClientSideRenderingEnabled: boolean;
|
|
19
18
|
relativePublicDir: string | null;
|
|
20
19
|
webpackOverride: import("@remotion/bundler").WebpackOverrideFn;
|
|
21
20
|
poll: number | null;
|
|
@@ -7,6 +7,7 @@ export type ElementInstallTarget = {
|
|
|
7
7
|
canInstall: boolean;
|
|
8
8
|
lastFocusedAt: number | null;
|
|
9
9
|
readOnly: boolean;
|
|
10
|
+
studioUrl: string;
|
|
10
11
|
updatedAt: number;
|
|
11
12
|
};
|
|
12
13
|
export declare const updateElementInstallTarget: (newTarget: Omit<ElementInstallTarget, "updatedAt">) => void;
|
|
@@ -8,6 +8,7 @@ const parse_ast_1 = require("../../codemods/parse-ast");
|
|
|
8
8
|
const update_keyframes_1 = require("../../codemods/update-keyframes/update-keyframes");
|
|
9
9
|
const file_watcher_1 = require("../../file-watcher");
|
|
10
10
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
11
|
+
const video_config_values_1 = require("../../helpers/video-config-values");
|
|
11
12
|
const undo_stack_1 = require("../undo-stack");
|
|
12
13
|
const watch_ignore_next_change_1 = require("../watch-ignore-next-change");
|
|
13
14
|
const can_update_effect_props_1 = require("./can-update-effect-props");
|
|
@@ -28,6 +29,7 @@ const addEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectI
|
|
|
28
29
|
sequenceNodePath: sequenceNodePath.nodePath,
|
|
29
30
|
effectIndex,
|
|
30
31
|
schema,
|
|
32
|
+
videoConfigValues: sequenceNodePath.videoConfigValues,
|
|
31
33
|
updates: [
|
|
32
34
|
{
|
|
33
35
|
key,
|
|
@@ -88,6 +90,10 @@ const addEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectI
|
|
|
88
90
|
jsx,
|
|
89
91
|
effectIndex,
|
|
90
92
|
keys: (0, studio_shared_1.getAllSchemaKeys)(schema),
|
|
93
|
+
videoConfigValues: (0, video_config_values_1.getVideoConfigIdentifierValues)({
|
|
94
|
+
ast,
|
|
95
|
+
videoConfigValues: sequenceNodePath.videoConfigValues,
|
|
96
|
+
}),
|
|
91
97
|
});
|
|
92
98
|
});
|
|
93
99
|
exports.addEffectKeyframeHandler = addEffectKeyframeHandler;
|
|
@@ -95,6 +95,7 @@ const addKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, remo
|
|
|
95
95
|
input: output,
|
|
96
96
|
nodePath: firstSequenceKeyframe.nodePath.nodePath,
|
|
97
97
|
schema: firstSequenceKeyframe.schema,
|
|
98
|
+
videoConfigValues: firstSequenceKeyframe.nodePath.videoConfigValues,
|
|
98
99
|
updates: keyframeGroup.map((keyframe) => ({
|
|
99
100
|
key: keyframe.key,
|
|
100
101
|
operation: {
|
|
@@ -127,6 +128,7 @@ const addKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, remo
|
|
|
127
128
|
sequenceNodePath: firstEffectKeyframe.sequenceNodePath.nodePath,
|
|
128
129
|
effectIndex: firstEffectKeyframe.effectIndex,
|
|
129
130
|
schema: firstEffectKeyframe.schema,
|
|
131
|
+
videoConfigValues: firstEffectKeyframe.sequenceNodePath.videoConfigValues,
|
|
130
132
|
updates: keyframeGroup.map((keyframe) => ({
|
|
131
133
|
key: keyframe.key,
|
|
132
134
|
operation: {
|
|
@@ -25,6 +25,7 @@ const addSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, v
|
|
|
25
25
|
input: fileContents,
|
|
26
26
|
nodePath: nodePath.nodePath,
|
|
27
27
|
schema,
|
|
28
|
+
videoConfigValues: nodePath.videoConfigValues,
|
|
28
29
|
updates: [
|
|
29
30
|
{
|
|
30
31
|
key,
|
|
@@ -76,6 +77,7 @@ const addSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, v
|
|
|
76
77
|
nodePath: updatedNodePath,
|
|
77
78
|
componentIdentity: null,
|
|
78
79
|
effects: [],
|
|
80
|
+
videoConfigValues: nodePath.videoConfigValues,
|
|
79
81
|
});
|
|
80
82
|
const updatedSubscriptionKey = { ...nodePath, nodePath: updatedNodePath };
|
|
81
83
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ApplyCodemodRequest, ApplyCodemodResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const getCodemodLogMessage: (codemod: import("@remotion/studio-shared").RecastCodemod) => string;
|
|
3
4
|
export declare const applyCodemodHandler: ApiHandler<ApplyCodemodRequest, ApplyCodemodResponse>;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.applyCodemodHandler = void 0;
|
|
6
|
+
exports.applyCodemodHandler = exports.getCodemodLogMessage = 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");
|
|
@@ -11,6 +11,7 @@ const apply_codemod_to_file_1 = require("../../codemods/apply-codemod-to-file");
|
|
|
11
11
|
const duplicate_composition_1 = require("../../codemods/duplicate-composition");
|
|
12
12
|
const simple_diff_1 = require("../../codemods/simple-diff");
|
|
13
13
|
const file_watcher_1 = require("../../file-watcher");
|
|
14
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
14
15
|
const project_info_1 = require("../project-info");
|
|
15
16
|
const undo_stack_1 = require("../undo-stack");
|
|
16
17
|
const can_update_default_props_1 = require("./can-update-default-props");
|
|
@@ -23,6 +24,50 @@ export const ${componentName}: React.FC = () => {
|
|
|
23
24
|
};
|
|
24
25
|
`);
|
|
25
26
|
};
|
|
27
|
+
const getFolderPath = (parentName, folderName) => {
|
|
28
|
+
return parentName ? `${parentName}/${folderName}` : folderName;
|
|
29
|
+
};
|
|
30
|
+
const getCodemodLogMessage = (codemod) => {
|
|
31
|
+
if (codemod.type === 'new-composition') {
|
|
32
|
+
const destination = codemod.folderName
|
|
33
|
+
? ` in folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`
|
|
34
|
+
: '';
|
|
35
|
+
return `Created composition "${codemod.newId}"${destination}`;
|
|
36
|
+
}
|
|
37
|
+
if (codemod.type === 'duplicate-composition') {
|
|
38
|
+
return `Duplicated composition "${codemod.idToDuplicate}" to "${codemod.newId}"`;
|
|
39
|
+
}
|
|
40
|
+
if (codemod.type === 'rename-composition') {
|
|
41
|
+
return `Renamed composition "${codemod.idToRename}" to "${codemod.newId}"`;
|
|
42
|
+
}
|
|
43
|
+
if (codemod.type === 'delete-composition') {
|
|
44
|
+
return `Deleted composition "${codemod.idToDelete}"`;
|
|
45
|
+
}
|
|
46
|
+
if (codemod.type === 'move-composition-to-folder') {
|
|
47
|
+
const destination = codemod.folderName
|
|
48
|
+
? `into folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`
|
|
49
|
+
: 'to root';
|
|
50
|
+
return `Moved composition "${codemod.idToMove}" ${destination}`;
|
|
51
|
+
}
|
|
52
|
+
if (codemod.type === 'rename-folder') {
|
|
53
|
+
const oldName = getFolderPath(codemod.parentName, codemod.folderName);
|
|
54
|
+
const newName = getFolderPath(codemod.parentName, codemod.newName);
|
|
55
|
+
return `Renamed folder "${oldName}" to "${newName}"`;
|
|
56
|
+
}
|
|
57
|
+
if (codemod.type === 'new-folder') {
|
|
58
|
+
return `Created folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`;
|
|
59
|
+
}
|
|
60
|
+
if (codemod.type === 'delete-folder') {
|
|
61
|
+
return `Deleted folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`;
|
|
62
|
+
}
|
|
63
|
+
if (codemod.changes.length === 1) {
|
|
64
|
+
return `Updated visual control "${codemod.changes[0].id}"`;
|
|
65
|
+
}
|
|
66
|
+
return `Updated visual controls ${codemod.changes
|
|
67
|
+
.map((change) => `"${change.id}"`)
|
|
68
|
+
.join(', ')}`;
|
|
69
|
+
};
|
|
70
|
+
exports.getCodemodLogMessage = getCodemodLogMessage;
|
|
26
71
|
const getCodemodUndoDescription = (codemod) => {
|
|
27
72
|
if (codemod.type === 'delete-composition') {
|
|
28
73
|
return {
|
|
@@ -50,7 +95,7 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
50
95
|
if (codemod.type === 'move-composition-to-folder') {
|
|
51
96
|
const destination = codemod.folderName === null
|
|
52
97
|
? 'to root'
|
|
53
|
-
: `into folder "${codemod.parentName
|
|
98
|
+
: `into folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`;
|
|
54
99
|
const label = `composition "${codemod.idToMove}" ${destination}`;
|
|
55
100
|
return {
|
|
56
101
|
undoMessage: `↩️ Move of ${label}`,
|
|
@@ -66,7 +111,7 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
66
111
|
};
|
|
67
112
|
}
|
|
68
113
|
if (codemod.type === 'delete-folder') {
|
|
69
|
-
const label = `folder "${codemod.parentName
|
|
114
|
+
const label = `folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`;
|
|
70
115
|
return {
|
|
71
116
|
undoMessage: `↩️ Deletion of ${label}`,
|
|
72
117
|
redoMessage: `↪️ Deletion of ${label}`,
|
|
@@ -74,7 +119,7 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
74
119
|
};
|
|
75
120
|
}
|
|
76
121
|
if (codemod.type === 'new-folder') {
|
|
77
|
-
const label = `folder "${codemod.parentName
|
|
122
|
+
const label = `folder "${getFolderPath(codemod.parentName, codemod.folderName)}"`;
|
|
78
123
|
return {
|
|
79
124
|
undoMessage: `↩️ Creation of ${label}`,
|
|
80
125
|
redoMessage: `↪️ Creation of ${label}`,
|
|
@@ -82,8 +127,8 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
82
127
|
};
|
|
83
128
|
}
|
|
84
129
|
if (codemod.type === 'rename-folder') {
|
|
85
|
-
const oldName =
|
|
86
|
-
const newName =
|
|
130
|
+
const oldName = getFolderPath(codemod.parentName, codemod.folderName);
|
|
131
|
+
const newName = getFolderPath(codemod.parentName, codemod.newName);
|
|
87
132
|
const label = `folder "${oldName}" to "${newName}"`;
|
|
88
133
|
return {
|
|
89
134
|
undoMessage: `↩️ Rename of ${label}`,
|
|
@@ -99,9 +144,9 @@ const getCodemodUndoDescription = (codemod) => {
|
|
|
99
144
|
};
|
|
100
145
|
const applyCodemodHandler = ({ input: { codemod, dryRun, symbolicatedStack }, logLevel, remotionRoot, entryPoint, }) => {
|
|
101
146
|
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
102
|
-
var _a
|
|
147
|
+
var _a;
|
|
103
148
|
try {
|
|
104
|
-
const
|
|
149
|
+
const logLine = (_a = symbolicatedStack === null || symbolicatedStack === void 0 ? void 0 : symbolicatedStack.originalLineNumber) !== null && _a !== void 0 ? _a : 1;
|
|
105
150
|
const filePath = symbolicatedStack
|
|
106
151
|
? (0, apply_codemod_to_file_1.resolveFilePathFromSymbolicatedStack)(remotionRoot, symbolicatedStack)
|
|
107
152
|
: (await (0, project_info_1.getProjectInfo)(remotionRoot, entryPoint)).rootFile;
|
|
@@ -133,7 +178,7 @@ const applyCodemodHandler = ({ input: { codemod, dryRun, symbolicatedStack }, lo
|
|
|
133
178
|
filePath,
|
|
134
179
|
oldContents: input,
|
|
135
180
|
newContents: null,
|
|
136
|
-
logLine
|
|
181
|
+
logLine,
|
|
137
182
|
},
|
|
138
183
|
];
|
|
139
184
|
let componentFilePath = null;
|
|
@@ -169,7 +214,7 @@ const applyCodemodHandler = ({ input: { codemod, dryRun, symbolicatedStack }, lo
|
|
|
169
214
|
newContents: null,
|
|
170
215
|
logLevel,
|
|
171
216
|
remotionRoot,
|
|
172
|
-
logLine
|
|
217
|
+
logLine,
|
|
173
218
|
description: {
|
|
174
219
|
undoMessage,
|
|
175
220
|
redoMessage,
|
|
@@ -186,9 +231,13 @@ const applyCodemodHandler = ({ input: { codemod, dryRun, symbolicatedStack }, lo
|
|
|
186
231
|
if (componentFilePath && componentFileContents !== null) {
|
|
187
232
|
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(componentFilePath, componentFileContents, undefined);
|
|
188
233
|
}
|
|
189
|
-
const
|
|
190
|
-
const
|
|
191
|
-
|
|
234
|
+
const logMessage = (0, exports.getCodemodLogMessage)(codemod);
|
|
235
|
+
const editMessage = `${renderer_1.RenderInternals.chalk.blueBright((0, format_log_file_location_1.formatLogFileLocation)({
|
|
236
|
+
remotionRoot,
|
|
237
|
+
absolutePath: filePath,
|
|
238
|
+
line: logLine,
|
|
239
|
+
}))} ${logMessage}`;
|
|
240
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, editMessage);
|
|
192
241
|
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
193
242
|
}
|
|
194
243
|
return {
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import type { File, JSXOpeningElement } from '@babel/types';
|
|
2
|
-
import type { CanUpdateEffectPropsResponse, SequenceNodePath, InteractivitySchema } from 'remotion';
|
|
3
|
-
|
|
2
|
+
import type { CanUpdateEffectPropsResponse, SequenceNodePath, InteractivitySchema, VideoConfigValues } from 'remotion';
|
|
3
|
+
import { type VideoConfigIdentifierValues } from '../../helpers/video-config-values';
|
|
4
|
+
export declare const computeEffectPropStatus: ({ ast, jsx, effectIndex, keys, videoConfigValues, }: {
|
|
4
5
|
ast: File;
|
|
5
6
|
jsx: JSXOpeningElement;
|
|
6
7
|
effectIndex: number;
|
|
7
8
|
keys: string[];
|
|
9
|
+
videoConfigValues: VideoConfigIdentifierValues;
|
|
8
10
|
}) => CanUpdateEffectPropsResponse;
|
|
9
|
-
export declare const computeEffectPropsStatusesFromContent: ({ fileContents, sequenceNodePath, effects, keysFor, }: {
|
|
11
|
+
export declare const computeEffectPropsStatusesFromContent: ({ fileContents, sequenceNodePath, effects, keysFor, videoConfigValues, }: {
|
|
10
12
|
fileContents: string;
|
|
11
13
|
sequenceNodePath: SequenceNodePath;
|
|
12
14
|
effects: InteractivitySchema[];
|
|
13
15
|
keysFor: (effect: InteractivitySchema) => string[];
|
|
16
|
+
videoConfigValues: VideoConfigValues | null;
|
|
14
17
|
}) => CanUpdateEffectPropsResponse[];
|
|
15
|
-
export declare const computeEffectPropsStatusesFromFile: ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, }: {
|
|
18
|
+
export declare const computeEffectPropsStatusesFromFile: ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, videoConfigValues, }: {
|
|
16
19
|
fileName: string;
|
|
17
20
|
sequenceNodePath: SequenceNodePath;
|
|
18
21
|
effects: InteractivitySchema[];
|
|
19
22
|
keysFor: (effect: InteractivitySchema) => string[];
|
|
20
23
|
remotionRoot: string;
|
|
24
|
+
videoConfigValues: VideoConfigValues | null;
|
|
21
25
|
}) => CanUpdateEffectPropsResponse[];
|
|
@@ -5,6 +5,8 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const parse_ast_1 = require("../../codemods/parse-ast");
|
|
6
6
|
const update_effect_props_1 = require("../../codemods/update-effect-props/update-effect-props");
|
|
7
7
|
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
8
|
+
const video_config_numeric_expression_1 = require("../../helpers/video-config-numeric-expression");
|
|
9
|
+
const video_config_values_1 = require("../../helpers/video-config-values");
|
|
8
10
|
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
9
11
|
const staticStatus = (codeValue) => ({
|
|
10
12
|
status: 'static',
|
|
@@ -88,7 +90,7 @@ const resolveEffectImport = ({ ast, call, fallbackCallee, }) => {
|
|
|
88
90
|
}
|
|
89
91
|
return { callee: fallbackCallee, importPath: null };
|
|
90
92
|
};
|
|
91
|
-
const getPropsFromObjectExpression = ({ ast, objExpr, keys, }) => {
|
|
93
|
+
const getPropsFromObjectExpression = ({ ast, objExpr, keys, videoConfigValues, }) => {
|
|
92
94
|
const out = {};
|
|
93
95
|
for (const key of keys) {
|
|
94
96
|
const prop = objExpr.properties.find((p) => p.type === 'ObjectProperty' &&
|
|
@@ -101,7 +103,19 @@ const getPropsFromObjectExpression = ({ ast, objExpr, keys, }) => {
|
|
|
101
103
|
}
|
|
102
104
|
const valueExpr = prop.value;
|
|
103
105
|
if (!(0, can_update_sequence_props_1.isStaticValue)(valueExpr)) {
|
|
104
|
-
|
|
106
|
+
const numericExpression = (0, video_config_numeric_expression_1.parseVideoConfigNumericExpression)({
|
|
107
|
+
node: valueExpr,
|
|
108
|
+
videoConfigValues,
|
|
109
|
+
});
|
|
110
|
+
out[key] = numericExpression
|
|
111
|
+
? {
|
|
112
|
+
status: 'static',
|
|
113
|
+
codeValue: numericExpression.value,
|
|
114
|
+
...(numericExpression.type === 'literal'
|
|
115
|
+
? {}
|
|
116
|
+
: { numericExpression }),
|
|
117
|
+
}
|
|
118
|
+
: (0, can_update_sequence_props_1.getComputedStatus)(valueExpr, ast, videoConfigValues);
|
|
105
119
|
continue;
|
|
106
120
|
}
|
|
107
121
|
out[key] = {
|
|
@@ -111,7 +125,7 @@ const getPropsFromObjectExpression = ({ ast, objExpr, keys, }) => {
|
|
|
111
125
|
}
|
|
112
126
|
return out;
|
|
113
127
|
};
|
|
114
|
-
const computeEffectPropStatus = ({ ast, jsx, effectIndex, keys, }) => {
|
|
128
|
+
const computeEffectPropStatus = ({ ast, jsx, effectIndex, keys, videoConfigValues, }) => {
|
|
115
129
|
const attr = findEffectsAttr(jsx);
|
|
116
130
|
const elements = getEffectsArrayElements(attr);
|
|
117
131
|
if (!elements) {
|
|
@@ -167,6 +181,7 @@ const computeEffectPropStatus = ({ ast, jsx, effectIndex, keys, }) => {
|
|
|
167
181
|
ast,
|
|
168
182
|
objExpr: firstArg,
|
|
169
183
|
keys,
|
|
184
|
+
videoConfigValues,
|
|
170
185
|
});
|
|
171
186
|
return {
|
|
172
187
|
canUpdate: true,
|
|
@@ -177,8 +192,12 @@ const computeEffectPropStatus = ({ ast, jsx, effectIndex, keys, }) => {
|
|
|
177
192
|
};
|
|
178
193
|
};
|
|
179
194
|
exports.computeEffectPropStatus = computeEffectPropStatus;
|
|
180
|
-
const computeEffectPropsStatusesFromContent = ({ fileContents, sequenceNodePath, effects, keysFor, }) => {
|
|
195
|
+
const computeEffectPropsStatusesFromContent = ({ fileContents, sequenceNodePath, effects, keysFor, videoConfigValues, }) => {
|
|
181
196
|
const ast = (0, parse_ast_1.parseAst)(fileContents);
|
|
197
|
+
const videoConfigIdentifierValues = (0, video_config_values_1.getVideoConfigIdentifierValues)({
|
|
198
|
+
ast,
|
|
199
|
+
videoConfigValues,
|
|
200
|
+
});
|
|
182
201
|
const jsx = (0, can_update_sequence_props_1.findJsxElementAtNodePath)(ast, sequenceNodePath);
|
|
183
202
|
if (!jsx) {
|
|
184
203
|
return effects.map((_effect, effectIndex) => ({
|
|
@@ -192,10 +211,11 @@ const computeEffectPropsStatusesFromContent = ({ fileContents, sequenceNodePath,
|
|
|
192
211
|
jsx,
|
|
193
212
|
effectIndex,
|
|
194
213
|
keys: keysFor(effect),
|
|
214
|
+
videoConfigValues: videoConfigIdentifierValues,
|
|
195
215
|
}));
|
|
196
216
|
};
|
|
197
217
|
exports.computeEffectPropsStatusesFromContent = computeEffectPropsStatusesFromContent;
|
|
198
|
-
const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, }) => {
|
|
218
|
+
const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effects, keysFor, remotionRoot, videoConfigValues, }) => {
|
|
199
219
|
const { absolutePath } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
200
220
|
remotionRoot,
|
|
201
221
|
fileName,
|
|
@@ -207,6 +227,7 @@ const computeEffectPropsStatusesFromFile = ({ fileName, sequenceNodePath, effect
|
|
|
207
227
|
sequenceNodePath,
|
|
208
228
|
effects,
|
|
209
229
|
keysFor,
|
|
230
|
+
videoConfigValues,
|
|
210
231
|
});
|
|
211
232
|
};
|
|
212
233
|
exports.computeEffectPropsStatusesFromFile = computeEffectPropsStatusesFromFile;
|