@remotion/studio-server 4.0.512 → 4.0.514
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codemods/delete-jsx-node.d.ts +2 -5
- package/dist/codemods/delete-jsx-node.js +23 -341
- package/dist/codemods/duplicate-composition.d.ts +1 -9
- package/dist/codemods/duplicate-composition.js +3 -49
- package/dist/codemods/format-inline-content.d.ts +2 -5
- package/dist/codemods/format-inline-content.js +20 -50
- package/dist/codemods/parse-ast.d.ts +1 -0
- package/dist/codemods/parse-ast.js +5 -1
- package/dist/codemods/recast-mods.js +0 -18
- package/dist/codemods/reorder-sequence.d.ts +2 -2
- package/dist/codemods/reorder-sequence.js +12 -112
- package/dist/codemods/split-jsx-sequence.d.ts +1 -2
- package/dist/codemods/split-jsx-sequence.js +11 -298
- package/dist/codemods/split-video-from-audio.d.ts +15 -0
- package/dist/codemods/split-video-from-audio.js +15 -0
- package/dist/codemods/update-default-props.d.ts +2 -6
- package/dist/codemods/update-default-props.js +12 -220
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.d.ts +1 -4
- package/dist/codemods/update-keyframes/ensure-imports-and-frame-hook.js +5 -102
- package/dist/codemods/update-keyframes/update-keyframes.d.ts +8 -93
- package/dist/codemods/update-keyframes/update-keyframes.js +11 -1302
- package/dist/codemods/update-sequence-props/update-sequence-props.d.ts +4 -1
- package/dist/codemods/update-sequence-props/update-sequence-props.js +47 -3
- package/dist/detect-outdated-remotion-skills.d.ts +7 -0
- package/dist/detect-outdated-remotion-skills.js +11 -5
- package/dist/helpers/resolve-composition-component.d.ts +3 -11
- package/dist/helpers/resolve-composition-component.js +38 -1495
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/max-timeline-tracks.d.ts +2 -1
- package/dist/max-timeline-tracks.js +10 -4
- package/dist/preview-server/api-routes.js +4 -0
- package/dist/preview-server/routes/add-effect.js +1 -1
- package/dist/preview-server/routes/apply-codemod.js +3 -3
- package/dist/preview-server/routes/apply-visual-control-change.js +3 -3
- package/dist/preview-server/routes/can-update-effect-props.js +3 -0
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +26 -0
- package/dist/preview-server/routes/can-update-sequence-props.js +437 -61
- package/dist/preview-server/routes/default-editor.js +4 -1
- package/dist/preview-server/routes/delete-effect.js +1 -1
- package/dist/preview-server/routes/delete-jsx-node.js +1 -1
- package/dist/preview-server/routes/duplicate-effect.js +1 -1
- package/dist/preview-server/routes/duplicate-jsx-node.js +1 -1
- package/dist/preview-server/routes/element-install-plan.d.ts +1 -1
- package/dist/preview-server/routes/insert-element.js +2 -2
- package/dist/preview-server/routes/insert-jsx-element.js +1 -1
- package/dist/preview-server/routes/log-updates/log-effect-update.js +2 -1
- package/dist/preview-server/routes/log-updates/log-update.js +2 -1
- package/dist/preview-server/routes/paste-effects.js +1 -1
- package/dist/preview-server/routes/remotion-skills-info.d.ts +7 -0
- package/dist/preview-server/routes/remotion-skills-info.js +24 -0
- package/dist/preview-server/routes/reorder-effect.js +1 -1
- package/dist/preview-server/routes/reorder-sequence.js +1 -1
- package/dist/preview-server/routes/save-sequence-props.js +27 -4
- package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -0
- package/dist/preview-server/routes/source-file-write-queue.js +11 -2
- package/dist/preview-server/routes/split-jsx-sequence.js +1 -1
- package/dist/preview-server/routes/split-video-from-audio.d.ts +3 -0
- package/dist/preview-server/routes/split-video-from-audio.js +80 -0
- package/dist/preview-server/routes/subscribe-to-sequence-props.d.ts +2 -2
- package/dist/preview-server/routes/subscribe-to-sequence-props.js +37 -3
- package/dist/preview-server/routes/update-default-props.js +1 -1
- package/dist/preview-server/sequence-props-watchers.d.ts +2 -1
- package/dist/preview-server/sequence-props-watchers.js +33 -2
- package/dist/preview-server/start-server.js +188 -140
- package/dist/preview-server/undo-stack.d.ts +3 -52
- package/dist/preview-server/update-available.js +4 -4
- package/package.json +8 -8
|
@@ -25,7 +25,7 @@ export declare const getElementInstallPlan: ({ compositionFile, compositionId, e
|
|
|
25
25
|
expectedFileState: ElementInstallExpectedFileState;
|
|
26
26
|
filePath: string;
|
|
27
27
|
importPath: string;
|
|
28
|
-
location: import("
|
|
28
|
+
location: import("@remotion/studio-codemods").ResolvedCompositionComponentWithFile;
|
|
29
29
|
safePaths: {
|
|
30
30
|
compositionFileName: string;
|
|
31
31
|
elementFileName: string;
|
|
@@ -197,8 +197,8 @@ const insertElementHandler = ({ input: { compositionFile, compositionId, element
|
|
|
197
197
|
: plan.elementFileExists
|
|
198
198
|
? 'Reused existing Element source'
|
|
199
199
|
: 'Created Element source';
|
|
200
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(elementLocationLabel)} ${elementFileAction}`);
|
|
201
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(compositionLocationLabel)} Added <${plan.componentName}>`);
|
|
200
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(elementLocationLabel)} ${elementFileAction}`);
|
|
201
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(compositionLocationLabel)} Added <${plan.componentName}>`);
|
|
202
202
|
if (!inserted.formatted) {
|
|
203
203
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
204
204
|
}
|
|
@@ -204,7 +204,7 @@ const insertJsxElementHandler = ({ input: { compositionFile, compositionId, elem
|
|
|
204
204
|
absolutePath: fileName,
|
|
205
205
|
line: logLine,
|
|
206
206
|
});
|
|
207
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Added ${elementLabel}`);
|
|
207
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Added ${elementLabel}`);
|
|
208
208
|
if (!formatted) {
|
|
209
209
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
210
210
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logEffectUpdate = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const source_file_write_queue_1 = require("../source-file-write-queue");
|
|
5
6
|
const format_effect_prop_change_1 = require("./format-effect-prop-change");
|
|
6
7
|
const log_update_1 = require("./log-update");
|
|
7
8
|
const logEffectUpdate = ({ fileRelativeToRoot, line, effectName, propKey, oldValueString, newValueString, defaultValueString, formatted, logLevel, removedProps, addedProps, }) => {
|
|
@@ -15,7 +16,7 @@ const logEffectUpdate = ({ fileRelativeToRoot, line, effectName, propKey, oldVal
|
|
|
15
16
|
removedProps,
|
|
16
17
|
addedProps,
|
|
17
18
|
});
|
|
18
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${propChange}`);
|
|
19
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${propChange}`);
|
|
19
20
|
if (!formatted) {
|
|
20
21
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
21
22
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.logUpdate = exports.normalizeQuotes = exports.warnAboutPrettierOnce = void 0;
|
|
4
4
|
const renderer_1 = require("@remotion/renderer");
|
|
5
|
+
const source_file_write_queue_1 = require("../source-file-write-queue");
|
|
5
6
|
const format_prop_change_1 = require("./format-prop-change");
|
|
6
7
|
let warnedAboutPrettier = false;
|
|
7
8
|
const warnAboutPrettierOnce = (logLevel) => {
|
|
@@ -31,7 +32,7 @@ const logUpdate = ({ fileRelativeToRoot, line, key, oldValueString, newValueStri
|
|
|
31
32
|
removedProps,
|
|
32
33
|
addedProps,
|
|
33
34
|
});
|
|
34
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${propChange}`);
|
|
35
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} ${propChange}`);
|
|
35
36
|
if (!formatted) {
|
|
36
37
|
(0, exports.warnAboutPrettierOnce)(logLevel);
|
|
37
38
|
}
|
|
@@ -66,7 +66,7 @@ const pasteEffectsHandler = ({ input: { targetFileName, targetSequenceNodePath,
|
|
|
66
66
|
absolutePath,
|
|
67
67
|
line: logLine,
|
|
68
68
|
});
|
|
69
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Pasted ${(0, formatting_1.attrName)(effectDescription)}`);
|
|
69
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Pasted ${(0, formatting_1.attrName)(effectDescription)}`);
|
|
70
70
|
if (!formatted) {
|
|
71
71
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
72
72
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { GetRemotionSkillsInfoRequest, GetRemotionSkillsInfoResponse } from '@remotion/studio-shared';
|
|
2
|
+
import type { ApiHandler } from '../api-types';
|
|
3
|
+
export declare const getRemotionSkillsInfo: ({ remotionRoot, homeDirectory, }: {
|
|
4
|
+
remotionRoot: string;
|
|
5
|
+
homeDirectory?: string | undefined;
|
|
6
|
+
}) => GetRemotionSkillsInfoResponse;
|
|
7
|
+
export declare const remotionSkillsInfoHandler: ApiHandler<GetRemotionSkillsInfoRequest, GetRemotionSkillsInfoResponse>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.remotionSkillsInfoHandler = exports.getRemotionSkillsInfo = void 0;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const detect_outdated_remotion_skills_1 = require("../../detect-outdated-remotion-skills");
|
|
11
|
+
const getRemotionSkillsInfo = ({ remotionRoot, homeDirectory = (0, node_os_1.homedir)(), }) => {
|
|
12
|
+
const skillsDirectories = (0, detect_outdated_remotion_skills_1.getRemotionSkillsDirectories)({
|
|
13
|
+
cwd: remotionRoot,
|
|
14
|
+
homeDirectory,
|
|
15
|
+
});
|
|
16
|
+
const isSkillAvailable = (skillName) => Object.values(skillsDirectories).some((skillsDirectory) => (0, node_fs_1.existsSync)(node_path_1.default.join(skillsDirectory, skillName, 'SKILL.md')));
|
|
17
|
+
return {
|
|
18
|
+
remotionUpgradeSkillAvailable: isSkillAvailable('remotion-upgrade'),
|
|
19
|
+
remotionInteractivitySkillAvailable: isSkillAvailable('remotion-interactivity'),
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.getRemotionSkillsInfo = getRemotionSkillsInfo;
|
|
23
|
+
const remotionSkillsInfoHandler = ({ remotionRoot }) => Promise.resolve((0, exports.getRemotionSkillsInfo)({ remotionRoot }));
|
|
24
|
+
exports.remotionSkillsInfoHandler = remotionSkillsInfoHandler;
|
|
@@ -54,7 +54,7 @@ const reorderEffectHandler = ({ input: { fileName, sequenceNodePath, fromIndex,
|
|
|
54
54
|
absolutePath,
|
|
55
55
|
line: logLine,
|
|
56
56
|
});
|
|
57
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(effectLabel)}`);
|
|
57
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(effectLabel)}`);
|
|
58
58
|
if (!formatted) {
|
|
59
59
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ const reorderSequenceHandler = ({ input: { fileName, sourceNodePath, targetNodeP
|
|
|
62
62
|
absolutePath,
|
|
63
63
|
line: logLine,
|
|
64
64
|
});
|
|
65
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(sequenceLabel)}`);
|
|
65
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Reordered ${(0, formatting_1.attrName)(sequenceLabel)}`);
|
|
66
66
|
if (!formatted) {
|
|
67
67
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
68
68
|
}
|
|
@@ -190,6 +190,7 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
190
190
|
}
|
|
191
191
|
const snapshots = [];
|
|
192
192
|
const outputByPath = new Map();
|
|
193
|
+
const statusAstByPath = new Map();
|
|
193
194
|
const resultByIndex = new Map();
|
|
194
195
|
const updatedNodePaths = new Map();
|
|
195
196
|
const sequenceKeyframeLogs = [];
|
|
@@ -198,14 +199,20 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
198
199
|
for (const [absolutePath, group] of editGroups) {
|
|
199
200
|
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
200
201
|
let output = fileContents;
|
|
202
|
+
const cachedStatusAst = group.edits.length > 0
|
|
203
|
+
? (0, can_update_sequence_props_1.takeCachedSequencePropsStatusAst)(fileContents)
|
|
204
|
+
: null;
|
|
205
|
+
let sequencePropsAst = null;
|
|
201
206
|
let firstLogLine = Number.POSITIVE_INFINITY;
|
|
202
207
|
if (group.edits.length > 0) {
|
|
203
|
-
const { output: sequencePropsOutput, formatted, results: updateResults, } = await (0, update_sequence_props_1.updateMultipleSequenceProps)({
|
|
208
|
+
const { output: sequencePropsOutput, formatted, results: updateResults, ast, } = await (0, update_sequence_props_1.updateMultipleSequenceProps)({
|
|
204
209
|
input: output,
|
|
205
210
|
changes: group.edits.map(exports.convertSequencePropEditToCodemodChange),
|
|
206
211
|
prettierConfigOverride: null,
|
|
212
|
+
ast: cachedStatusAst !== null && cachedStatusAst !== void 0 ? cachedStatusAst : undefined,
|
|
207
213
|
});
|
|
208
214
|
output = sequencePropsOutput;
|
|
215
|
+
sequencePropsAst = ast;
|
|
209
216
|
const firstUpdate = updateResults[0];
|
|
210
217
|
if (firstUpdate) {
|
|
211
218
|
firstLogLine = Math.min(firstLogLine, firstUpdate.logLine);
|
|
@@ -365,6 +372,13 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
365
372
|
});
|
|
366
373
|
}
|
|
367
374
|
}
|
|
375
|
+
if (sequencePropsAst &&
|
|
376
|
+
group.captionPatches.length === 0 &&
|
|
377
|
+
group.addedKeyframes.length === 0 &&
|
|
378
|
+
group.movedSequenceKeyframes.length === 0 &&
|
|
379
|
+
group.effectKeyframes.length === 0) {
|
|
380
|
+
statusAstByPath.set(absolutePath, sequencePropsAst);
|
|
381
|
+
}
|
|
368
382
|
outputByPath.set(absolutePath, output);
|
|
369
383
|
snapshots.push({
|
|
370
384
|
filePath: absolutePath,
|
|
@@ -481,15 +495,24 @@ const saveSequencePropsHandler = ({ input: { edits, addedKeyframes, movedKeyfram
|
|
|
481
495
|
if (!output) {
|
|
482
496
|
throw new Error('Could not compute sequence prop edit status');
|
|
483
497
|
}
|
|
484
|
-
const
|
|
485
|
-
fileContents: output,
|
|
498
|
+
const statusInput = {
|
|
486
499
|
keys: (0, studio_shared_1.getAllSchemaKeys)(target.schema),
|
|
487
500
|
assetKeys: (0, studio_shared_1.getAssetSchemaKeys)(target.schema),
|
|
488
501
|
nodePath: (_a = updatedNodePaths.get(`${absolutePath}:${JSON.stringify(target.nodePath.nodePath)}`)) !== null && _a !== void 0 ? _a : target.nodePath.nodePath,
|
|
489
502
|
componentIdentity: null,
|
|
490
503
|
effects: [],
|
|
491
504
|
videoConfigValues: target.nodePath.videoConfigValues,
|
|
492
|
-
}
|
|
505
|
+
};
|
|
506
|
+
const statusAst = statusAstByPath.get(absolutePath);
|
|
507
|
+
const newStatus = statusAst
|
|
508
|
+
? (0, can_update_sequence_props_1.computeSequencePropsStatusFromAst)({
|
|
509
|
+
...statusInput,
|
|
510
|
+
ast: statusAst,
|
|
511
|
+
})
|
|
512
|
+
: (0, can_update_sequence_props_1.computeSequencePropsStatusFromContent)({
|
|
513
|
+
...statusInput,
|
|
514
|
+
fileContents: output,
|
|
515
|
+
});
|
|
493
516
|
return {
|
|
494
517
|
fileName: target.fileName,
|
|
495
518
|
nodePath: target.nodePath,
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.withSourceFileWriteQueue = void 0;
|
|
3
|
+
exports.withSourceFileWriteQueue = exports.getCodemodTimingPrefix = void 0;
|
|
4
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
4
5
|
let chain = Promise.resolve();
|
|
6
|
+
const codemodStartTime = new node_async_hooks_1.AsyncLocalStorage();
|
|
7
|
+
const getCodemodTimingPrefix = (logLevel) => {
|
|
8
|
+
const startTime = codemodStartTime.getStore();
|
|
9
|
+
return logLevel === 'trace' && startTime !== undefined
|
|
10
|
+
? `[${Date.now() - startTime}ms] `
|
|
11
|
+
: '';
|
|
12
|
+
};
|
|
13
|
+
exports.getCodemodTimingPrefix = getCodemodTimingPrefix;
|
|
5
14
|
const withSourceFileWriteQueue = (fn) => {
|
|
6
|
-
const run = () =>
|
|
15
|
+
const run = () => codemodStartTime.run(Date.now(), fn);
|
|
7
16
|
const next = chain.then(run, run);
|
|
8
17
|
chain = next.then(() => undefined, () => undefined);
|
|
9
18
|
return next;
|
|
@@ -60,7 +60,7 @@ const splitJsxSequenceHandler = ({ input: { fileName, nodePath, sequenceKeys, sp
|
|
|
60
60
|
absolutePath,
|
|
61
61
|
line: logLine,
|
|
62
62
|
});
|
|
63
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split ${nodeLabel}`);
|
|
63
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split ${nodeLabel}`);
|
|
64
64
|
if (!formatted) {
|
|
65
65
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
66
66
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitVideoFromAudioHandler = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const renderer_1 = require("@remotion/renderer");
|
|
6
|
+
const split_video_from_audio_1 = require("../../codemods/split-video-from-audio");
|
|
7
|
+
const file_watcher_1 = require("../../file-watcher");
|
|
8
|
+
const resolve_file_inside_project_1 = require("../../helpers/resolve-file-inside-project");
|
|
9
|
+
const format_log_file_location_1 = require("../format-log-file-location");
|
|
10
|
+
const sequence_node_path_mutation_1 = require("../sequence-node-path-mutation");
|
|
11
|
+
const undo_stack_1 = require("../undo-stack");
|
|
12
|
+
const log_update_1 = require("./log-updates/log-update");
|
|
13
|
+
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
14
|
+
const splitVideoFromAudioHandler = ({ input: { fileName, nodePath }, remotionRoot, logLevel }) => (0, source_file_write_queue_1.withSourceFileWriteQueue)(async () => {
|
|
15
|
+
try {
|
|
16
|
+
renderer_1.RenderInternals.Log.trace({ indent: false, logLevel }, `[split-video-from-audio] Received request for fileName="${fileName}"`);
|
|
17
|
+
const { absolutePath, fileRelativeToRoot } = (0, resolve_file_inside_project_1.resolveFileInsideProject)({
|
|
18
|
+
remotionRoot,
|
|
19
|
+
fileName,
|
|
20
|
+
action: 'modify',
|
|
21
|
+
});
|
|
22
|
+
const fileContents = (0, node_fs_1.readFileSync)(absolutePath, 'utf-8');
|
|
23
|
+
const { output, formatted, nodeLabel, logLine, nodePathRemappings } = await (0, split_video_from_audio_1.splitVideoFromAudio)({
|
|
24
|
+
input: fileContents,
|
|
25
|
+
nodePath,
|
|
26
|
+
});
|
|
27
|
+
const nodePathMutation = (0, sequence_node_path_mutation_1.broadcastSequenceNodePathMutation)([
|
|
28
|
+
{
|
|
29
|
+
absolutePath,
|
|
30
|
+
remappings: nodePathRemappings,
|
|
31
|
+
restoredNodePaths: [],
|
|
32
|
+
},
|
|
33
|
+
]);
|
|
34
|
+
(0, undo_stack_1.pushToUndoStack)({
|
|
35
|
+
filePath: absolutePath,
|
|
36
|
+
oldContents: fileContents,
|
|
37
|
+
newContents: null,
|
|
38
|
+
logLevel,
|
|
39
|
+
remotionRoot,
|
|
40
|
+
logLine,
|
|
41
|
+
description: {
|
|
42
|
+
undoMessage: `↩️ Split of audio from ${nodeLabel}`,
|
|
43
|
+
redoMessage: `↪️ Split of audio from ${nodeLabel}`,
|
|
44
|
+
},
|
|
45
|
+
entryType: 'split-video-from-audio',
|
|
46
|
+
suppressHmrOnFileRestore: false,
|
|
47
|
+
nodePathRemappings,
|
|
48
|
+
});
|
|
49
|
+
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
50
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
51
|
+
file: absolutePath,
|
|
52
|
+
content: output,
|
|
53
|
+
originatorClientId: undefined,
|
|
54
|
+
metadata: { skipSequencePropsUpdate: true },
|
|
55
|
+
});
|
|
56
|
+
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
57
|
+
remotionRoot,
|
|
58
|
+
absolutePath,
|
|
59
|
+
line: logLine,
|
|
60
|
+
});
|
|
61
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Split audio from ${nodeLabel}`);
|
|
62
|
+
if (!formatted) {
|
|
63
|
+
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
64
|
+
}
|
|
65
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, `[split-video-from-audio] Wrote ${fileRelativeToRoot}${formatted ? ' (formatted)' : ''}`);
|
|
66
|
+
(0, undo_stack_1.printUndoHint)(logLevel);
|
|
67
|
+
return {
|
|
68
|
+
success: true,
|
|
69
|
+
nodePathMutation,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
catch (err) {
|
|
73
|
+
return {
|
|
74
|
+
success: false,
|
|
75
|
+
reason: err.message,
|
|
76
|
+
stack: err.stack,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
exports.splitVideoFromAudioHandler = splitVideoFromAudioHandler;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SubscribeToSequencePropsBatchRequest, SubscribeToSequencePropsBatchResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { ApiHandler } from '../api-types';
|
|
3
|
-
export declare const subscribeToSequenceProps: ApiHandler<
|
|
3
|
+
export declare const subscribeToSequenceProps: ApiHandler<SubscribeToSequencePropsBatchRequest, SubscribeToSequencePropsBatchResponse>;
|
|
@@ -2,12 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.subscribeToSequenceProps = void 0;
|
|
4
4
|
const sequence_props_watchers_1 = require("../sequence-props-watchers");
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const can_update_sequence_props_1 = require("./can-update-sequence-props");
|
|
6
|
+
const subscribeToSequenceProps = ({ input, remotionRoot, logLevel }) => {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const requests = (_a = input.requests) !== null && _a !== void 0 ? _a : [input];
|
|
9
|
+
const unresolvedByFile = new Map();
|
|
10
|
+
for (const [index, request] of requests.entries()) {
|
|
11
|
+
if (request.nodePath !== null) {
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
const unresolved = (_b = unresolvedByFile.get(request.fileName)) !== null && _b !== void 0 ? _b : [];
|
|
15
|
+
unresolved.push({ index, line: request.line, column: request.column });
|
|
16
|
+
unresolvedByFile.set(request.fileName, unresolved);
|
|
17
|
+
}
|
|
18
|
+
const resolvedNodePaths = new Map();
|
|
19
|
+
for (const [fileName, unresolved] of unresolvedByFile) {
|
|
20
|
+
try {
|
|
21
|
+
const nodePaths = (0, can_update_sequence_props_1.resolveSequencePropsNodePathsFromFilename)({
|
|
22
|
+
fileName,
|
|
23
|
+
targets: unresolved,
|
|
24
|
+
remotionRoot,
|
|
25
|
+
});
|
|
26
|
+
for (const [index, nodePath] of nodePaths.entries()) {
|
|
27
|
+
if (nodePath) {
|
|
28
|
+
resolvedNodePaths.set(unresolved[index].index, nodePath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (_c) {
|
|
33
|
+
// Let each subscription produce its usual not-found response.
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const results = requests.map(({ fileName, line, column, nodePath, componentIdentity, keys, assetKeys = [], effects, clientId, videoConfigValues, }, index) => (0, sequence_props_watchers_1.subscribeToSequencePropsWatchers)({
|
|
7
37
|
fileName,
|
|
8
38
|
line,
|
|
9
39
|
column,
|
|
10
40
|
nodePath,
|
|
41
|
+
resolvedNodePath: resolvedNodePaths.get(index),
|
|
11
42
|
componentIdentity,
|
|
12
43
|
keys,
|
|
13
44
|
assetKeys,
|
|
@@ -16,7 +47,10 @@ const subscribeToSequenceProps = ({ input: { fileName, line, column, nodePath, c
|
|
|
16
47
|
clientId,
|
|
17
48
|
videoConfigValues,
|
|
18
49
|
logLevel,
|
|
50
|
+
}));
|
|
51
|
+
return Promise.resolve({
|
|
52
|
+
...results[0],
|
|
53
|
+
results,
|
|
19
54
|
});
|
|
20
|
-
return Promise.resolve(result);
|
|
21
55
|
};
|
|
22
56
|
exports.subscribeToSequenceProps = subscribeToSequenceProps;
|
|
@@ -60,7 +60,7 @@ const updateDefaultPropsHandler = ({ input: { compositionId, defaultProps, enumP
|
|
|
60
60
|
absolutePath: projectInfo.rootFile,
|
|
61
61
|
line: logLine,
|
|
62
62
|
});
|
|
63
|
-
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Updated default props for "${compositionId}"`);
|
|
63
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, `${(0, source_file_write_queue_1.getCodemodTimingPrefix)(logLevel)}${renderer_1.RenderInternals.chalk.blueBright(`${locationLabel}`)} Updated default props for "${compositionId}"`);
|
|
64
64
|
if (!formatted) {
|
|
65
65
|
(0, log_update_1.warnAboutPrettierOnce)(logLevel);
|
|
66
66
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type SubscribeToSequencePropsResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { SequenceNodePath, VideoConfigValues } from 'remotion';
|
|
3
|
-
export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column, nodePath: preferredNodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, clientId, logLevel, videoConfigValues, }: {
|
|
3
|
+
export declare const subscribeToSequencePropsWatchers: ({ fileName, line, column, nodePath: preferredNodePath, resolvedNodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, clientId, logLevel, videoConfigValues, }: {
|
|
4
4
|
fileName: string;
|
|
5
5
|
line: number;
|
|
6
6
|
column: number;
|
|
7
7
|
nodePath: SequenceNodePath | null;
|
|
8
|
+
resolvedNodePath?: SequenceNodePath | null | undefined;
|
|
8
9
|
componentIdentity: string | null;
|
|
9
10
|
keys: string[];
|
|
10
11
|
assetKeys: string[];
|
|
@@ -15,7 +15,7 @@ const node_path_cache_1 = require("./node-path-cache");
|
|
|
15
15
|
const can_update_sequence_props_1 = require("./routes/can-update-sequence-props");
|
|
16
16
|
const sequencePropsWatchers = {};
|
|
17
17
|
const getWatcherKey = (nodePath, assetKeys) => `${(0, studio_shared_1.stringifySequenceSubscriptionKey)(nodePath)}:${assetKeys.join('\0')}:${JSON.stringify(nodePath.videoConfigValues)}`;
|
|
18
|
-
const getSequencePropsStatus = ({ fileName, line, column, preferredNodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, videoConfigValues, }) => {
|
|
18
|
+
const getSequencePropsStatus = ({ fileName, line, column, preferredNodePath, resolvedNodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, logLevel, videoConfigValues, }) => {
|
|
19
19
|
if (preferredNodePath) {
|
|
20
20
|
try {
|
|
21
21
|
const fromNodePath = (0, can_update_sequence_props_1.computeSequencePropsStatus)({
|
|
@@ -85,6 +85,36 @@ const getSequencePropsStatus = ({ fileName, line, column, preferredNodePath, com
|
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
+
if (resolvedNodePath) {
|
|
89
|
+
try {
|
|
90
|
+
return {
|
|
91
|
+
status: (0, can_update_sequence_props_1.computeSequencePropsStatus)({
|
|
92
|
+
fileName,
|
|
93
|
+
nodePath: resolvedNodePath,
|
|
94
|
+
componentIdentity,
|
|
95
|
+
keys,
|
|
96
|
+
assetKeys,
|
|
97
|
+
effects,
|
|
98
|
+
remotionRoot,
|
|
99
|
+
videoConfigValues,
|
|
100
|
+
}),
|
|
101
|
+
nodePath: {
|
|
102
|
+
absolutePath: node_path_1.default.resolve(remotionRoot, fileName),
|
|
103
|
+
nodePath: resolvedNodePath,
|
|
104
|
+
sequenceKeys: keys,
|
|
105
|
+
effectKeys: effects,
|
|
106
|
+
videoConfigValues,
|
|
107
|
+
},
|
|
108
|
+
success: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
if (!(error instanceof jsx_component_identity_1.JsxElementIdentityMismatchError ||
|
|
113
|
+
error instanceof jsx_element_not_found_at_location_error_1.JsxElementNotFoundAtLocationError)) {
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
88
118
|
const status = (0, can_update_sequence_props_1.computeSequencePropsStatusFromFilenameByLocation)({
|
|
89
119
|
fileName,
|
|
90
120
|
line,
|
|
@@ -99,13 +129,14 @@ const getSequencePropsStatus = ({ fileName, line, column, preferredNodePath, com
|
|
|
99
129
|
});
|
|
100
130
|
return status;
|
|
101
131
|
};
|
|
102
|
-
const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: preferredNodePath, componentIdentity, keys, assetKeys, effects, remotionRoot, clientId, logLevel, videoConfigValues, }) => {
|
|
132
|
+
const subscribeToSequencePropsWatchers = ({ fileName, line, column, nodePath: preferredNodePath, resolvedNodePath = null, componentIdentity, keys, assetKeys, effects, remotionRoot, clientId, logLevel, videoConfigValues, }) => {
|
|
103
133
|
var _a;
|
|
104
134
|
const initialResult = getSequencePropsStatus({
|
|
105
135
|
fileName,
|
|
106
136
|
line,
|
|
107
137
|
column,
|
|
108
138
|
preferredNodePath,
|
|
139
|
+
resolvedNodePath,
|
|
109
140
|
componentIdentity,
|
|
110
141
|
keys,
|
|
111
142
|
assetKeys,
|