@remotion/studio-server 4.0.534 → 4.0.535
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/file-watcher.js +2 -0
- package/dist/helpers/app-discovery.d.ts +9 -0
- package/dist/helpers/app-discovery.js +61 -0
- package/dist/helpers/open-in-app.d.ts +13 -0
- package/dist/helpers/open-in-app.js +72 -0
- package/dist/helpers/open-in-editor.js +7 -6
- package/dist/helpers/recently-used-apps.d.ts +9 -0
- package/dist/helpers/recently-used-apps.js +63 -0
- package/dist/preview-server/api-routes.js +4 -5
- package/dist/preview-server/live-events.d.ts +1 -0
- package/dist/preview-server/live-events.js +12 -1
- package/dist/preview-server/routes/app-info.d.ts +3 -0
- package/dist/preview-server/routes/app-info.js +16 -0
- package/dist/preview-server/routes/default-coding-agent.d.ts +1 -2
- package/dist/preview-server/routes/default-coding-agent.js +10 -20
- package/dist/preview-server/routes/default-editor.js +9 -33
- package/dist/preview-server/routes/element-install-plan.js +5 -0
- package/dist/preview-server/routes/insert-basic-captions.js +1 -0
- package/dist/preview-server/routes/insert-element.js +46 -13
- package/dist/preview-server/routes/open-in-editor.d.ts +1 -1
- package/dist/preview-server/routes/open-in-editor.js +2 -56
- package/dist/preview-server/routes/redo.js +2 -1
- package/dist/preview-server/routes/source-file-write-queue.d.ts +1 -1
- package/dist/preview-server/routes/undo.js +2 -1
- package/dist/preview-server/routes/update-config.js +12 -5
- package/dist/preview-server/studio-protocol/handle-element-library.js +14 -0
- package/dist/preview-server/studio-protocol/handle-install.js +2 -1
- package/dist/preview-server/undo-stack.js +1 -0
- package/dist/preview-server/watch-ignore-next-change.d.ts +1 -0
- package/dist/preview-server/watch-ignore-next-change.js +15 -2
- package/dist/start-studio.js +6 -3
- package/dist/studio-shortcuts.d.ts +13 -0
- package/dist/studio-shortcuts.js +257 -0
- package/package.json +8 -8
package/dist/file-watcher.js
CHANGED
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.writeFileAndNotifyFileWatchers = exports.installFileWatcher = exports.getFileWatcherRegistry = exports.setFileWatcherRegistry = exports.createFileWatcherRegistry = void 0;
|
|
37
37
|
const node_fs_1 = __importStar(require("node:fs"));
|
|
38
|
+
const watch_ignore_next_change_1 = require("./preview-server/watch-ignore-next-change");
|
|
38
39
|
const getRegistryKey = (file, existenceOnly) => existenceOnly ? `${file}\0existence-only` : file;
|
|
39
40
|
const createFileWatcherRegistry = () => {
|
|
40
41
|
const sharedWatchers = new Map();
|
|
@@ -130,6 +131,7 @@ const createFileWatcherRegistry = () => {
|
|
|
130
131
|
};
|
|
131
132
|
const _writeFileAndNotifyFileWatchers = ({ file, content, originatorClientId, metadata, }) => {
|
|
132
133
|
var _a;
|
|
134
|
+
(0, watch_ignore_next_change_1.prepareBundlerForFileWrite)(file);
|
|
133
135
|
(0, node_fs_1.writeFileSync)(file, content);
|
|
134
136
|
const shared = sharedWatchers.get(getRegistryKey(file, false));
|
|
135
137
|
if (!shared) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DefaultEditor } from '@remotion/renderer';
|
|
2
|
+
import type { GetDefaultEditorInfoResponse } from '@remotion/studio-shared';
|
|
3
|
+
export declare const getAppDiscovery: () => Promise<{
|
|
4
|
+
installedEditors: readonly import("./editor-registry").InstalledEditor[];
|
|
5
|
+
installedCodingAgents: readonly import("./coding-agent-registry").InstalledCodingAgent[];
|
|
6
|
+
runningEditors: readonly ("cursor" | "sublime-text" | "vscode" | "vscodium" | "webstorm" | "windsurf" | "zed")[];
|
|
7
|
+
runningCodingAgents: readonly ("claude-code" | "codex" | "copilot" | "cursor")[];
|
|
8
|
+
}>;
|
|
9
|
+
export declare const getEditorInfo: (configuredEditor: DefaultEditor | null) => Promise<GetDefaultEditorInfoResponse>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEditorInfo = exports.getAppDiscovery = void 0;
|
|
4
|
+
const coding_agent_registry_1 = require("./coding-agent-registry");
|
|
5
|
+
const custom_editor_1 = require("./custom-editor");
|
|
6
|
+
const editor_registry_1 = require("./editor-registry");
|
|
7
|
+
let appDiscovery = null;
|
|
8
|
+
const discoverApps = async () => {
|
|
9
|
+
const [installedEditors, installedCodingAgents] = await Promise.all([
|
|
10
|
+
(0, editor_registry_1.getAvailableEditors)(),
|
|
11
|
+
(0, coding_agent_registry_1.getAvailableCodingAgents)(),
|
|
12
|
+
]);
|
|
13
|
+
const [runningEditors, runningCodingAgents] = await Promise.all([
|
|
14
|
+
(0, editor_registry_1.getRunningEditors)(installedEditors),
|
|
15
|
+
(0, coding_agent_registry_1.getRunningCodingAgents)(installedCodingAgents),
|
|
16
|
+
]);
|
|
17
|
+
return {
|
|
18
|
+
installedEditors,
|
|
19
|
+
installedCodingAgents,
|
|
20
|
+
runningEditors,
|
|
21
|
+
runningCodingAgents,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
// The terminal helper and Studio requests share the same in-flight discovery
|
|
25
|
+
// and process snapshot. Configuration and app history are read separately.
|
|
26
|
+
const getAppDiscovery = () => {
|
|
27
|
+
appDiscovery !== null && appDiscovery !== void 0 ? appDiscovery : (appDiscovery = discoverApps());
|
|
28
|
+
return appDiscovery;
|
|
29
|
+
};
|
|
30
|
+
exports.getAppDiscovery = getAppDiscovery;
|
|
31
|
+
const getEditorInfo = async (configuredEditor) => {
|
|
32
|
+
const { installedEditors, runningEditors } = await (0, exports.getAppDiscovery)();
|
|
33
|
+
const customEditor = configuredEditor &&
|
|
34
|
+
typeof configuredEditor === 'object' &&
|
|
35
|
+
(0, custom_editor_1.resolveCustomEditorExecutable)(configuredEditor)
|
|
36
|
+
? configuredEditor
|
|
37
|
+
: null;
|
|
38
|
+
return {
|
|
39
|
+
defaultEditor: configuredEditor && typeof configuredEditor === 'object'
|
|
40
|
+
? 'custom'
|
|
41
|
+
: configuredEditor,
|
|
42
|
+
runningEditors,
|
|
43
|
+
installedEditors: [
|
|
44
|
+
...installedEditors.map(({ id, name, nameWithType }) => ({
|
|
45
|
+
id,
|
|
46
|
+
name,
|
|
47
|
+
nameWithType,
|
|
48
|
+
})),
|
|
49
|
+
...(customEditor
|
|
50
|
+
? [
|
|
51
|
+
{
|
|
52
|
+
id: 'custom',
|
|
53
|
+
name: customEditor.name,
|
|
54
|
+
nameWithType: customEditor.name,
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
: []),
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
exports.getEditorInfo = getEditorInfo;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type DefaultEditor } from '@remotion/renderer';
|
|
2
|
+
import type { OpenInCodingAgentRequest, OpenInCodingAgentResponse, OpenInEditorRequest, OpenInEditorResponse } from '@remotion/studio-shared';
|
|
3
|
+
export declare const openInEditor: ({ input, remotionRoot, logLevel, getDefaultEditor, }: {
|
|
4
|
+
input: OpenInEditorRequest;
|
|
5
|
+
remotionRoot: string;
|
|
6
|
+
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
7
|
+
getDefaultEditor: () => DefaultEditor | null;
|
|
8
|
+
}) => Promise<OpenInEditorResponse>;
|
|
9
|
+
export declare const openInCodingAgent: ({ input, logLevel, remotionRoot, }: {
|
|
10
|
+
input: OpenInCodingAgentRequest;
|
|
11
|
+
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
12
|
+
remotionRoot: string;
|
|
13
|
+
}) => Promise<OpenInCodingAgentResponse>;
|
|
@@ -0,0 +1,72 @@
|
|
|
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.openInCodingAgent = exports.openInEditor = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const renderer_1 = require("@remotion/renderer");
|
|
9
|
+
const coding_agent_registry_1 = require("./coding-agent-registry");
|
|
10
|
+
const custom_editor_1 = require("./custom-editor");
|
|
11
|
+
const open_in_editor_1 = require("./open-in-editor");
|
|
12
|
+
const resolve_editor_1 = require("./resolve-editor");
|
|
13
|
+
const openInEditor = async ({ input, remotionRoot, logLevel, getDefaultEditor, }) => {
|
|
14
|
+
try {
|
|
15
|
+
if (!('stack' in input)) {
|
|
16
|
+
throw new TypeError('Need to pass stack');
|
|
17
|
+
}
|
|
18
|
+
const { stack } = input;
|
|
19
|
+
if (input.editorId !== null &&
|
|
20
|
+
input.editorId !== 'custom' &&
|
|
21
|
+
!renderer_1.defaultEditorIds.includes(input.editorId)) {
|
|
22
|
+
return { success: false };
|
|
23
|
+
}
|
|
24
|
+
const editor = await (0, resolve_editor_1.resolveEditor)({
|
|
25
|
+
defaultEditor: getDefaultEditor(),
|
|
26
|
+
logLevel,
|
|
27
|
+
preferredEditor: input.editorId,
|
|
28
|
+
});
|
|
29
|
+
if (!editor) {
|
|
30
|
+
return { success: false };
|
|
31
|
+
}
|
|
32
|
+
const fileName = node_path_1.default.resolve(remotionRoot, stack.originalFileName);
|
|
33
|
+
const didOpen = editor.type === 'custom'
|
|
34
|
+
? await (0, custom_editor_1.launchCustomEditor)({
|
|
35
|
+
editor: editor.editor,
|
|
36
|
+
resolvedExecutable: editor,
|
|
37
|
+
targetPath: fileName,
|
|
38
|
+
lineNumber: stack.originalLineNumber,
|
|
39
|
+
columnNumber: stack.originalColumnNumber,
|
|
40
|
+
logLevel,
|
|
41
|
+
spawnProcess: null,
|
|
42
|
+
})
|
|
43
|
+
: await (0, open_in_editor_1.launchEditor)({
|
|
44
|
+
colNumber: stack.originalColumnNumber,
|
|
45
|
+
editor,
|
|
46
|
+
fileName,
|
|
47
|
+
lineNumber: stack.originalLineNumber,
|
|
48
|
+
vsCodeNewWindow: false,
|
|
49
|
+
logLevel,
|
|
50
|
+
}, remotionRoot);
|
|
51
|
+
return { success: didOpen };
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
return { success: false };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.openInEditor = openInEditor;
|
|
58
|
+
const openInCodingAgent = async ({ input, logLevel, remotionRoot, }) => {
|
|
59
|
+
const codingAgent = (await (0, coding_agent_registry_1.getAvailableCodingAgents)()).find((agent) => agent.id === input.codingAgentId);
|
|
60
|
+
if (!codingAgent) {
|
|
61
|
+
return { success: false };
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
success: await (0, coding_agent_registry_1.launchCodingAgent)({
|
|
65
|
+
codingAgent,
|
|
66
|
+
projectPath: remotionRoot,
|
|
67
|
+
logLevel,
|
|
68
|
+
prompt: input.prompt,
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
exports.openInCodingAgent = openInCodingAgent;
|
|
@@ -382,9 +382,8 @@ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNew
|
|
|
382
382
|
if (editor.command.toLowerCase() === 'none') {
|
|
383
383
|
return false;
|
|
384
384
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
: null;
|
|
385
|
+
const isDirectory = node_fs_1.default.statSync(fileName).isDirectory();
|
|
386
|
+
let folderToOpen = isVsCodeDerivative(editor.command) && !isDirectory ? projectFolder : null;
|
|
388
387
|
if (process.platform === 'linux' &&
|
|
389
388
|
fileName.startsWith('/mnt/') &&
|
|
390
389
|
/Microsoft/i.test(node_os_1.default.release())) {
|
|
@@ -417,7 +416,7 @@ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNew
|
|
|
417
416
|
}
|
|
418
417
|
const shouldOpenVsCodeNewWindow = isVsCodeDerivative(editor.command) && vsCodeNewWindow;
|
|
419
418
|
// The file URL cannot specify both a workspace folder and a source location.
|
|
420
|
-
if (!shouldOpenVsCodeNewWindow && folderToOpen === null) {
|
|
419
|
+
if (!shouldOpenVsCodeNewWindow && folderToOpen === null && !isDirectory) {
|
|
421
420
|
const result = (0, open_in_editor_url_scheme_1.openInEditorViaUrlScheme)({
|
|
422
421
|
editor: editor.command,
|
|
423
422
|
fileName,
|
|
@@ -433,13 +432,15 @@ async function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNew
|
|
|
433
432
|
}
|
|
434
433
|
const args = shouldOpenVsCodeNewWindow
|
|
435
434
|
? ['--new-window', fileName]
|
|
436
|
-
: lineNumber
|
|
435
|
+
: lineNumber && !isDirectory
|
|
437
436
|
? getArgumentsForLineNumber(editor.command, fileName, String(lineNumber), colNumber)
|
|
438
437
|
: [fileName];
|
|
439
438
|
if (folderToOpen !== null) {
|
|
440
439
|
args.unshift(folderToOpen);
|
|
441
440
|
}
|
|
442
|
-
if (process.platform === 'darwin' &&
|
|
441
|
+
if (process.platform === 'darwin' &&
|
|
442
|
+
isVsCodeDerivative(editor.command) &&
|
|
443
|
+
(folderToOpen !== null || isDirectory)) {
|
|
443
444
|
const applicationPath = (_a = editor.process.match(/^(.*?\.app)\/Contents\//)) === null || _a === void 0 ? void 0 : _a[1];
|
|
444
445
|
if (applicationPath && node_fs_1.default.existsSync(applicationPath)) {
|
|
445
446
|
// Match the CLI's native macOS launch without starting its Node.js wrapper.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const subscribeToRecentlyUsedApps: ({ remotionRoot, onChange, }: {
|
|
2
|
+
remotionRoot: string;
|
|
3
|
+
onChange: () => void;
|
|
4
|
+
}) => () => void;
|
|
5
|
+
export declare const getRecentlyUsedApps: ({ remotionRoot, type, recentlyUsedIds, }: {
|
|
6
|
+
remotionRoot: string;
|
|
7
|
+
type: "coding-agent" | "editor";
|
|
8
|
+
recentlyUsedIds: readonly string[] | null;
|
|
9
|
+
}) => Promise<readonly string[]>;
|
|
@@ -0,0 +1,63 @@
|
|
|
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.getRecentlyUsedApps = exports.subscribeToRecentlyUsedApps = void 0;
|
|
7
|
+
const promises_1 = require("node:fs/promises");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const renderer_1 = require("@remotion/renderer");
|
|
10
|
+
const histories = new Map();
|
|
11
|
+
const historyListeners = new Set();
|
|
12
|
+
const subscribeToRecentlyUsedApps = ({ remotionRoot, onChange, }) => {
|
|
13
|
+
const listener = { remotionRoot, onChange };
|
|
14
|
+
historyListeners.add(listener);
|
|
15
|
+
return () => {
|
|
16
|
+
historyListeners.delete(listener);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.subscribeToRecentlyUsedApps = subscribeToRecentlyUsedApps;
|
|
20
|
+
const getRecentlyUsedApps = ({ remotionRoot, type, recentlyUsedIds, }) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const filePath = node_path_1.default.join(remotionRoot, 'node_modules', '.cache', 'remotion', `recently-used-${type}s.json`);
|
|
23
|
+
const allowedIds = type === 'editor' ? [...renderer_1.defaultEditorIds, 'custom'] : renderer_1.defaultCodingAgentIds;
|
|
24
|
+
const previous = (_a = histories.get(filePath)) !== null && _a !== void 0 ? _a : (async () => {
|
|
25
|
+
try {
|
|
26
|
+
const stored = JSON.parse(await (0, promises_1.readFile)(filePath, 'utf8'));
|
|
27
|
+
return Array.isArray(stored)
|
|
28
|
+
? [
|
|
29
|
+
...new Set(stored.filter((id) => allowedIds.includes(id))),
|
|
30
|
+
]
|
|
31
|
+
: [];
|
|
32
|
+
}
|
|
33
|
+
catch (_a) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
})();
|
|
37
|
+
const history = previous.then(async (ids) => {
|
|
38
|
+
if (recentlyUsedIds === null) {
|
|
39
|
+
return ids;
|
|
40
|
+
}
|
|
41
|
+
const updatedIds = [
|
|
42
|
+
...new Set(recentlyUsedIds.filter((id) => allowedIds.includes(id))),
|
|
43
|
+
];
|
|
44
|
+
if (JSON.stringify(ids) !== JSON.stringify(updatedIds)) {
|
|
45
|
+
try {
|
|
46
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(filePath), { recursive: true });
|
|
47
|
+
await (0, promises_1.writeFile)(filePath, JSON.stringify(updatedIds));
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
// Keep the history in memory when the project cache is not writable.
|
|
51
|
+
}
|
|
52
|
+
historyListeners.forEach((listener) => {
|
|
53
|
+
if (listener.remotionRoot === remotionRoot) {
|
|
54
|
+
listener.onChange();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return updatedIds;
|
|
59
|
+
});
|
|
60
|
+
histories.set(filePath, history);
|
|
61
|
+
return history;
|
|
62
|
+
};
|
|
63
|
+
exports.getRecentlyUsedApps = getRecentlyUsedApps;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.allApiRoutes = void 0;
|
|
4
|
+
const open_in_app_1 = require("../helpers/open-in-app");
|
|
4
5
|
const add_composition_1 = require("./routes/add-composition");
|
|
5
6
|
const add_effect_1 = require("./routes/add-effect");
|
|
6
7
|
const add_effect_keyframe_1 = require("./routes/add-effect-keyframe");
|
|
@@ -8,14 +9,13 @@ const add_folder_1 = require("./routes/add-folder");
|
|
|
8
9
|
const add_keyframes_1 = require("./routes/add-keyframes");
|
|
9
10
|
const add_render_1 = require("./routes/add-render");
|
|
10
11
|
const add_sequence_keyframe_1 = require("./routes/add-sequence-keyframe");
|
|
12
|
+
const app_info_1 = require("./routes/app-info");
|
|
11
13
|
const apply_visual_control_change_1 = require("./routes/apply-visual-control-change");
|
|
12
14
|
const batch_update_keyframe_settings_1 = require("./routes/batch-update-keyframe-settings");
|
|
13
15
|
const cancel_render_1 = require("./routes/cancel-render");
|
|
14
16
|
const composition_component_info_1 = require("./routes/composition-component-info");
|
|
15
17
|
const convert_figma_clipboard_to_svg_1 = require("./routes/convert-figma-clipboard-to-svg");
|
|
16
18
|
const copy_render_output_to_asset_1 = require("./routes/copy-render-output-to-asset");
|
|
17
|
-
const default_coding_agent_1 = require("./routes/default-coding-agent");
|
|
18
|
-
const default_editor_1 = require("./routes/default-editor");
|
|
19
19
|
const delete_composition_1 = require("./routes/delete-composition");
|
|
20
20
|
const delete_effect_1 = require("./routes/delete-effect");
|
|
21
21
|
const delete_keyframes_1 = require("./routes/delete-keyframes");
|
|
@@ -95,7 +95,7 @@ exports.allApiRoutes = {
|
|
|
95
95
|
'/api/open-in-terminal': open_in_terminal_1.openInTerminalHandler,
|
|
96
96
|
'/api/open-in-git-client': open_in_git_client_1.openInGitClientHandler,
|
|
97
97
|
'/api/open-in-editor': open_in_editor_1.openInEditorHandler,
|
|
98
|
-
'/api/open-in-coding-agent':
|
|
98
|
+
'/api/open-in-coding-agent': open_in_app_1.openInCodingAgent,
|
|
99
99
|
'/api/register-client-render': register_client_render_1.registerClientRenderHandler,
|
|
100
100
|
'/api/unregister-client-render': unregister_client_render_1.unregisterClientRenderHandler,
|
|
101
101
|
'/api/update-default-props': update_default_props_1.updateDefaultPropsHandler,
|
|
@@ -152,8 +152,7 @@ exports.allApiRoutes = {
|
|
|
152
152
|
'/api/upgrade-remotion': upgrade_remotion_1.handleUpgradeRemotion,
|
|
153
153
|
'/api/shutdown-studio': shutdown_studio_1.handleShutdownStudio,
|
|
154
154
|
'/api/restart-studio': restart_studio_1.handleRestartStudio,
|
|
155
|
-
'/api/
|
|
156
|
-
'/api/default-editor-info': default_editor_1.getDefaultEditorInfoHandler,
|
|
155
|
+
'/api/app-info': app_info_1.appInfoHandler,
|
|
157
156
|
'/api/insert-composition-element': insert_composition_element_1.insertCompositionElementHandler,
|
|
158
157
|
'/api/insert-element': insert_element_1.insertElementHandler,
|
|
159
158
|
'/api/prepare-element-install': prepare_element_install_1.prepareElementInstallHandler,
|
|
@@ -7,6 +7,7 @@ export type LiveEventsServer = {
|
|
|
7
7
|
closeConnections: () => Promise<void>;
|
|
8
8
|
addNewClientListener: (cb: () => void) => () => void;
|
|
9
9
|
};
|
|
10
|
+
export declare const subscribeToConfigChanges: (onChange: () => void) => () => void;
|
|
10
11
|
export declare const clearPrintPortMessageTimeout: () => void;
|
|
11
12
|
export type InitialUndoRedoState = {
|
|
12
13
|
undoFile: string | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setLiveEventsListener = exports.getLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = void 0;
|
|
3
|
+
exports.setLiveEventsListener = exports.getLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = exports.subscribeToConfigChanges = void 0;
|
|
4
4
|
const server_ready_1 = require("../server-ready");
|
|
5
5
|
const default_props_watchers_1 = require("./default-props-watchers");
|
|
6
6
|
const file_existence_watchers_1 = require("./file-existence-watchers");
|
|
@@ -9,6 +9,14 @@ const serializeMessage = (message) => {
|
|
|
9
9
|
return `data: ${JSON.stringify(message)}\n\n`;
|
|
10
10
|
};
|
|
11
11
|
let printPortMessageTimeout = null;
|
|
12
|
+
const configChangeListeners = new Set();
|
|
13
|
+
const subscribeToConfigChanges = (onChange) => {
|
|
14
|
+
configChangeListeners.add(onChange);
|
|
15
|
+
return () => {
|
|
16
|
+
configChangeListeners.delete(onChange);
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.subscribeToConfigChanges = subscribeToConfigChanges;
|
|
12
20
|
const clearPrintPortMessageTimeout = () => {
|
|
13
21
|
if (printPortMessageTimeout) {
|
|
14
22
|
clearTimeout(printPortMessageTimeout);
|
|
@@ -57,6 +65,9 @@ const makeLiveEventsRouter = (logLevel, getInitialUndoRedoState) => {
|
|
|
57
65
|
return Promise.resolve();
|
|
58
66
|
};
|
|
59
67
|
const sendEventToClient = (event) => {
|
|
68
|
+
if (event.type === 'config-file-changed') {
|
|
69
|
+
configChangeListeners.forEach((listener) => listener());
|
|
70
|
+
}
|
|
60
71
|
clients.forEach((client) => {
|
|
61
72
|
client.response.write(serializeMessage(event));
|
|
62
73
|
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appInfoHandler = void 0;
|
|
4
|
+
const default_coding_agent_1 = require("./default-coding-agent");
|
|
5
|
+
const default_editor_1 = require("./default-editor");
|
|
6
|
+
const appInfoHandler = async (params) => {
|
|
7
|
+
const [editorInfo, codingAgentInfo] = await Promise.all([
|
|
8
|
+
(0, default_editor_1.getDefaultEditorInfoHandler)({ ...params, input: params.input.editor }),
|
|
9
|
+
(0, default_coding_agent_1.getDefaultCodingAgentInfoHandler)({
|
|
10
|
+
...params,
|
|
11
|
+
input: params.input.codingAgent,
|
|
12
|
+
}),
|
|
13
|
+
]);
|
|
14
|
+
return { editorInfo, codingAgentInfo };
|
|
15
|
+
};
|
|
16
|
+
exports.appInfoHandler = appInfoHandler;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { GetDefaultCodingAgentInfoRequest, GetDefaultCodingAgentInfoResponse
|
|
1
|
+
import type { GetDefaultCodingAgentInfoRequest, GetDefaultCodingAgentInfoResponse } from '@remotion/studio-shared';
|
|
2
2
|
import type { ApiHandler } from '../api-types';
|
|
3
3
|
export declare const getDefaultCodingAgentInfoHandler: ApiHandler<GetDefaultCodingAgentInfoRequest, GetDefaultCodingAgentInfoResponse>;
|
|
4
|
-
export declare const openInCodingAgentHandler: ApiHandler<OpenInCodingAgentRequest, OpenInCodingAgentResponse>;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.getDefaultCodingAgentInfoHandler = void 0;
|
|
4
|
+
const app_discovery_1 = require("../../helpers/app-discovery");
|
|
5
5
|
const git_client_registry_1 = require("../../helpers/git-client-registry");
|
|
6
|
+
const recently_used_apps_1 = require("../../helpers/recently-used-apps");
|
|
6
7
|
const terminal_registry_1 = require("../../helpers/terminal-registry");
|
|
7
|
-
const getDefaultCodingAgentInfoHandler = async ({ getDefaultCodingAgent }) => {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const getDefaultCodingAgentInfoHandler = async ({ getDefaultCodingAgent, input, remotionRoot }) => {
|
|
9
|
+
await (0, recently_used_apps_1.getRecentlyUsedApps)({
|
|
10
|
+
remotionRoot,
|
|
11
|
+
type: 'coding-agent',
|
|
12
|
+
recentlyUsedIds: input.recentlyUsedIds,
|
|
13
|
+
});
|
|
14
|
+
const { installedCodingAgents, runningCodingAgents } = await (0, app_discovery_1.getAppDiscovery)();
|
|
10
15
|
const installedTerminals = await (0, terminal_registry_1.getAvailableTerminals)();
|
|
11
16
|
const installedGitClients = await (0, git_client_registry_1.getAvailableGitClients)();
|
|
12
17
|
return {
|
|
@@ -22,18 +27,3 @@ const getDefaultCodingAgentInfoHandler = async ({ getDefaultCodingAgent }) => {
|
|
|
22
27
|
};
|
|
23
28
|
};
|
|
24
29
|
exports.getDefaultCodingAgentInfoHandler = getDefaultCodingAgentInfoHandler;
|
|
25
|
-
const openInCodingAgentHandler = async ({ input, logLevel, remotionRoot }) => {
|
|
26
|
-
const codingAgent = (await (0, coding_agent_registry_1.getAvailableCodingAgents)()).find((agent) => agent.id === input.codingAgentId);
|
|
27
|
-
if (!codingAgent) {
|
|
28
|
-
return { success: false };
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
success: await (0, coding_agent_registry_1.launchCodingAgent)({
|
|
32
|
-
codingAgent,
|
|
33
|
-
projectPath: remotionRoot,
|
|
34
|
-
logLevel,
|
|
35
|
-
prompt: input.prompt,
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
exports.openInCodingAgentHandler = openInCodingAgentHandler;
|
|
@@ -1,38 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultEditorInfoHandler = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const getDefaultEditorInfoHandler = async ({ getDefaultEditor }) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
? configuredEditor
|
|
14
|
-
: null;
|
|
15
|
-
return {
|
|
16
|
-
defaultEditor: configuredEditor && typeof configuredEditor === 'object'
|
|
17
|
-
? 'custom'
|
|
18
|
-
: configuredEditor,
|
|
19
|
-
runningEditors,
|
|
20
|
-
installedEditors: [
|
|
21
|
-
...installedEditors.map(({ id, name, nameWithType }) => ({
|
|
22
|
-
id,
|
|
23
|
-
name,
|
|
24
|
-
nameWithType,
|
|
25
|
-
})),
|
|
26
|
-
...(customEditor
|
|
27
|
-
? [
|
|
28
|
-
{
|
|
29
|
-
id: 'custom',
|
|
30
|
-
name: customEditor.name,
|
|
31
|
-
nameWithType: customEditor.name,
|
|
32
|
-
},
|
|
33
|
-
]
|
|
34
|
-
: []),
|
|
35
|
-
],
|
|
36
|
-
};
|
|
4
|
+
const app_discovery_1 = require("../../helpers/app-discovery");
|
|
5
|
+
const recently_used_apps_1 = require("../../helpers/recently-used-apps");
|
|
6
|
+
const getDefaultEditorInfoHandler = async ({ getDefaultEditor, input, remotionRoot }) => {
|
|
7
|
+
await (0, recently_used_apps_1.getRecentlyUsedApps)({
|
|
8
|
+
remotionRoot,
|
|
9
|
+
type: 'editor',
|
|
10
|
+
recentlyUsedIds: input.recentlyUsedIds,
|
|
11
|
+
});
|
|
12
|
+
return (0, app_discovery_1.getEditorInfo)(getDefaultEditor());
|
|
37
13
|
};
|
|
38
14
|
exports.getDefaultEditorInfoHandler = getDefaultEditorInfoHandler;
|
|
@@ -74,6 +74,11 @@ const getExpectedFileState = (existingSource) => {
|
|
|
74
74
|
const getElementInstallPlan = async ({ destination, element, installationName, entryPoint, remotionRoot, }) => {
|
|
75
75
|
var _a;
|
|
76
76
|
(0, exports.validateElementForInstallation)(element);
|
|
77
|
+
if (destination.type === 'selected-media' &&
|
|
78
|
+
(element.isCaptionStyle !== true ||
|
|
79
|
+
element.installationMode !== 'component-owned-sequence')) {
|
|
80
|
+
throw new Error('The Element must be a component-owned caption style');
|
|
81
|
+
}
|
|
77
82
|
const componentName = studio_protocol_1.StudioProtocolInternals.getElementComponentNameFromSourceCode(element.sourceCode);
|
|
78
83
|
if (componentName === null) {
|
|
79
84
|
throw new Error('Element source must export exactly one named component');
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.insertElementHandler = void 0;
|
|
7
7
|
const node_fs_1 = require("node:fs");
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const codemods_1 = require("@remotion/codemods");
|
|
9
10
|
const renderer_1 = require("@remotion/renderer");
|
|
10
11
|
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
11
12
|
const add_composition_to_file_1 = require("../../codemods/add-composition-to-file");
|
|
@@ -33,10 +34,18 @@ const hasExpectedFileState = ({ expected, actual, }) => {
|
|
|
33
34
|
}
|
|
34
35
|
return actual.sourceHash === expected.sourceHash;
|
|
35
36
|
};
|
|
36
|
-
const insertElementHandler = async ({ input: { compositionFile, compositionId, element, installationName, expectedFileState, from, premountFor, position, overwriteExisting, undoRedoNavigation, newComposition, }, entryPoint, remotionRoot, logLevel, publicDir, }) => {
|
|
37
|
+
const insertElementHandler = async ({ input: { compositionFile, compositionId, captionTarget, element, installationName, expectedFileState, from, premountFor, position, overwriteExisting, undoRedoNavigation, newComposition, }, entryPoint, remotionRoot, logLevel, publicDir, }) => {
|
|
37
38
|
var _a;
|
|
38
39
|
let resolvedAssets;
|
|
39
40
|
try {
|
|
41
|
+
if (captionTarget !== null &&
|
|
42
|
+
(element.isCaptionStyle !== true ||
|
|
43
|
+
element.installationMode !== 'component-owned-sequence' ||
|
|
44
|
+
newComposition !== null ||
|
|
45
|
+
compositionFile !== null ||
|
|
46
|
+
compositionId !== null)) {
|
|
47
|
+
throw new Error('Invalid caption style installation target');
|
|
48
|
+
}
|
|
40
49
|
studio_protocol_1.StudioProtocolInternals.assertElementAssets(element.assets);
|
|
41
50
|
studio_protocol_1.StudioProtocolInternals.assertElementAssetReferences(element);
|
|
42
51
|
resolvedAssets = await studio_protocol_1.StudioProtocolInternals.resolveElementAssets({
|
|
@@ -132,16 +141,21 @@ const insertElementHandler = async ({ input: { compositionFile, compositionId, e
|
|
|
132
141
|
[componentFilePath, componentFileContents],
|
|
133
142
|
]);
|
|
134
143
|
}
|
|
135
|
-
const installDestination =
|
|
144
|
+
const installDestination = captionTarget !== null
|
|
136
145
|
? {
|
|
137
|
-
type: '
|
|
138
|
-
compositionFile,
|
|
139
|
-
compositionId,
|
|
146
|
+
type: 'selected-media',
|
|
147
|
+
compositionFile: captionTarget.fileName,
|
|
140
148
|
}
|
|
141
|
-
:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
149
|
+
: newComposition === null
|
|
150
|
+
? {
|
|
151
|
+
type: 'current-composition',
|
|
152
|
+
compositionFile,
|
|
153
|
+
compositionId,
|
|
154
|
+
}
|
|
155
|
+
: {
|
|
156
|
+
type: 'new-composition',
|
|
157
|
+
compositionFile,
|
|
158
|
+
};
|
|
145
159
|
const plan = await (0, element_install_plan_1.getElementInstallPlan)({
|
|
146
160
|
installationName,
|
|
147
161
|
destination: installDestination,
|
|
@@ -235,10 +249,29 @@ const insertElementHandler = async ({ input: { compositionFile, compositionId, e
|
|
|
235
249
|
position,
|
|
236
250
|
},
|
|
237
251
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
252
|
+
let inserted;
|
|
253
|
+
if (captionTarget === null) {
|
|
254
|
+
inserted = await (0, resolve_composition_component_1.insertJsxElementIntoComposition)({
|
|
255
|
+
...insertionInput,
|
|
256
|
+
compositionFile,
|
|
257
|
+
compositionId,
|
|
258
|
+
sourceFileOverrides,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const fileName = plan.safePaths.compositionFileName;
|
|
263
|
+
const oldContents = (0, node_fs_1.readFileSync)(fileName, 'utf-8');
|
|
264
|
+
inserted = {
|
|
265
|
+
...codemods_1.CodemodsInternals.insertBasicCaptions({
|
|
266
|
+
...captionTarget,
|
|
267
|
+
input: oldContents,
|
|
268
|
+
importPath: plan.importPath,
|
|
269
|
+
element: { componentName: plan.componentName, initialProps },
|
|
270
|
+
}),
|
|
271
|
+
fileName,
|
|
272
|
+
oldContents,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
242
275
|
if (compositionCreation !== null &&
|
|
243
276
|
inserted.fileName !== compositionCreation.componentFilePath) {
|
|
244
277
|
throw new Error('New composition component does not match installation target');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DefaultEditor } from '@remotion/renderer';
|
|
2
2
|
import type { OpenInEditorRequest, OpenInEditorResponse } from '@remotion/studio-shared';
|
|
3
3
|
import type { ApiHandler } from '../api-types';
|
|
4
4
|
export declare const getEditorName: ({ getDefaultEditor, logLevel, }: {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.openInEditorHandler = exports.getEditorName = void 0;
|
|
7
|
-
const
|
|
8
|
-
const renderer_1 = require("@remotion/renderer");
|
|
9
|
-
const custom_editor_1 = require("../../helpers/custom-editor");
|
|
10
|
-
const open_in_editor_1 = require("../../helpers/open-in-editor");
|
|
4
|
+
const open_in_app_1 = require("../../helpers/open-in-app");
|
|
11
5
|
const resolve_editor_1 = require("../../helpers/resolve-editor");
|
|
12
6
|
const getEditorName = async ({ getDefaultEditor, logLevel, }) => {
|
|
13
7
|
var _a;
|
|
@@ -19,52 +13,4 @@ const getEditorName = async ({ getDefaultEditor, logLevel, }) => {
|
|
|
19
13
|
return (_a = editor === null || editor === void 0 ? void 0 : editor.nameWithType) !== null && _a !== void 0 ? _a : null;
|
|
20
14
|
};
|
|
21
15
|
exports.getEditorName = getEditorName;
|
|
22
|
-
|
|
23
|
-
try {
|
|
24
|
-
if (!('stack' in input)) {
|
|
25
|
-
throw new TypeError('Need to pass stack');
|
|
26
|
-
}
|
|
27
|
-
const { stack } = input;
|
|
28
|
-
if (input.editorId !== null &&
|
|
29
|
-
input.editorId !== 'custom' &&
|
|
30
|
-
!renderer_1.defaultEditorIds.includes(input.editorId)) {
|
|
31
|
-
return { success: false };
|
|
32
|
-
}
|
|
33
|
-
const editor = await (0, resolve_editor_1.resolveEditor)({
|
|
34
|
-
defaultEditor: getDefaultEditor(),
|
|
35
|
-
logLevel,
|
|
36
|
-
preferredEditor: input.editorId,
|
|
37
|
-
});
|
|
38
|
-
if (!editor) {
|
|
39
|
-
return { success: false };
|
|
40
|
-
}
|
|
41
|
-
const fileName = node_path_1.default.resolve(remotionRoot, stack.originalFileName);
|
|
42
|
-
const didOpen = editor.type === 'custom'
|
|
43
|
-
? await (0, custom_editor_1.launchCustomEditor)({
|
|
44
|
-
editor: editor.editor,
|
|
45
|
-
resolvedExecutable: editor,
|
|
46
|
-
targetPath: fileName,
|
|
47
|
-
lineNumber: stack.originalLineNumber,
|
|
48
|
-
columnNumber: stack.originalColumnNumber,
|
|
49
|
-
logLevel,
|
|
50
|
-
spawnProcess: null,
|
|
51
|
-
})
|
|
52
|
-
: await (0, open_in_editor_1.launchEditor)({
|
|
53
|
-
colNumber: stack.originalColumnNumber,
|
|
54
|
-
editor,
|
|
55
|
-
fileName,
|
|
56
|
-
lineNumber: stack.originalLineNumber,
|
|
57
|
-
vsCodeNewWindow: false,
|
|
58
|
-
logLevel,
|
|
59
|
-
}, remotionRoot);
|
|
60
|
-
return {
|
|
61
|
-
success: didOpen,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
catch (_a) {
|
|
65
|
-
return {
|
|
66
|
-
success: false,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.openInEditorHandler = openInEditorHandler;
|
|
16
|
+
exports.openInEditorHandler = open_in_app_1.openInEditor;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.redoHandler = void 0;
|
|
4
4
|
const undo_stack_1 = require("../undo-stack");
|
|
5
|
+
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
5
6
|
const redoHandler = () => {
|
|
6
|
-
return
|
|
7
|
+
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => (0, undo_stack_1.popRedo)());
|
|
7
8
|
};
|
|
8
9
|
exports.redoHandler = redoHandler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const getCodemodTimingPrefix: (logLevel: "error" | "info" | "trace" | "verbose" | "warn") => string;
|
|
2
|
-
export declare const withSourceFileWriteQueue: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
2
|
+
export declare const withSourceFileWriteQueue: <T>(fn: () => T | Promise<T>) => Promise<T>;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.undoHandler = void 0;
|
|
4
4
|
const undo_stack_1 = require("../undo-stack");
|
|
5
|
+
const source_file_write_queue_1 = require("./source-file-write-queue");
|
|
5
6
|
const undoHandler = () => {
|
|
6
|
-
return
|
|
7
|
+
return (0, source_file_write_queue_1.withSourceFileWriteQueue)(() => (0, undo_stack_1.popUndo)());
|
|
7
8
|
};
|
|
8
9
|
exports.undoHandler = undoHandler;
|
|
@@ -120,6 +120,10 @@ const validateUpdates = (updates) => {
|
|
|
120
120
|
catch (_b) {
|
|
121
121
|
return 'Config.addElementLibrary() expects an HTTP or HTTPS URL.';
|
|
122
122
|
}
|
|
123
|
+
if (elementLibrary.captionStylesUrl !== undefined &&
|
|
124
|
+
(0, studio_shared_1.normalizeHttpUrl)(elementLibrary.captionStylesUrl) === null) {
|
|
125
|
+
return 'Config.addElementLibrary() expects "captionStylesUrl" to be an absolute HTTP or HTTPS URL.';
|
|
126
|
+
}
|
|
123
127
|
if (displayName !== undefined &&
|
|
124
128
|
(typeof displayName !== 'string' || displayName.trim() === '')) {
|
|
125
129
|
return 'Config.addElementLibrary() expects a non-empty display name.';
|
|
@@ -223,16 +227,19 @@ const updateConfigFile = ({ configContents, existingElementLibraryUrls, updates,
|
|
|
223
227
|
let value = initialValue;
|
|
224
228
|
if (setter === 'addElementLibrary') {
|
|
225
229
|
const elementLibrary = initialValue;
|
|
226
|
-
const { displayName: rawDisplayName, url } = elementLibrary;
|
|
230
|
+
const { displayName: rawDisplayName, url, captionStylesUrl, } = elementLibrary;
|
|
227
231
|
const normalizedUrl = new URL(url).href;
|
|
228
232
|
if (elementLibraryUrls.has(normalizedUrl)) {
|
|
229
233
|
continue;
|
|
230
234
|
}
|
|
231
235
|
const displayName = typeof rawDisplayName === 'string' ? rawDisplayName.trim() : null;
|
|
232
|
-
value =
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
value = {
|
|
237
|
+
url: normalizedUrl,
|
|
238
|
+
...(displayName === null ? {} : { displayName }),
|
|
239
|
+
...(captionStylesUrl === undefined
|
|
240
|
+
? {}
|
|
241
|
+
: { captionStylesUrl: new URL(captionStylesUrl).href }),
|
|
242
|
+
};
|
|
236
243
|
elementLibraryUrls.add(normalizedUrl);
|
|
237
244
|
}
|
|
238
245
|
const serializedValue = JSON.stringify(value)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handleStudioProtocolElementLibrary = void 0;
|
|
4
4
|
const studio_protocol_1 = require("@remotion/studio-protocol");
|
|
5
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
5
6
|
const element_install_state_1 = require("../element-install-state");
|
|
6
7
|
const parse_body_1 = require("../parse-body");
|
|
7
8
|
const origin_policy_1 = require("./origin-policy");
|
|
@@ -81,6 +82,18 @@ const handleStudioProtocolElementLibrary = async ({ configFile, focusStudioTab,
|
|
|
81
82
|
});
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
85
|
+
const captionStylesUrl = parsedRequest.captionStylesUrl === null
|
|
86
|
+
? null
|
|
87
|
+
: (0, studio_shared_1.normalizeHttpUrl)(parsedRequest.captionStylesUrl);
|
|
88
|
+
if (parsedRequest.captionStylesUrl !== null && captionStylesUrl === null) {
|
|
89
|
+
(0, protocol_response_1.writeStudioProtocolError)({
|
|
90
|
+
code: 'invalid-url',
|
|
91
|
+
message: 'The caption styles URL must be an absolute HTTP or HTTPS URL.',
|
|
92
|
+
response,
|
|
93
|
+
status: 400,
|
|
94
|
+
});
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
84
97
|
const displayName = (_b = (_a = parsedRequest.displayName) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : null;
|
|
85
98
|
if (displayName === '') {
|
|
86
99
|
(0, protocol_response_1.writeStudioProtocolError)({
|
|
@@ -117,6 +130,7 @@ const handleStudioProtocolElementLibrary = async ({ configFile, focusStudioTab,
|
|
|
117
130
|
}
|
|
118
131
|
const delivered = liveEventsServer.sendEventToClientId(target.clientId, {
|
|
119
132
|
type: 'element-library-add-request',
|
|
133
|
+
captionStylesUrl,
|
|
120
134
|
url: normalizedUrl,
|
|
121
135
|
displayName,
|
|
122
136
|
origin: requestOrigin,
|
|
@@ -10,7 +10,7 @@ const protocol_response_1 = require("./protocol-response");
|
|
|
10
10
|
// UTF-8 representation and the protocol envelope while keeping memory bounded.
|
|
11
11
|
const MAX_STUDIO_PROTOCOL_INSTALL_BODY_SIZE = 1000000;
|
|
12
12
|
const deliverElementInstall = ({ element, focusStudioTab, liveEventsServer, origin, target, }) => {
|
|
13
|
-
var _a, _b, _c;
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
14
|
const installRequest = {
|
|
15
15
|
id: `${Date.now()}-${Math.random().toString(16).slice(2)}`,
|
|
16
16
|
clientId: target.clientId,
|
|
@@ -22,6 +22,7 @@ const deliverElementInstall = ({ element, focusStudioTab, liveEventsServer, orig
|
|
|
22
22
|
durationInFrames: (_a = element.durationInFrames) !== null && _a !== void 0 ? _a : null,
|
|
23
23
|
initialProps: (_b = element.initialProps) !== null && _b !== void 0 ? _b : null,
|
|
24
24
|
installationMode: (_c = element.installationMode) !== null && _c !== void 0 ? _c : null,
|
|
25
|
+
isCaptionStyle: (_d = element.isCaptionStyle) !== null && _d !== void 0 ? _d : false,
|
|
25
26
|
},
|
|
26
27
|
from: null,
|
|
27
28
|
position: null,
|
|
@@ -285,6 +285,7 @@ function popUndo() {
|
|
|
285
285
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
|
|
286
286
|
}
|
|
287
287
|
if (snapshot.oldContents === null) {
|
|
288
|
+
(0, watch_ignore_next_change_1.prepareBundlerForFileWrite)(snapshot.filePath);
|
|
288
289
|
(0, node_fs_1.rmSync)(snapshot.filePath, { force: true });
|
|
289
290
|
}
|
|
290
291
|
else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { WatchIgnoreNextChangePlugin } from '@remotion/bundler';
|
|
2
2
|
export declare const setWatchIgnoreNextChangePlugin: (plugin: WatchIgnoreNextChangePlugin) => void;
|
|
3
3
|
export declare const suppressBundlerUpdateForFile: (absolutePath: string) => void;
|
|
4
|
+
export declare const prepareBundlerForFileWrite: (absolutePath: string) => void;
|
|
4
5
|
export declare const invalidatePreviouslySuppressedFiles: () => Promise<boolean>;
|
|
5
6
|
export declare const reloadPreviouslySuppressedFiles: () => Promise<void>;
|
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reloadPreviouslySuppressedFiles = exports.invalidatePreviouslySuppressedFiles = exports.suppressBundlerUpdateForFile = exports.setWatchIgnoreNextChangePlugin = void 0;
|
|
3
|
+
exports.reloadPreviouslySuppressedFiles = exports.invalidatePreviouslySuppressedFiles = exports.prepareBundlerForFileWrite = exports.suppressBundlerUpdateForFile = exports.setWatchIgnoreNextChangePlugin = void 0;
|
|
4
4
|
const node_fs_1 = require("node:fs");
|
|
5
|
+
const pendingSuppressedWrites = new Set();
|
|
5
6
|
let currentPlugin = null;
|
|
6
7
|
const setWatchIgnoreNextChangePlugin = (plugin) => {
|
|
7
8
|
currentPlugin = plugin;
|
|
9
|
+
pendingSuppressedWrites.clear();
|
|
8
10
|
};
|
|
9
11
|
exports.setWatchIgnoreNextChangePlugin = setWatchIgnoreNextChangePlugin;
|
|
10
12
|
const suppressBundlerUpdateForFile = (absolutePath) => {
|
|
11
|
-
|
|
13
|
+
pendingSuppressedWrites.add(absolutePath);
|
|
12
14
|
};
|
|
13
15
|
exports.suppressBundlerUpdateForFile = suppressBundlerUpdateForFile;
|
|
16
|
+
// Consume the intent for this write, rather than letting an earlier suppressed
|
|
17
|
+
// write swallow a subsequent structural change in the watcher's aggregated event.
|
|
18
|
+
const prepareBundlerForFileWrite = (absolutePath) => {
|
|
19
|
+
if (pendingSuppressedWrites.delete(absolutePath)) {
|
|
20
|
+
currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.ignoreNextChange(absolutePath);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
currentPlugin === null || currentPlugin === void 0 ? void 0 : currentPlugin.requireRebuild(absolutePath);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.prepareBundlerForFileWrite = prepareBundlerForFileWrite;
|
|
14
27
|
const invalidatePreviouslySuppressedFiles = async () => {
|
|
15
28
|
if (!currentPlugin) {
|
|
16
29
|
return false;
|
package/dist/start-studio.js
CHANGED
|
@@ -11,13 +11,13 @@ const renderer_1 = require("@remotion/renderer");
|
|
|
11
11
|
const file_watcher_1 = require("./file-watcher");
|
|
12
12
|
const get_network_address_1 = require("./get-network-address");
|
|
13
13
|
const maybe_open_browser_1 = require("./maybe-open-browser");
|
|
14
|
-
const open_browser_shortcut_1 = require("./open-browser-shortcut");
|
|
15
14
|
const close_and_restart_1 = require("./preview-server/close-and-restart");
|
|
16
15
|
const get_absolute_public_dir_1 = require("./preview-server/get-absolute-public-dir");
|
|
17
16
|
const live_events_1 = require("./preview-server/live-events");
|
|
18
17
|
const public_folder_1 = require("./preview-server/public-folder");
|
|
19
18
|
const start_server_1 = require("./preview-server/start-server");
|
|
20
19
|
const server_ready_1 = require("./server-ready");
|
|
20
|
+
const studio_shortcuts_1 = require("./studio-shortcuts");
|
|
21
21
|
const watch_root_file_1 = require("./watch-root-file");
|
|
22
22
|
const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getExperimentalKeepAudioContextAlive, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }) => {
|
|
23
23
|
try {
|
|
@@ -128,11 +128,14 @@ const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEn
|
|
|
128
128
|
(0, server_ready_1.printServerReadyComment)('Server ready', logLevel);
|
|
129
129
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, 'Building...');
|
|
130
130
|
const studioUrl = `http://localhost:${port}`;
|
|
131
|
-
const
|
|
131
|
+
const studioShortcuts = (0, studio_shortcuts_1.registerStudioShortcuts)({
|
|
132
132
|
browserArgs,
|
|
133
133
|
browserFlag,
|
|
134
134
|
url: studioUrl,
|
|
135
135
|
logLevel,
|
|
136
|
+
remotionRoot,
|
|
137
|
+
getDefaultEditor,
|
|
138
|
+
getDefaultCodingAgent,
|
|
136
139
|
});
|
|
137
140
|
let action;
|
|
138
141
|
try {
|
|
@@ -146,7 +149,7 @@ const startStudio = async ({ browserArgs, browserFlag, shouldOpenBrowser, fullEn
|
|
|
146
149
|
action = await (0, close_and_restart_1.noOpUntilRestart)();
|
|
147
150
|
}
|
|
148
151
|
finally {
|
|
149
|
-
|
|
152
|
+
studioShortcuts.cleanup();
|
|
150
153
|
}
|
|
151
154
|
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, action === 'shutdown'
|
|
152
155
|
? 'Shutting down Studio...'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DefaultEditor } from '@remotion/renderer';
|
|
2
|
+
export declare const registerStudioShortcuts: ({ browserArgs, browserFlag, url, logLevel, remotionRoot, getDefaultEditor, getDefaultCodingAgent, }: {
|
|
3
|
+
browserArgs: string;
|
|
4
|
+
browserFlag: string;
|
|
5
|
+
url: string;
|
|
6
|
+
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
7
|
+
remotionRoot: string;
|
|
8
|
+
getDefaultEditor: () => DefaultEditor | null;
|
|
9
|
+
getDefaultCodingAgent: () => "claude-code" | "codex" | "copilot" | "cursor" | null;
|
|
10
|
+
}) => {
|
|
11
|
+
registered: boolean;
|
|
12
|
+
cleanup: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,257 @@
|
|
|
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.registerStudioShortcuts = void 0;
|
|
37
|
+
const readline = __importStar(require("node:readline"));
|
|
38
|
+
const renderer_1 = require("@remotion/renderer");
|
|
39
|
+
const studio_shared_1 = require("@remotion/studio-shared");
|
|
40
|
+
const better_opn_1 = require("./better-opn");
|
|
41
|
+
const app_discovery_1 = require("./helpers/app-discovery");
|
|
42
|
+
const open_in_app_1 = require("./helpers/open-in-app");
|
|
43
|
+
const recently_used_apps_1 = require("./helpers/recently-used-apps");
|
|
44
|
+
const maybe_open_browser_1 = require("./maybe-open-browser");
|
|
45
|
+
const live_events_1 = require("./preview-server/live-events");
|
|
46
|
+
const registerStudioShortcuts = ({ browserArgs, browserFlag, url, logLevel, remotionRoot, getDefaultEditor, getDefaultCodingAgent, }) => {
|
|
47
|
+
if (!process.stdin.isTTY) {
|
|
48
|
+
return { registered: false, cleanup: () => undefined };
|
|
49
|
+
}
|
|
50
|
+
if (typeof process.stdin.setRawMode !== 'function') {
|
|
51
|
+
return { registered: false, cleanup: () => undefined };
|
|
52
|
+
}
|
|
53
|
+
const wasRaw = process.stdin.isRaw;
|
|
54
|
+
const shouldPauseAfterCleanup = process.stdin.isPaused();
|
|
55
|
+
let cleanedUp = false;
|
|
56
|
+
let isOpeningBrowser = false;
|
|
57
|
+
let editor = null;
|
|
58
|
+
let codingAgent = null;
|
|
59
|
+
const openingApps = new Set();
|
|
60
|
+
let refreshRevision = 0;
|
|
61
|
+
let lastPrintedAssignment = null;
|
|
62
|
+
const refreshShortcuts = async () => {
|
|
63
|
+
var _a;
|
|
64
|
+
const revision = ++refreshRevision;
|
|
65
|
+
const configuredEditor = getDefaultEditor();
|
|
66
|
+
const configuredCodingAgent = getDefaultCodingAgent();
|
|
67
|
+
const [discovery, editorInfo, recentEditors, recentCodingAgents] = await Promise.all([
|
|
68
|
+
(0, app_discovery_1.getAppDiscovery)(),
|
|
69
|
+
(0, app_discovery_1.getEditorInfo)(configuredEditor),
|
|
70
|
+
(0, recently_used_apps_1.getRecentlyUsedApps)({
|
|
71
|
+
remotionRoot,
|
|
72
|
+
type: 'editor',
|
|
73
|
+
recentlyUsedIds: null,
|
|
74
|
+
}),
|
|
75
|
+
(0, recently_used_apps_1.getRecentlyUsedApps)({
|
|
76
|
+
remotionRoot,
|
|
77
|
+
type: 'coding-agent',
|
|
78
|
+
recentlyUsedIds: null,
|
|
79
|
+
}),
|
|
80
|
+
]);
|
|
81
|
+
if (cleanedUp || revision !== refreshRevision) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
editor = (0, studio_shared_1.getPreferredApp)({
|
|
85
|
+
installedApps: editorInfo.installedEditors,
|
|
86
|
+
configuredId: editorInfo.defaultEditor,
|
|
87
|
+
runningIds: (_a = editorInfo.runningEditors) !== null && _a !== void 0 ? _a : [],
|
|
88
|
+
recentlyUsedIds: recentEditors,
|
|
89
|
+
fallbackIds: studio_shared_1.preferredFallbackEditorIds,
|
|
90
|
+
});
|
|
91
|
+
codingAgent = (0, studio_shared_1.getPreferredApp)({
|
|
92
|
+
installedApps: discovery.installedCodingAgents,
|
|
93
|
+
configuredId: configuredCodingAgent,
|
|
94
|
+
runningIds: discovery.runningCodingAgents,
|
|
95
|
+
recentlyUsedIds: recentCodingAgents,
|
|
96
|
+
fallbackIds: discovery.installedCodingAgents.map(({ id }) => id),
|
|
97
|
+
});
|
|
98
|
+
printShortcuts();
|
|
99
|
+
};
|
|
100
|
+
const printShortcuts = () => {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
if (cleanedUp) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const shortcuts = [
|
|
106
|
+
'[s] Open Studio',
|
|
107
|
+
...(codingAgent ? [`[a] Open agent (${codingAgent.name})`] : []),
|
|
108
|
+
...(editor
|
|
109
|
+
? [
|
|
110
|
+
`[e] Open editor (${editor.name === 'Code' ? 'VS Code' : editor.name})`,
|
|
111
|
+
]
|
|
112
|
+
: []),
|
|
113
|
+
];
|
|
114
|
+
const assignment = JSON.stringify([
|
|
115
|
+
(_a = editor === null || editor === void 0 ? void 0 : editor.id) !== null && _a !== void 0 ? _a : null,
|
|
116
|
+
(_b = codingAgent === null || codingAgent === void 0 ? void 0 : codingAgent.id) !== null && _b !== void 0 ? _b : null,
|
|
117
|
+
shortcuts,
|
|
118
|
+
(editor === null || editor === void 0 ? void 0 : editor.id) === 'custom' ? getDefaultEditor() : null,
|
|
119
|
+
]);
|
|
120
|
+
if (assignment === lastPrintedAssignment) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
lastPrintedAssignment = assignment;
|
|
124
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.gray(shortcuts.join(' ')));
|
|
125
|
+
};
|
|
126
|
+
const onPreferencesChange = () => {
|
|
127
|
+
if (cleanedUp) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
refreshShortcuts().catch((err) => {
|
|
131
|
+
renderer_1.RenderInternals.Log.verbose({ indent: false, logLevel }, 'Could not refresh Studio shortcuts:', err);
|
|
132
|
+
printShortcuts();
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
const unsubscribeHistory = (0, recently_used_apps_1.subscribeToRecentlyUsedApps)({
|
|
136
|
+
remotionRoot,
|
|
137
|
+
onChange: onPreferencesChange,
|
|
138
|
+
});
|
|
139
|
+
const unsubscribeConfig = (0, live_events_1.subscribeToConfigChanges)(onPreferencesChange);
|
|
140
|
+
const openApp = async (key) => {
|
|
141
|
+
if (openingApps.has(key) || cleanedUp) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
openingApps.add(key);
|
|
145
|
+
try {
|
|
146
|
+
const response = key === 'a' && codingAgent
|
|
147
|
+
? await (0, open_in_app_1.openInCodingAgent)({
|
|
148
|
+
input: { codingAgentId: codingAgent.id, prompt: null },
|
|
149
|
+
remotionRoot,
|
|
150
|
+
logLevel,
|
|
151
|
+
})
|
|
152
|
+
: key === 'e' && editor
|
|
153
|
+
? await (0, open_in_app_1.openInEditor)({
|
|
154
|
+
input: {
|
|
155
|
+
editorId: editor.id,
|
|
156
|
+
stack: {
|
|
157
|
+
originalFileName: remotionRoot,
|
|
158
|
+
originalLineNumber: 1,
|
|
159
|
+
originalColumnNumber: 1,
|
|
160
|
+
originalFunctionName: null,
|
|
161
|
+
originalScriptCode: null,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
remotionRoot,
|
|
165
|
+
logLevel,
|
|
166
|
+
getDefaultEditor,
|
|
167
|
+
})
|
|
168
|
+
: null;
|
|
169
|
+
if (response && !response.success) {
|
|
170
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Could not open ${key === 'a' ? codingAgent === null || codingAgent === void 0 ? void 0 : codingAgent.name : editor === null || editor === void 0 ? void 0 : editor.name}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, key === 'a' ? 'Could not open coding agent:' : 'Could not open editor:', err);
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
openingApps.delete(key);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const cleanup = () => {
|
|
181
|
+
if (cleanedUp) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
cleanedUp = true;
|
|
185
|
+
unsubscribeHistory();
|
|
186
|
+
unsubscribeConfig();
|
|
187
|
+
process.stdin.removeListener('keypress', onKeypress);
|
|
188
|
+
process.removeListener('SIGINT', cleanup);
|
|
189
|
+
process.removeListener('exit', cleanup);
|
|
190
|
+
if (!wasRaw && process.stdin.isTTY) {
|
|
191
|
+
process.stdin.setRawMode(false);
|
|
192
|
+
}
|
|
193
|
+
if (shouldPauseAfterCleanup) {
|
|
194
|
+
process.stdin.pause();
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const openStudio = async () => {
|
|
198
|
+
if (isOpeningBrowser) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
isOpeningBrowser = true;
|
|
202
|
+
(0, live_events_1.clearPrintPortMessageTimeout)();
|
|
203
|
+
try {
|
|
204
|
+
const didFocus = await (0, better_opn_1.focusBrowserTabByOrigin)({
|
|
205
|
+
url,
|
|
206
|
+
browserArgs,
|
|
207
|
+
browserFlag,
|
|
208
|
+
});
|
|
209
|
+
if (didFocus) {
|
|
210
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.blue(`Opened ${url} in browser`));
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
const result = await (0, maybe_open_browser_1.maybeOpenBrowser)({
|
|
214
|
+
browserArgs,
|
|
215
|
+
browserFlag,
|
|
216
|
+
shouldOpenBrowser: true,
|
|
217
|
+
url,
|
|
218
|
+
logLevel,
|
|
219
|
+
});
|
|
220
|
+
if (result.didOpenBrowser) {
|
|
221
|
+
renderer_1.RenderInternals.Log.info({ indent: false, logLevel }, renderer_1.RenderInternals.chalk.blue(`Opened ${url} in browser`));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, 'Could not open browser:', err);
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
isOpeningBrowser = false;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
function onKeypress(_str, key) {
|
|
232
|
+
if ((key === null || key === void 0 ? void 0 : key.ctrl) && key.name === 'c') {
|
|
233
|
+
cleanup();
|
|
234
|
+
process.kill(process.pid, 'SIGINT');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if ((key === null || key === void 0 ? void 0 : key.meta) || (key === null || key === void 0 ? void 0 : key.ctrl)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if ((key === null || key === void 0 ? void 0 : key.name) === 's') {
|
|
241
|
+
openStudio().catch(() => undefined);
|
|
242
|
+
}
|
|
243
|
+
else if ((key === null || key === void 0 ? void 0 : key.name) === 'a' || (key === null || key === void 0 ? void 0 : key.name) === 'e') {
|
|
244
|
+
openApp(key.name).catch(() => undefined);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
readline.emitKeypressEvents(process.stdin);
|
|
248
|
+
process.stdin.setRawMode(true);
|
|
249
|
+
process.stdin.resume();
|
|
250
|
+
process.stdin.on('keypress', onKeypress);
|
|
251
|
+
process.once('SIGINT', cleanup);
|
|
252
|
+
process.once('exit', cleanup);
|
|
253
|
+
// Discovery may finish after other startup logs; never await it here.
|
|
254
|
+
onPreferencesChange();
|
|
255
|
+
return { registered: true, cleanup };
|
|
256
|
+
};
|
|
257
|
+
exports.registerStudioShortcuts = registerStudioShortcuts;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/studio-server"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/studio-server",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.535",
|
|
7
7
|
"description": "Run a Remotion Studio with a server backend",
|
|
8
8
|
"main": "dist",
|
|
9
9
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@remotion/studio-protocol": "4.0.
|
|
26
|
+
"@remotion/studio-protocol": "4.0.535",
|
|
27
27
|
"@babel/types": "7.24.0",
|
|
28
28
|
"@babel/parser": "7.24.1",
|
|
29
29
|
"@svgr/core": "8.1.0",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"kiwi-schema": "0.5.0",
|
|
32
32
|
"semver": "7.5.3",
|
|
33
33
|
"zod": "4.5.4",
|
|
34
|
-
"remotion": "4.0.
|
|
34
|
+
"remotion": "4.0.535",
|
|
35
35
|
"recast": "0.23.21",
|
|
36
|
-
"@remotion/bundler": "4.0.
|
|
37
|
-
"@remotion/renderer": "4.0.
|
|
38
|
-
"@remotion/codemods": "4.0.
|
|
39
|
-
"@remotion/studio-shared": "4.0.
|
|
36
|
+
"@remotion/bundler": "4.0.535",
|
|
37
|
+
"@remotion/renderer": "4.0.535",
|
|
38
|
+
"@remotion/codemods": "4.0.535",
|
|
39
|
+
"@remotion/studio-shared": "4.0.535",
|
|
40
40
|
"memfs": "3.4.3",
|
|
41
41
|
"open": "8.4.2"
|
|
42
42
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"ast-types": "0.16.1",
|
|
45
45
|
"react": "19.2.3",
|
|
46
46
|
"@types/semver": "7.5.3",
|
|
47
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
47
|
+
"@remotion/eslint-config-internal": "4.0.535",
|
|
48
48
|
"eslint": "9.19.0",
|
|
49
49
|
"prettier": "3.8.1",
|
|
50
50
|
"@types/node": "20.12.14",
|