@remotion/studio-server 4.0.507 → 4.0.509
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/canvas-capture/generate-canvas-capture-composition.d.ts +14 -0
- package/dist/canvas-capture/generate-canvas-capture-composition.js +174 -0
- package/dist/codemods/delete-jsx-node.d.ts +4 -0
- package/dist/codemods/delete-jsx-node.js +8 -0
- package/dist/codemods/duplicate-composition.js +8 -6
- package/dist/codemods/duplicate-jsx-node.d.ts +2 -0
- package/dist/codemods/duplicate-jsx-node.js +8 -0
- package/dist/codemods/get-node-path-remappings.d.ts +16 -0
- package/dist/codemods/get-node-path-remappings.js +88 -0
- package/dist/codemods/recast-mods.js +13 -0
- package/dist/codemods/reorder-sequence.d.ts +2 -1
- package/dist/codemods/reorder-sequence.js +8 -0
- package/dist/codemods/split-jsx-sequence.d.ts +2 -0
- package/dist/codemods/split-jsx-sequence.js +8 -0
- package/dist/codemods/update-keyframes/update-keyframes.js +17 -10
- package/dist/file-watcher.d.ts +11 -1
- package/dist/file-watcher.js +16 -5
- package/dist/helpers/coding-agent-registry.d.ts +0 -1
- package/dist/helpers/coding-agent-registry.js +1 -5
- package/dist/helpers/finder-artwork.d.ts +1 -0
- package/dist/helpers/finder-artwork.js +4 -0
- package/dist/helpers/resolve-composition-component.d.ts +4 -1
- package/dist/helpers/resolve-composition-component.js +63 -69
- package/dist/helpers/terminal-artwork.d.ts +6 -0
- package/dist/helpers/terminal-artwork.js +14 -0
- package/dist/helpers/terminal-registry.d.ts +36 -0
- package/dist/helpers/terminal-registry.js +401 -0
- package/dist/index.d.ts +8 -2
- package/dist/preview-server/api-routes.js +2 -0
- package/dist/preview-server/live-events.d.ts +1 -0
- package/dist/preview-server/live-events.js +3 -1
- package/dist/preview-server/routes/add-effect-keyframe.js +7 -1
- package/dist/preview-server/routes/add-effect.js +7 -1
- package/dist/preview-server/routes/add-keyframes.js +10 -2
- package/dist/preview-server/routes/add-sequence-keyframe.js +7 -1
- package/dist/preview-server/routes/app-icon.d.ts +6 -0
- package/dist/preview-server/routes/app-icon.js +66 -0
- package/dist/preview-server/routes/apply-codemod.js +34 -5
- package/dist/preview-server/routes/apply-visual-control-change.js +7 -1
- package/dist/preview-server/routes/batch-update-keyframe-settings.js +10 -2
- package/dist/preview-server/routes/can-update-sequence-props.d.ts +1 -0
- package/dist/preview-server/routes/can-update-sequence-props.js +5 -4
- package/dist/preview-server/routes/default-coding-agent.js +4 -2
- package/dist/preview-server/routes/delete-effect.js +7 -1
- package/dist/preview-server/routes/delete-jsx-node.js +16 -2
- package/dist/preview-server/routes/delete-keyframes.js +10 -2
- package/dist/preview-server/routes/duplicate-effect.js +7 -1
- package/dist/preview-server/routes/duplicate-jsx-node.js +17 -5
- package/dist/preview-server/routes/insert-element.js +23 -3
- package/dist/preview-server/routes/insert-jsx-element.js +23 -2
- package/dist/preview-server/routes/move-keyframes.js +10 -2
- package/dist/preview-server/routes/open-in-terminal.d.ts +3 -0
- package/dist/preview-server/routes/open-in-terminal.js +17 -0
- package/dist/preview-server/routes/paste-effects.js +7 -1
- package/dist/preview-server/routes/reorder-effect.js +7 -1
- package/dist/preview-server/routes/reorder-sequence.js +17 -2
- package/dist/preview-server/routes/save-effect-props.js +7 -1
- package/dist/preview-server/routes/save-multiple-effect-props.js +10 -2
- package/dist/preview-server/routes/save-sequence-props.js +29 -5
- package/dist/preview-server/routes/split-jsx-sequence.js +17 -6
- package/dist/preview-server/routes/update-config.js +6 -1
- package/dist/preview-server/routes/update-default-props.js +7 -1
- package/dist/preview-server/routes/update-effect-keyframe-settings.js +7 -1
- package/dist/preview-server/routes/update-sequence-keyframe-settings.js +7 -1
- package/dist/preview-server/sequence-node-path-mutation.d.ts +7 -0
- package/dist/preview-server/sequence-node-path-mutation.js +21 -0
- package/dist/preview-server/sequence-props-watchers.js +15 -6
- package/dist/preview-server/start-server.d.ts +1 -0
- package/dist/preview-server/start-server.js +1 -0
- package/dist/preview-server/undo-stack.d.ts +7 -13
- package/dist/preview-server/undo-stack.js +58 -5
- package/dist/routes.d.ts +2 -1
- package/dist/routes.js +12 -2
- package/dist/start-studio.d.ts +2 -1
- package/dist/start-studio.js +2 -1
- package/package.json +8 -8
|
@@ -0,0 +1,401 @@
|
|
|
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.launchTerminal = exports.getTerminalLaunchInstruction = exports.getAvailableTerminals = exports.discoverAvailableTerminals = void 0;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_os_1 = require("node:os");
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_util_1 = require("node:util");
|
|
12
|
+
const open = require("open");
|
|
13
|
+
const execFilePromise = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
14
|
+
const getWindowsEnvironmentPaths = (context, segments) => {
|
|
15
|
+
const paths = [];
|
|
16
|
+
for (const directory of [
|
|
17
|
+
context.env.LOCALAPPDATA,
|
|
18
|
+
context.env.ProgramFiles,
|
|
19
|
+
context.env['ProgramFiles(x86)'],
|
|
20
|
+
]) {
|
|
21
|
+
if (directory) {
|
|
22
|
+
paths.push(node_path_1.default.win32.join(directory, ...segments));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return paths;
|
|
26
|
+
};
|
|
27
|
+
const getLinuxCommandPaths = (context, command) => [
|
|
28
|
+
node_path_1.default.posix.join('/usr/local/bin', command),
|
|
29
|
+
node_path_1.default.posix.join('/usr/bin', command),
|
|
30
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/bin', command),
|
|
31
|
+
];
|
|
32
|
+
const terminalDefinitions = {
|
|
33
|
+
terminal: {
|
|
34
|
+
name: 'Terminal',
|
|
35
|
+
darwin: {
|
|
36
|
+
bundleIdentifiers: ['com.apple.Terminal'],
|
|
37
|
+
applicationNames: ['Terminal.app'],
|
|
38
|
+
},
|
|
39
|
+
linux: null,
|
|
40
|
+
win32: null,
|
|
41
|
+
},
|
|
42
|
+
iterm2: {
|
|
43
|
+
name: 'iTerm2',
|
|
44
|
+
darwin: {
|
|
45
|
+
bundleIdentifiers: ['com.googlecode.iterm2'],
|
|
46
|
+
applicationNames: ['iTerm.app'],
|
|
47
|
+
},
|
|
48
|
+
linux: null,
|
|
49
|
+
win32: null,
|
|
50
|
+
},
|
|
51
|
+
ghostty: {
|
|
52
|
+
name: 'Ghostty',
|
|
53
|
+
darwin: {
|
|
54
|
+
bundleIdentifiers: ['com.mitchellh.ghostty'],
|
|
55
|
+
applicationNames: ['Ghostty.app'],
|
|
56
|
+
},
|
|
57
|
+
linux: {
|
|
58
|
+
paths: (context) => getLinuxCommandPaths(context, 'ghostty'),
|
|
59
|
+
commands: ['ghostty'],
|
|
60
|
+
},
|
|
61
|
+
win32: null,
|
|
62
|
+
},
|
|
63
|
+
warp: {
|
|
64
|
+
name: 'Warp',
|
|
65
|
+
darwin: {
|
|
66
|
+
bundleIdentifiers: ['dev.warp.Warp-Stable'],
|
|
67
|
+
applicationNames: ['Warp.app'],
|
|
68
|
+
},
|
|
69
|
+
linux: {
|
|
70
|
+
paths: (context) => getLinuxCommandPaths(context, 'warp-terminal'),
|
|
71
|
+
commands: ['warp-terminal'],
|
|
72
|
+
},
|
|
73
|
+
win32: {
|
|
74
|
+
paths: (context) => context.env.LOCALAPPDATA
|
|
75
|
+
? [
|
|
76
|
+
node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'Programs', 'Warp', 'Warp.exe'),
|
|
77
|
+
]
|
|
78
|
+
: [],
|
|
79
|
+
commands: ['Warp.exe'],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
wezterm: {
|
|
83
|
+
name: 'WezTerm',
|
|
84
|
+
darwin: {
|
|
85
|
+
bundleIdentifiers: ['com.github.wez.wezterm'],
|
|
86
|
+
applicationNames: ['WezTerm.app'],
|
|
87
|
+
},
|
|
88
|
+
linux: {
|
|
89
|
+
paths: (context) => getLinuxCommandPaths(context, 'wezterm'),
|
|
90
|
+
commands: ['wezterm'],
|
|
91
|
+
},
|
|
92
|
+
win32: {
|
|
93
|
+
paths: (context) => [
|
|
94
|
+
...getWindowsEnvironmentPaths(context, ['WezTerm', 'wezterm-gui.exe']),
|
|
95
|
+
],
|
|
96
|
+
commands: ['wezterm-gui.exe', 'wezterm.exe'],
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
alacritty: {
|
|
100
|
+
name: 'Alacritty',
|
|
101
|
+
darwin: {
|
|
102
|
+
bundleIdentifiers: ['org.alacritty'],
|
|
103
|
+
applicationNames: ['Alacritty.app'],
|
|
104
|
+
},
|
|
105
|
+
linux: {
|
|
106
|
+
paths: (context) => getLinuxCommandPaths(context, 'alacritty'),
|
|
107
|
+
commands: ['alacritty'],
|
|
108
|
+
},
|
|
109
|
+
win32: {
|
|
110
|
+
paths: (context) => getWindowsEnvironmentPaths(context, ['Alacritty', 'alacritty.exe']),
|
|
111
|
+
commands: ['alacritty.exe'],
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
'windows-terminal': {
|
|
115
|
+
name: 'Windows Terminal',
|
|
116
|
+
darwin: null,
|
|
117
|
+
linux: null,
|
|
118
|
+
win32: {
|
|
119
|
+
paths: (context) => context.env.LOCALAPPDATA
|
|
120
|
+
? [
|
|
121
|
+
node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'Microsoft', 'WindowsApps', 'wt.exe'),
|
|
122
|
+
]
|
|
123
|
+
: [],
|
|
124
|
+
commands: ['wt.exe'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
'gnome-terminal': {
|
|
128
|
+
name: 'GNOME Terminal',
|
|
129
|
+
darwin: null,
|
|
130
|
+
linux: {
|
|
131
|
+
paths: (context) => getLinuxCommandPaths(context, 'gnome-terminal'),
|
|
132
|
+
commands: ['gnome-terminal'],
|
|
133
|
+
},
|
|
134
|
+
win32: null,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
const findMacApplications = async (bundleIdentifier) => {
|
|
138
|
+
try {
|
|
139
|
+
const { stdout } = await execFilePromise('mdfind', [
|
|
140
|
+
`kMDItemCFBundleIdentifier == '${bundleIdentifier}'`,
|
|
141
|
+
]);
|
|
142
|
+
return stdout
|
|
143
|
+
.split('\n')
|
|
144
|
+
.map((line) => line.trim())
|
|
145
|
+
.filter(Boolean);
|
|
146
|
+
}
|
|
147
|
+
catch (_a) {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const defaultDiscoveryContext = {
|
|
152
|
+
platform: process.platform,
|
|
153
|
+
env: process.env,
|
|
154
|
+
homeDirectory: (0, node_os_1.homedir)(),
|
|
155
|
+
pathExists: node_fs_1.existsSync,
|
|
156
|
+
findMacApplications,
|
|
157
|
+
};
|
|
158
|
+
const getPathDirectories = (context) => {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
const value = (_b = (_a = context.env.PATH) !== null && _a !== void 0 ? _a : context.env.Path) !== null && _b !== void 0 ? _b : '';
|
|
161
|
+
return value.split(context.platform === 'win32' ? ';' : ':').filter(Boolean);
|
|
162
|
+
};
|
|
163
|
+
const findExecutable = ({ paths, commands, context, }) => {
|
|
164
|
+
for (const executablePath of paths) {
|
|
165
|
+
if (context.pathExists(executablePath)) {
|
|
166
|
+
return executablePath;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const pathImplementation = context.platform === 'win32' ? node_path_1.default.win32 : node_path_1.default.posix;
|
|
170
|
+
for (const directory of getPathDirectories(context)) {
|
|
171
|
+
for (const command of commands) {
|
|
172
|
+
const executablePath = pathImplementation.join(directory, command);
|
|
173
|
+
if (context.pathExists(executablePath)) {
|
|
174
|
+
return executablePath;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return null;
|
|
179
|
+
};
|
|
180
|
+
const discoverAvailableTerminals = async (context) => {
|
|
181
|
+
if (context.platform !== 'darwin' &&
|
|
182
|
+
context.platform !== 'linux' &&
|
|
183
|
+
context.platform !== 'win32') {
|
|
184
|
+
return [];
|
|
185
|
+
}
|
|
186
|
+
const installedTerminals = [];
|
|
187
|
+
for (const [id, definition] of Object.entries(terminalDefinitions)) {
|
|
188
|
+
const platformDefinition = definition[context.platform];
|
|
189
|
+
if (platformDefinition === null) {
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
if (context.platform === 'darwin') {
|
|
193
|
+
const darwinDefinition = definition.darwin;
|
|
194
|
+
if (darwinDefinition === null) {
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
const discoveredApplications = (await Promise.all(darwinDefinition.bundleIdentifiers.map((bundleIdentifier) => context.findMacApplications(bundleIdentifier)))).flat();
|
|
198
|
+
const knownApplications = darwinDefinition.applicationNames.flatMap((name) => [
|
|
199
|
+
node_path_1.default.posix.join('/Applications', name),
|
|
200
|
+
node_path_1.default.posix.join(context.homeDirectory, 'Applications', name),
|
|
201
|
+
]);
|
|
202
|
+
const macApplicationPath = [
|
|
203
|
+
...new Set([...discoveredApplications, ...knownApplications]),
|
|
204
|
+
].find(context.pathExists);
|
|
205
|
+
if (macApplicationPath) {
|
|
206
|
+
installedTerminals.push({
|
|
207
|
+
applicationPath: macApplicationPath,
|
|
208
|
+
id,
|
|
209
|
+
name: definition.name,
|
|
210
|
+
platform: context.platform,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const executableDefinition = definition[context.platform];
|
|
216
|
+
if (executableDefinition === null) {
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
const applicationPath = findExecutable({
|
|
220
|
+
paths: typeof executableDefinition.paths === 'function'
|
|
221
|
+
? executableDefinition.paths(context)
|
|
222
|
+
: executableDefinition.paths,
|
|
223
|
+
commands: executableDefinition.commands,
|
|
224
|
+
context,
|
|
225
|
+
});
|
|
226
|
+
if (applicationPath) {
|
|
227
|
+
installedTerminals.push({
|
|
228
|
+
applicationPath,
|
|
229
|
+
id,
|
|
230
|
+
name: definition.name,
|
|
231
|
+
platform: context.platform,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return installedTerminals;
|
|
236
|
+
};
|
|
237
|
+
exports.discoverAvailableTerminals = discoverAvailableTerminals;
|
|
238
|
+
let availableTerminals = null;
|
|
239
|
+
const getAvailableTerminals = () => {
|
|
240
|
+
availableTerminals !== null && availableTerminals !== void 0 ? availableTerminals : (availableTerminals = (0, exports.discoverAvailableTerminals)(defaultDiscoveryContext));
|
|
241
|
+
return availableTerminals;
|
|
242
|
+
};
|
|
243
|
+
exports.getAvailableTerminals = getAvailableTerminals;
|
|
244
|
+
const getTerminalLaunchInstruction = ({ terminal, directory, }) => {
|
|
245
|
+
if (terminal.id === 'warp') {
|
|
246
|
+
const url = new URL('warp://action/new_window');
|
|
247
|
+
url.searchParams.set('path', directory);
|
|
248
|
+
return { type: 'url', url: url.href };
|
|
249
|
+
}
|
|
250
|
+
if (terminal.platform === 'darwin') {
|
|
251
|
+
switch (terminal.id) {
|
|
252
|
+
case 'terminal':
|
|
253
|
+
case 'iterm2':
|
|
254
|
+
return {
|
|
255
|
+
type: 'command',
|
|
256
|
+
command: 'open',
|
|
257
|
+
args: ['-a', terminal.applicationPath, directory],
|
|
258
|
+
cwd: directory,
|
|
259
|
+
};
|
|
260
|
+
case 'ghostty':
|
|
261
|
+
return {
|
|
262
|
+
type: 'command',
|
|
263
|
+
command: 'open',
|
|
264
|
+
args: [
|
|
265
|
+
'-na',
|
|
266
|
+
terminal.applicationPath,
|
|
267
|
+
'--args',
|
|
268
|
+
`--working-directory=${directory}`,
|
|
269
|
+
],
|
|
270
|
+
cwd: directory,
|
|
271
|
+
};
|
|
272
|
+
case 'wezterm':
|
|
273
|
+
return {
|
|
274
|
+
type: 'command',
|
|
275
|
+
command: node_path_1.default.posix.join(terminal.applicationPath, 'Contents/MacOS/wezterm'),
|
|
276
|
+
args: ['start', '--cwd', directory],
|
|
277
|
+
cwd: directory,
|
|
278
|
+
};
|
|
279
|
+
case 'alacritty':
|
|
280
|
+
return {
|
|
281
|
+
type: 'command',
|
|
282
|
+
command: node_path_1.default.posix.join(terminal.applicationPath, 'Contents/MacOS/alacritty'),
|
|
283
|
+
args: ['--working-directory', directory],
|
|
284
|
+
cwd: directory,
|
|
285
|
+
};
|
|
286
|
+
case 'windows-terminal':
|
|
287
|
+
case 'gnome-terminal':
|
|
288
|
+
throw new Error(`${terminal.name} is not supported on macOS.`);
|
|
289
|
+
default: {
|
|
290
|
+
const invalidTerminal = terminal.id;
|
|
291
|
+
throw new Error(`Unknown terminal: ${invalidTerminal}`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (terminal.platform === 'win32') {
|
|
296
|
+
switch (terminal.id) {
|
|
297
|
+
case 'windows-terminal':
|
|
298
|
+
return {
|
|
299
|
+
type: 'command',
|
|
300
|
+
command: terminal.applicationPath,
|
|
301
|
+
args: ['-d', directory],
|
|
302
|
+
cwd: directory,
|
|
303
|
+
};
|
|
304
|
+
case 'wezterm':
|
|
305
|
+
return {
|
|
306
|
+
type: 'command',
|
|
307
|
+
command: terminal.applicationPath,
|
|
308
|
+
args: ['start', '--cwd', directory],
|
|
309
|
+
cwd: directory,
|
|
310
|
+
};
|
|
311
|
+
case 'alacritty':
|
|
312
|
+
return {
|
|
313
|
+
type: 'command',
|
|
314
|
+
command: terminal.applicationPath,
|
|
315
|
+
args: ['--working-directory', directory],
|
|
316
|
+
cwd: directory,
|
|
317
|
+
};
|
|
318
|
+
case 'terminal':
|
|
319
|
+
case 'iterm2':
|
|
320
|
+
case 'ghostty':
|
|
321
|
+
case 'gnome-terminal':
|
|
322
|
+
throw new Error(`${terminal.name} is not supported on Windows.`);
|
|
323
|
+
default: {
|
|
324
|
+
const invalidTerminal = terminal.id;
|
|
325
|
+
throw new Error(`Unknown terminal: ${invalidTerminal}`);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
switch (terminal.id) {
|
|
330
|
+
case 'ghostty':
|
|
331
|
+
return {
|
|
332
|
+
type: 'command',
|
|
333
|
+
command: terminal.applicationPath,
|
|
334
|
+
args: [`--working-directory=${directory}`],
|
|
335
|
+
cwd: directory,
|
|
336
|
+
};
|
|
337
|
+
case 'wezterm':
|
|
338
|
+
return {
|
|
339
|
+
type: 'command',
|
|
340
|
+
command: terminal.applicationPath,
|
|
341
|
+
args: ['start', '--cwd', directory],
|
|
342
|
+
cwd: directory,
|
|
343
|
+
};
|
|
344
|
+
case 'alacritty':
|
|
345
|
+
return {
|
|
346
|
+
type: 'command',
|
|
347
|
+
command: terminal.applicationPath,
|
|
348
|
+
args: ['--working-directory', directory],
|
|
349
|
+
cwd: directory,
|
|
350
|
+
};
|
|
351
|
+
case 'gnome-terminal':
|
|
352
|
+
return {
|
|
353
|
+
type: 'command',
|
|
354
|
+
command: terminal.applicationPath,
|
|
355
|
+
args: [`--working-directory=${directory}`],
|
|
356
|
+
cwd: directory,
|
|
357
|
+
};
|
|
358
|
+
case 'terminal':
|
|
359
|
+
case 'iterm2':
|
|
360
|
+
case 'windows-terminal':
|
|
361
|
+
throw new Error(`${terminal.name} is not supported on Linux.`);
|
|
362
|
+
default: {
|
|
363
|
+
const invalidTerminal = terminal.id;
|
|
364
|
+
throw new Error(`Unknown terminal: ${invalidTerminal}`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
exports.getTerminalLaunchInstruction = getTerminalLaunchInstruction;
|
|
369
|
+
const launchTerminal = async ({ terminal, directory, allowedDirectory, }) => {
|
|
370
|
+
const resolvedAllowedDirectory = node_path_1.default.resolve(allowedDirectory);
|
|
371
|
+
const resolvedDirectory = node_path_1.default.resolve(resolvedAllowedDirectory, directory);
|
|
372
|
+
const relativePath = node_path_1.default.relative(resolvedAllowedDirectory, resolvedDirectory);
|
|
373
|
+
if (relativePath.startsWith('..') || node_path_1.default.isAbsolute(relativePath)) {
|
|
374
|
+
throw new Error(`Not allowed to open ${relativePath}`);
|
|
375
|
+
}
|
|
376
|
+
if (!(0, node_fs_1.statSync)(resolvedDirectory).isDirectory()) {
|
|
377
|
+
throw new Error('Only folders can be opened in a terminal.');
|
|
378
|
+
}
|
|
379
|
+
const instruction = (0, exports.getTerminalLaunchInstruction)({
|
|
380
|
+
terminal,
|
|
381
|
+
directory: resolvedDirectory,
|
|
382
|
+
});
|
|
383
|
+
if (instruction.type === 'url') {
|
|
384
|
+
await open(instruction.url);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const { command, args, cwd } = instruction;
|
|
388
|
+
await new Promise((resolve, reject) => {
|
|
389
|
+
const child = (0, node_child_process_1.spawn)(command, args, {
|
|
390
|
+
cwd,
|
|
391
|
+
detached: true,
|
|
392
|
+
stdio: 'ignore',
|
|
393
|
+
});
|
|
394
|
+
child.once('error', reject);
|
|
395
|
+
child.once('spawn', () => {
|
|
396
|
+
child.unref();
|
|
397
|
+
resolve();
|
|
398
|
+
});
|
|
399
|
+
});
|
|
400
|
+
};
|
|
401
|
+
exports.launchTerminal = launchTerminal;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { RemotionSkillsScope, RemotionSkillsStatus, } from './detect-outdat
|
|
|
7
7
|
export type { RemotionSkillName } from './remotion-skill-names';
|
|
8
8
|
export { detectOutdatedRemotionSkills, parseRemotionSkillVersion, remotionSkillNames, };
|
|
9
9
|
export declare const StudioServerInternals: {
|
|
10
|
-
startStudio: ({ browserArgs, browserFlag, shouldOpenBrowser, fullEntryPath, logLevel, getCurrentInputProps, getEnvVariables, desiredPort, remotionRoot, relativePublicDir, bundlerOverride, rspackOverride, webpackOverride, poll, getRenderDefaults, getRenderQueue, getNumberOfAudioTags, queueMethods, previewEntry, gitSource, binariesDirectory, forceIPv4, getAudioLatencyHint, getPreviewSampleRate, enableCrossSiteIsolation, forceNew, rspack, getStudioRuntimeConfig, getDefaultCodingAgent, getDefaultEditor, configFile, }: {
|
|
10
|
+
startStudio: ({ 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, }: {
|
|
11
11
|
browserArgs: string;
|
|
12
12
|
browserFlag: string;
|
|
13
13
|
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
@@ -26,6 +26,7 @@ export declare const StudioServerInternals: {
|
|
|
26
26
|
getRenderQueue: () => import("@remotion/studio-shared").RenderJob[];
|
|
27
27
|
getNumberOfAudioTags: () => number;
|
|
28
28
|
getAudioLatencyHint: () => AudioContextLatencyCategory | null;
|
|
29
|
+
getExperimentalKeepAudioContextAlive: () => boolean;
|
|
29
30
|
getPreviewSampleRate: () => number | null;
|
|
30
31
|
enableCrossSiteIsolation: boolean;
|
|
31
32
|
queueMethods: import("./preview-server/api-types").QueueMethods;
|
|
@@ -71,7 +72,12 @@ export declare const StudioServerInternals: {
|
|
|
71
72
|
exists: boolean;
|
|
72
73
|
unwatch: () => void;
|
|
73
74
|
};
|
|
74
|
-
writeFileAndNotifyFileWatchers: (
|
|
75
|
+
writeFileAndNotifyFileWatchers: (options: {
|
|
76
|
+
file: string;
|
|
77
|
+
content: string;
|
|
78
|
+
originatorClientId: string | undefined;
|
|
79
|
+
metadata: import("./file-watcher").FileChangeMetadata | null;
|
|
80
|
+
}) => void;
|
|
75
81
|
createFileWatcherRegistry: () => import("./file-watcher").FileWatcherRegistry;
|
|
76
82
|
setFileWatcherRegistry: (registry: import("./file-watcher").FileWatcherRegistry) => () => void;
|
|
77
83
|
AnsiDiff: typeof AnsiDiff;
|
|
@@ -30,6 +30,7 @@ const log_studio_error_1 = require("./routes/log-studio-error");
|
|
|
30
30
|
const move_keyframes_1 = require("./routes/move-keyframes");
|
|
31
31
|
const open_in_editor_1 = require("./routes/open-in-editor");
|
|
32
32
|
const open_in_file_explorer_1 = require("./routes/open-in-file-explorer");
|
|
33
|
+
const open_in_terminal_1 = require("./routes/open-in-terminal");
|
|
33
34
|
const paste_effects_1 = require("./routes/paste-effects");
|
|
34
35
|
const prepare_element_install_1 = require("./routes/prepare-element-install");
|
|
35
36
|
const project_info_1 = require("./routes/project-info");
|
|
@@ -69,6 +70,7 @@ exports.allApiRoutes = {
|
|
|
69
70
|
'/api/remove-render': remove_render_1.handleRemoveRender,
|
|
70
71
|
'/api/find-in-file': find_in_file_1.findInFileHandler,
|
|
71
72
|
'/api/open-in-file-explorer': open_in_file_explorer_1.handleOpenInFileExplorer,
|
|
73
|
+
'/api/open-in-terminal': open_in_terminal_1.openInTerminalHandler,
|
|
72
74
|
'/api/open-in-editor': open_in_editor_1.openInEditorHandler,
|
|
73
75
|
'/api/open-in-coding-agent': default_coding_agent_1.openInCodingAgentHandler,
|
|
74
76
|
'/api/register-client-render': register_client_render_1.registerClientRenderHandler,
|
|
@@ -14,4 +14,5 @@ export type InitialUndoRedoState = {
|
|
|
14
14
|
};
|
|
15
15
|
export declare const makeLiveEventsRouter: (logLevel: "error" | "info" | "trace" | "verbose" | "warn", getInitialUndoRedoState: () => InitialUndoRedoState) => LiveEventsServer;
|
|
16
16
|
export declare const waitForLiveEventsListener: () => Promise<LiveEventsServer>;
|
|
17
|
+
export declare const getLiveEventsListener: () => LiveEventsServer | null;
|
|
17
18
|
export declare const setLiveEventsListener: (listener: LiveEventsServer) => () => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = void 0;
|
|
3
|
+
exports.setLiveEventsListener = exports.getLiveEventsListener = exports.waitForLiveEventsListener = exports.makeLiveEventsRouter = exports.clearPrintPortMessageTimeout = 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");
|
|
@@ -105,6 +105,8 @@ const waitForLiveEventsListener = () => {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
exports.waitForLiveEventsListener = waitForLiveEventsListener;
|
|
108
|
+
const getLiveEventsListener = () => liveEventsListener;
|
|
109
|
+
exports.getLiveEventsListener = getLiveEventsListener;
|
|
108
110
|
const setLiveEventsListener = (listener) => {
|
|
109
111
|
liveEventsListener = listener;
|
|
110
112
|
waiters.forEach((w) => w(listener));
|
|
@@ -58,10 +58,16 @@ const addEffectKeyframeHandler = ({ input: { fileName, sequenceNodePath, effectI
|
|
|
58
58
|
},
|
|
59
59
|
entryType: 'effect-props',
|
|
60
60
|
suppressHmrOnFileRestore: true,
|
|
61
|
+
nodePathRemappings: null,
|
|
61
62
|
});
|
|
62
63
|
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
63
64
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
64
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(
|
|
65
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
66
|
+
file: absolutePath,
|
|
67
|
+
content: output,
|
|
68
|
+
originatorClientId: clientId,
|
|
69
|
+
metadata: null,
|
|
70
|
+
});
|
|
65
71
|
(0, log_effect_update_1.logEffectUpdate)({
|
|
66
72
|
fileRelativeToRoot,
|
|
67
73
|
line: logLine,
|
|
@@ -41,9 +41,15 @@ const addEffectHandler = ({ input: { fileName, sequenceNodePath, effectName, eff
|
|
|
41
41
|
},
|
|
42
42
|
entryType: 'add-effect',
|
|
43
43
|
suppressHmrOnFileRestore: false,
|
|
44
|
+
nodePathRemappings: null,
|
|
44
45
|
});
|
|
45
46
|
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
46
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(
|
|
47
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
48
|
+
file: absolutePath,
|
|
49
|
+
content: output,
|
|
50
|
+
originatorClientId: clientId,
|
|
51
|
+
metadata: null,
|
|
52
|
+
});
|
|
47
53
|
const locationLabel = (0, format_log_file_location_1.formatLogFileLocation)({
|
|
48
54
|
remotionRoot,
|
|
49
55
|
absolutePath,
|
|
@@ -164,7 +164,10 @@ const addKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, remo
|
|
|
164
164
|
throw new Error('No keyframes were specified for adding');
|
|
165
165
|
}
|
|
166
166
|
(0, undo_stack_1.pushTransactionToUndoStack)({
|
|
167
|
-
snapshots
|
|
167
|
+
snapshots: snapshots.map((snapshot) => ({
|
|
168
|
+
...snapshot,
|
|
169
|
+
nodePathRemappings: null,
|
|
170
|
+
})),
|
|
168
171
|
logLevel,
|
|
169
172
|
remotionRoot,
|
|
170
173
|
description: getBatchDescription({ totalKeyframes, firstKeyframe }),
|
|
@@ -180,7 +183,12 @@ const addKeyframes = async ({ sequenceKeyframes, effectKeyframes, clientId, remo
|
|
|
180
183
|
for (const snapshot of snapshots) {
|
|
181
184
|
(0, undo_stack_1.suppressUndoStackInvalidation)(snapshot.filePath);
|
|
182
185
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(snapshot.filePath);
|
|
183
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(
|
|
186
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
187
|
+
file: snapshot.filePath,
|
|
188
|
+
content: snapshot.newContents,
|
|
189
|
+
originatorClientId: clientId,
|
|
190
|
+
metadata: null,
|
|
191
|
+
});
|
|
184
192
|
}
|
|
185
193
|
for (const log of sequenceLogs) {
|
|
186
194
|
(0, log_update_1.logUpdate)({
|
|
@@ -54,10 +54,16 @@ const addSequenceKeyframeHandler = ({ input: { fileName, nodePath, key, frame, v
|
|
|
54
54
|
},
|
|
55
55
|
entryType: 'sequence-props',
|
|
56
56
|
suppressHmrOnFileRestore: true,
|
|
57
|
+
nodePathRemappings: null,
|
|
57
58
|
});
|
|
58
59
|
(0, undo_stack_1.suppressUndoStackInvalidation)(absolutePath);
|
|
59
60
|
(0, watch_ignore_next_change_1.suppressBundlerUpdateForFile)(absolutePath);
|
|
60
|
-
(0, file_watcher_1.writeFileAndNotifyFileWatchers)(
|
|
61
|
+
(0, file_watcher_1.writeFileAndNotifyFileWatchers)({
|
|
62
|
+
file: absolutePath,
|
|
63
|
+
content: output,
|
|
64
|
+
originatorClientId: clientId,
|
|
65
|
+
metadata: null,
|
|
66
|
+
});
|
|
61
67
|
(0, log_update_1.logUpdate)({
|
|
62
68
|
fileRelativeToRoot,
|
|
63
69
|
line: logLine,
|
|
@@ -0,0 +1,66 @@
|
|
|
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.handleAppIcon = void 0;
|
|
7
|
+
const node_buffer_1 = require("node:buffer");
|
|
8
|
+
const node_fs_1 = require("node:fs");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const renderer_1 = require("@remotion/renderer");
|
|
11
|
+
const finder_artwork_1 = require("../../helpers/finder-artwork");
|
|
12
|
+
const terminal_artwork_1 = require("../../helpers/terminal-artwork");
|
|
13
|
+
const validate_same_origin_1 = require("../validate-same-origin");
|
|
14
|
+
const respondWithNotFound = (response) => {
|
|
15
|
+
response.writeHead(404);
|
|
16
|
+
response.end('App icon not found.');
|
|
17
|
+
};
|
|
18
|
+
const handleAppIcon = ({ request, response, pathname, }) => {
|
|
19
|
+
if (request.method !== 'GET') {
|
|
20
|
+
response.writeHead(405, { Allow: 'GET' });
|
|
21
|
+
response.end('Method not allowed.');
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
(0, validate_same_origin_1.validateSameOrigin)(request);
|
|
25
|
+
const match = /^\/api\/app-icon\/(coding-agent|file-manager|terminal)\/([a-z0-9-]+)\.png$/.exec(pathname);
|
|
26
|
+
if (!match) {
|
|
27
|
+
respondWithNotFound(response);
|
|
28
|
+
return Promise.resolve();
|
|
29
|
+
}
|
|
30
|
+
const [, kind, id] = match;
|
|
31
|
+
if (kind === 'coding-agent') {
|
|
32
|
+
if (!renderer_1.defaultCodingAgentIds.includes(id)) {
|
|
33
|
+
respondWithNotFound(response);
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
const filePath = node_path_1.default.join(__dirname, '..', '..', '..', 'web', 'coding-agent-icons', `${id}.png`);
|
|
37
|
+
const stat = (0, node_fs_1.statSync)(filePath);
|
|
38
|
+
response.writeHead(200, {
|
|
39
|
+
'Cache-Control': 'public, max-age=3600',
|
|
40
|
+
'Content-Length': stat.size,
|
|
41
|
+
'Content-Type': 'image/png',
|
|
42
|
+
});
|
|
43
|
+
(0, node_fs_1.createReadStream)(filePath).pipe(response);
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
}
|
|
46
|
+
const dataUrl = kind === 'file-manager'
|
|
47
|
+
? id === 'finder'
|
|
48
|
+
? finder_artwork_1.finderArtworkDataUrl
|
|
49
|
+
: null
|
|
50
|
+
: Object.hasOwn(terminal_artwork_1.terminalArtworkDataUrls, id)
|
|
51
|
+
? terminal_artwork_1.terminalArtworkDataUrls[id]
|
|
52
|
+
: null;
|
|
53
|
+
if (dataUrl === null) {
|
|
54
|
+
respondWithNotFound(response);
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
}
|
|
57
|
+
const image = node_buffer_1.Buffer.from(dataUrl.slice(dataUrl.indexOf(',') + 1), 'base64');
|
|
58
|
+
response.writeHead(200, {
|
|
59
|
+
'Cache-Control': 'public, max-age=3600',
|
|
60
|
+
'Content-Length': image.length,
|
|
61
|
+
'Content-Type': 'image/png',
|
|
62
|
+
});
|
|
63
|
+
response.end(image);
|
|
64
|
+
return Promise.resolve();
|
|
65
|
+
};
|
|
66
|
+
exports.handleAppIcon = handleAppIcon;
|