@remotion/studio-server 4.0.502 → 4.0.504
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/detect-outdated-remotion-skills.d.ts +25 -0
- package/dist/detect-outdated-remotion-skills.js +73 -0
- package/dist/helpers/custom-editor.d.ts +37 -0
- package/dist/helpers/custom-editor.js +167 -0
- package/dist/helpers/editor-registry.d.ts +18 -0
- package/dist/helpers/editor-registry.js +500 -0
- package/dist/helpers/open-in-editor.d.ts +4 -4
- package/dist/helpers/open-in-editor.js +23 -87
- package/dist/helpers/resolve-editor.d.ts +27 -0
- package/dist/helpers/resolve-editor.js +90 -0
- package/dist/helpers/resolve-file-inside-project.d.ts +2 -0
- package/dist/helpers/resolve-file-inside-project.js +5 -2
- package/dist/index.d.ts +17 -1
- package/dist/index.js +9 -1
- package/dist/preview-server/api-routes.js +6 -1
- package/dist/preview-server/api-types.d.ts +2 -1
- package/dist/preview-server/element-install-state.d.ts +9 -2
- package/dist/preview-server/element-install-state.js +15 -5
- package/dist/preview-server/handler.d.ts +3 -1
- package/dist/preview-server/handler.js +2 -1
- package/dist/preview-server/routes/can-update-sequence-props.js +2 -1
- package/dist/preview-server/routes/default-editor.d.ts +8 -0
- package/dist/preview-server/routes/default-editor.js +131 -0
- package/dist/preview-server/routes/delete-effect-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-effect-keyframe.js +89 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.d.ts +3 -0
- package/dist/preview-server/routes/delete-sequence-keyframe.js +82 -0
- package/dist/preview-server/routes/element-install-plan.d.ts +33 -0
- package/dist/preview-server/routes/element-install-plan.js +122 -0
- package/dist/preview-server/routes/insert-element.d.ts +1 -1
- package/dist/preview-server/routes/insert-element.js +70 -107
- package/dist/preview-server/routes/install-dependency.d.ts +2 -1
- package/dist/preview-server/routes/install-dependency.js +33 -44
- package/dist/preview-server/routes/open-in-editor.d.ts +5 -1
- package/dist/preview-server/routes/open-in-editor.js +42 -12
- package/dist/preview-server/routes/prepare-element-install.d.ts +3 -0
- package/dist/preview-server/routes/prepare-element-install.js +25 -0
- package/dist/preview-server/routes/safe-element-install-path.d.ts +9 -0
- package/dist/preview-server/routes/safe-element-install-path.js +58 -0
- package/dist/preview-server/routes/save-props-mutex.d.ts +1 -0
- package/dist/preview-server/routes/save-props-mutex.js +11 -0
- package/dist/preview-server/routes/update-public-license.d.ts +4 -0
- package/dist/preview-server/routes/update-public-license.js +9 -5
- package/dist/preview-server/start-server.d.ts +2 -0
- package/dist/preview-server/start-server.js +1 -0
- package/dist/preview-server/studio-protocol/handle-discovery.js +57 -26
- package/dist/preview-server/studio-protocol/handle-install.js +13 -3
- package/dist/preview-server/studio-protocol/handle-license-key.d.ts +6 -0
- package/dist/preview-server/studio-protocol/handle-license-key.js +129 -0
- package/dist/preview-server/studio-protocol/origin-policy.d.ts +6 -3
- package/dist/preview-server/studio-protocol/origin-policy.js +43 -17
- package/dist/preview-server/update-available.d.ts +6 -0
- package/dist/preview-server/update-available.js +30 -4
- package/dist/remotion-skill-names.d.ts +2 -0
- package/dist/remotion-skill-names.js +16 -0
- package/dist/routes.d.ts +3 -1
- package/dist/routes.js +16 -5
- package/dist/start-studio.d.ts +3 -1
- package/dist/start-studio.js +2 -1
- package/package.json +8 -8
|
@@ -0,0 +1,500 @@
|
|
|
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.getAvailableEditors = exports.discoverAvailableEditors = exports.getDefaultEditorName = 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 renderer_1 = require("@remotion/renderer");
|
|
13
|
+
const execFilePromise = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
14
|
+
const getWindowsEnvironmentPaths = (context, segments) => {
|
|
15
|
+
const paths = [];
|
|
16
|
+
if (context.env.LOCALAPPDATA) {
|
|
17
|
+
paths.push(node_path_1.default.win32.join(context.env.LOCALAPPDATA, 'Programs', ...segments));
|
|
18
|
+
}
|
|
19
|
+
for (const directory of [
|
|
20
|
+
context.env.ProgramFiles,
|
|
21
|
+
context.env['ProgramFiles(x86)'],
|
|
22
|
+
]) {
|
|
23
|
+
if (directory) {
|
|
24
|
+
paths.push(node_path_1.default.win32.join(directory, ...segments));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return paths;
|
|
28
|
+
};
|
|
29
|
+
const editorDefinitions = {
|
|
30
|
+
vscode: {
|
|
31
|
+
darwin: [
|
|
32
|
+
{
|
|
33
|
+
name: 'VS Code',
|
|
34
|
+
bundleIdentifiers: ['com.microsoft.VSCode'],
|
|
35
|
+
applicationNames: ['Visual Studio Code.app'],
|
|
36
|
+
executable: 'Contents/Resources/app/bin/code',
|
|
37
|
+
command: 'code',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'VS Code Insiders',
|
|
41
|
+
bundleIdentifiers: ['com.microsoft.VSCodeInsiders'],
|
|
42
|
+
applicationNames: ['Visual Studio Code - Insiders.app'],
|
|
43
|
+
executable: 'Contents/Resources/app/bin/code-insiders',
|
|
44
|
+
command: 'code-insiders',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
linux: [
|
|
48
|
+
{
|
|
49
|
+
name: 'VS Code',
|
|
50
|
+
paths: () => [
|
|
51
|
+
'/usr/share/code/bin/code',
|
|
52
|
+
'/snap/bin/code',
|
|
53
|
+
'/usr/bin/code',
|
|
54
|
+
'/var/lib/flatpak/exports/bin/com.visualstudio.code',
|
|
55
|
+
],
|
|
56
|
+
commands: ['code'],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'VS Code Insiders',
|
|
60
|
+
paths: () => [
|
|
61
|
+
'/snap/bin/code-insiders',
|
|
62
|
+
'/usr/bin/code-insiders',
|
|
63
|
+
'/var/lib/flatpak/exports/bin/com.visualstudio.code.insiders',
|
|
64
|
+
],
|
|
65
|
+
commands: ['code-insiders'],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
win32: [
|
|
69
|
+
{
|
|
70
|
+
name: 'VS Code',
|
|
71
|
+
paths: (context) => getWindowsEnvironmentPaths(context, [
|
|
72
|
+
'Microsoft VS Code',
|
|
73
|
+
'Code.exe',
|
|
74
|
+
]),
|
|
75
|
+
commands: ['Code.exe', 'code.cmd'],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'VS Code Insiders',
|
|
79
|
+
paths: (context) => getWindowsEnvironmentPaths(context, [
|
|
80
|
+
'Microsoft VS Code Insiders',
|
|
81
|
+
'Code - Insiders.exe',
|
|
82
|
+
]),
|
|
83
|
+
commands: ['Code - Insiders.exe', 'code-insiders.cmd'],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
cursor: {
|
|
88
|
+
darwin: [
|
|
89
|
+
{
|
|
90
|
+
name: 'Cursor',
|
|
91
|
+
bundleIdentifiers: ['com.todesktop.230313mzl4w4u92'],
|
|
92
|
+
applicationNames: ['Cursor.app'],
|
|
93
|
+
executable: 'Contents/Resources/app/bin/cursor',
|
|
94
|
+
command: 'cursor',
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
linux: [
|
|
98
|
+
{
|
|
99
|
+
name: 'Cursor',
|
|
100
|
+
paths: (context) => [
|
|
101
|
+
'/usr/bin/cursor',
|
|
102
|
+
'/usr/local/bin/cursor',
|
|
103
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/bin/cursor'),
|
|
104
|
+
],
|
|
105
|
+
commands: ['cursor'],
|
|
106
|
+
},
|
|
107
|
+
],
|
|
108
|
+
win32: [
|
|
109
|
+
{
|
|
110
|
+
name: 'Cursor',
|
|
111
|
+
paths: (context) => getWindowsEnvironmentPaths(context, ['cursor', 'Cursor.exe']),
|
|
112
|
+
commands: ['Cursor.exe', 'cursor.cmd'],
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
windsurf: {
|
|
117
|
+
darwin: [
|
|
118
|
+
{
|
|
119
|
+
name: 'Windsurf',
|
|
120
|
+
bundleIdentifiers: ['com.exafunction.windsurf'],
|
|
121
|
+
applicationNames: ['Windsurf.app'],
|
|
122
|
+
executable: 'Contents/Resources/app/bin/windsurf',
|
|
123
|
+
command: 'windsurf',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
linux: [
|
|
127
|
+
{
|
|
128
|
+
name: 'Windsurf',
|
|
129
|
+
paths: (context) => [
|
|
130
|
+
'/usr/bin/windsurf',
|
|
131
|
+
'/usr/local/bin/windsurf',
|
|
132
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/bin/windsurf'),
|
|
133
|
+
],
|
|
134
|
+
commands: ['windsurf'],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
win32: [
|
|
138
|
+
{
|
|
139
|
+
name: 'Windsurf',
|
|
140
|
+
paths: (context) => getWindowsEnvironmentPaths(context, ['Windsurf', 'Windsurf.exe']),
|
|
141
|
+
commands: ['Windsurf.exe', 'windsurf.cmd'],
|
|
142
|
+
},
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
zed: {
|
|
146
|
+
darwin: [
|
|
147
|
+
{
|
|
148
|
+
name: 'Zed',
|
|
149
|
+
bundleIdentifiers: ['dev.zed.Zed'],
|
|
150
|
+
applicationNames: ['Zed.app'],
|
|
151
|
+
executable: 'Contents/MacOS/cli',
|
|
152
|
+
command: 'zed',
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: 'Zed Preview',
|
|
156
|
+
bundleIdentifiers: ['dev.zed.Zed-Preview'],
|
|
157
|
+
applicationNames: ['Zed Preview.app'],
|
|
158
|
+
executable: 'Contents/MacOS/cli',
|
|
159
|
+
command: 'zed',
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
linux: [
|
|
163
|
+
{
|
|
164
|
+
name: 'Zed',
|
|
165
|
+
paths: (context) => [
|
|
166
|
+
'/usr/bin/zedit',
|
|
167
|
+
'/usr/bin/zeditor',
|
|
168
|
+
'/usr/bin/zed-editor',
|
|
169
|
+
'/usr/bin/zed',
|
|
170
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/bin/zed'),
|
|
171
|
+
],
|
|
172
|
+
commands: ['zed', 'zedit', 'zeditor', 'zed-editor'],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
win32: [
|
|
176
|
+
{
|
|
177
|
+
name: 'Zed',
|
|
178
|
+
paths: (context) => getWindowsEnvironmentPaths(context, ['Zed', 'Zed.exe']),
|
|
179
|
+
commands: ['Zed.exe'],
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
vscodium: {
|
|
184
|
+
darwin: [
|
|
185
|
+
{
|
|
186
|
+
name: 'VSCodium',
|
|
187
|
+
bundleIdentifiers: ['com.vscodium', 'com.visualstudio.code.oss'],
|
|
188
|
+
applicationNames: ['VSCodium.app'],
|
|
189
|
+
executable: 'Contents/Resources/app/bin/codium',
|
|
190
|
+
command: 'vscodium',
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
linux: [
|
|
194
|
+
{
|
|
195
|
+
name: 'VSCodium',
|
|
196
|
+
paths: (context) => [
|
|
197
|
+
'/usr/bin/codium',
|
|
198
|
+
'/usr/share/vscodium-bin/bin/codium',
|
|
199
|
+
'/snap/bin/codium',
|
|
200
|
+
'/var/lib/flatpak/exports/bin/com.vscodium.codium',
|
|
201
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/share/flatpak/exports/bin/com.vscodium.codium'),
|
|
202
|
+
],
|
|
203
|
+
commands: ['codium', 'vscodium'],
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
win32: [
|
|
207
|
+
{
|
|
208
|
+
name: 'VSCodium',
|
|
209
|
+
paths: (context) => getWindowsEnvironmentPaths(context, ['VSCodium', 'VSCodium.exe']),
|
|
210
|
+
commands: ['VSCodium.exe', 'codium.cmd'],
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
214
|
+
webstorm: {
|
|
215
|
+
darwin: [
|
|
216
|
+
{
|
|
217
|
+
name: 'WebStorm',
|
|
218
|
+
bundleIdentifiers: ['com.jetbrains.WebStorm'],
|
|
219
|
+
applicationNames: ['WebStorm.app'],
|
|
220
|
+
executable: 'Contents/MacOS/webstorm',
|
|
221
|
+
command: 'webstorm',
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
linux: [
|
|
225
|
+
{
|
|
226
|
+
name: 'WebStorm',
|
|
227
|
+
paths: (context) => [
|
|
228
|
+
'/snap/bin/webstorm',
|
|
229
|
+
node_path_1.default.posix.join(context.homeDirectory, '.local/share/JetBrains/Toolbox/scripts/webstorm'),
|
|
230
|
+
],
|
|
231
|
+
commands: ['webstorm'],
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
win32: [
|
|
235
|
+
{
|
|
236
|
+
name: 'WebStorm',
|
|
237
|
+
paths: (context) => {
|
|
238
|
+
const localAppData = context.env.LOCALAPPDATA;
|
|
239
|
+
return localAppData
|
|
240
|
+
? [
|
|
241
|
+
node_path_1.default.win32.join(localAppData, 'JetBrains/Toolbox/scripts/webstorm.cmd'),
|
|
242
|
+
]
|
|
243
|
+
: [];
|
|
244
|
+
},
|
|
245
|
+
commands: ['webstorm64.exe', 'webstorm.exe', 'webstorm.cmd'],
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
},
|
|
249
|
+
'sublime-text': {
|
|
250
|
+
darwin: [
|
|
251
|
+
{
|
|
252
|
+
name: 'Sublime Text',
|
|
253
|
+
bundleIdentifiers: [
|
|
254
|
+
'com.sublimetext.4',
|
|
255
|
+
'com.sublimetext.3',
|
|
256
|
+
'com.sublimetext.2',
|
|
257
|
+
],
|
|
258
|
+
applicationNames: [
|
|
259
|
+
'Sublime Text.app',
|
|
260
|
+
'Sublime Text Dev.app',
|
|
261
|
+
'Sublime Text 2.app',
|
|
262
|
+
],
|
|
263
|
+
executable: 'Contents/SharedSupport/bin/subl',
|
|
264
|
+
command: 'subl',
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
linux: [
|
|
268
|
+
{
|
|
269
|
+
name: 'Sublime Text',
|
|
270
|
+
paths: () => ['/usr/bin/subl', '/snap/bin/subl'],
|
|
271
|
+
commands: ['subl'],
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
win32: [
|
|
275
|
+
{
|
|
276
|
+
name: 'Sublime Text',
|
|
277
|
+
paths: (context) => [
|
|
278
|
+
...getWindowsEnvironmentPaths(context, [
|
|
279
|
+
'Sublime Text',
|
|
280
|
+
'sublime_text.exe',
|
|
281
|
+
]),
|
|
282
|
+
...getWindowsEnvironmentPaths(context, [
|
|
283
|
+
'Sublime Text 3',
|
|
284
|
+
'sublime_text.exe',
|
|
285
|
+
]),
|
|
286
|
+
],
|
|
287
|
+
commands: ['subl.exe', 'sublime_text.exe'],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
const getDefaultEditorName = (id) => editorDefinitions[id].darwin[0].name;
|
|
293
|
+
exports.getDefaultEditorName = getDefaultEditorName;
|
|
294
|
+
const findMacApplications = async (bundleIdentifier) => {
|
|
295
|
+
try {
|
|
296
|
+
const { stdout } = await execFilePromise('mdfind', [
|
|
297
|
+
`kMDItemCFBundleIdentifier == '${bundleIdentifier}'`,
|
|
298
|
+
]);
|
|
299
|
+
return stdout
|
|
300
|
+
.split('\n')
|
|
301
|
+
.map((line) => line.trim())
|
|
302
|
+
.filter(Boolean);
|
|
303
|
+
}
|
|
304
|
+
catch (_a) {
|
|
305
|
+
return [];
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
const windowsDisplayNamePrefixes = {
|
|
309
|
+
vscode: ['Microsoft Visual Studio Code'],
|
|
310
|
+
cursor: ['Cursor'],
|
|
311
|
+
windsurf: ['Windsurf'],
|
|
312
|
+
zed: ['Zed'],
|
|
313
|
+
vscodium: ['VSCodium'],
|
|
314
|
+
webstorm: ['WebStorm', 'JetBrains WebStorm'],
|
|
315
|
+
'sublime-text': ['Sublime Text'],
|
|
316
|
+
};
|
|
317
|
+
const parseWindowsRegistryApplications = (output) => {
|
|
318
|
+
const applications = [];
|
|
319
|
+
let displayName = '';
|
|
320
|
+
let displayIcon = '';
|
|
321
|
+
const flush = () => {
|
|
322
|
+
if (displayName && displayIcon) {
|
|
323
|
+
applications.push({ displayIcon, displayName });
|
|
324
|
+
}
|
|
325
|
+
displayName = '';
|
|
326
|
+
displayIcon = '';
|
|
327
|
+
};
|
|
328
|
+
for (const line of output.split(/\r?\n/)) {
|
|
329
|
+
if (line.startsWith('HKEY_')) {
|
|
330
|
+
flush();
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
const match = /^\s+(DisplayName|DisplayIcon)\s+REG_\w+\s+(.*)$/.exec(line);
|
|
334
|
+
if (!match) {
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (match[1] === 'DisplayName') {
|
|
338
|
+
displayName = match[2].trim();
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
displayIcon = match[2].trim();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
flush();
|
|
345
|
+
return applications;
|
|
346
|
+
};
|
|
347
|
+
const cleanWindowsDisplayIcon = (displayIcon) => {
|
|
348
|
+
const quotedPath = /^"([^"]+)"/.exec(displayIcon);
|
|
349
|
+
if (quotedPath) {
|
|
350
|
+
return quotedPath[1];
|
|
351
|
+
}
|
|
352
|
+
return displayIcon.replace(/,\d+$/, '').trim();
|
|
353
|
+
};
|
|
354
|
+
let windowsRegistryApplications = null;
|
|
355
|
+
const getWindowsRegistryApplications = () => {
|
|
356
|
+
windowsRegistryApplications !== null && windowsRegistryApplications !== void 0 ? windowsRegistryApplications : (windowsRegistryApplications = Promise.all([
|
|
357
|
+
'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
358
|
+
'HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
359
|
+
'HKLM\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall',
|
|
360
|
+
].map(async (registryKey) => {
|
|
361
|
+
try {
|
|
362
|
+
const { stdout } = await execFilePromise('reg.exe', [
|
|
363
|
+
'query',
|
|
364
|
+
registryKey,
|
|
365
|
+
'/s',
|
|
366
|
+
]);
|
|
367
|
+
return parseWindowsRegistryApplications(stdout);
|
|
368
|
+
}
|
|
369
|
+
catch (_a) {
|
|
370
|
+
return [];
|
|
371
|
+
}
|
|
372
|
+
})).then((results) => results.flat()));
|
|
373
|
+
return windowsRegistryApplications;
|
|
374
|
+
};
|
|
375
|
+
const findWindowsApplications = async (editor) => {
|
|
376
|
+
const prefixes = windowsDisplayNamePrefixes[editor];
|
|
377
|
+
const applications = await getWindowsRegistryApplications();
|
|
378
|
+
return applications
|
|
379
|
+
.filter(({ displayName }) => prefixes.some((prefix) => displayName.startsWith(prefix)))
|
|
380
|
+
.map(({ displayIcon }) => cleanWindowsDisplayIcon(displayIcon));
|
|
381
|
+
};
|
|
382
|
+
const defaultDiscoveryContext = {
|
|
383
|
+
platform: process.platform,
|
|
384
|
+
env: process.env,
|
|
385
|
+
homeDirectory: (0, node_os_1.homedir)(),
|
|
386
|
+
pathExists: node_fs_1.existsSync,
|
|
387
|
+
findMacApplications,
|
|
388
|
+
findWindowsApplications,
|
|
389
|
+
};
|
|
390
|
+
const unique = (values) => [...new Set(values)];
|
|
391
|
+
const findDarwinEditor = async ({ id, variants, context, }) => {
|
|
392
|
+
for (const variant of variants) {
|
|
393
|
+
const discoveredApplications = (await Promise.all(variant.bundleIdentifiers.map((bundleIdentifier) => context.findMacApplications(bundleIdentifier)))).flat();
|
|
394
|
+
const knownApplications = variant.applicationNames.flatMap((name) => [
|
|
395
|
+
node_path_1.default.join('/Applications', name),
|
|
396
|
+
node_path_1.default.join(context.homeDirectory, 'Applications', name),
|
|
397
|
+
]);
|
|
398
|
+
for (const applicationPath of unique([
|
|
399
|
+
...discoveredApplications,
|
|
400
|
+
...knownApplications,
|
|
401
|
+
])) {
|
|
402
|
+
const executablePath = node_path_1.default.join(applicationPath, variant.executable);
|
|
403
|
+
if (context.pathExists(applicationPath) &&
|
|
404
|
+
context.pathExists(executablePath)) {
|
|
405
|
+
return {
|
|
406
|
+
id,
|
|
407
|
+
name: variant.name,
|
|
408
|
+
process: executablePath,
|
|
409
|
+
command: variant.command,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
return null;
|
|
415
|
+
};
|
|
416
|
+
const getPathDirectories = (context) => {
|
|
417
|
+
var _a, _b;
|
|
418
|
+
const value = (_b = (_a = context.env.PATH) !== null && _a !== void 0 ? _a : context.env.Path) !== null && _b !== void 0 ? _b : '';
|
|
419
|
+
return value.split(context.platform === 'win32' ? ';' : ':').filter(Boolean);
|
|
420
|
+
};
|
|
421
|
+
const findExecutable = ({ variant, context, }) => {
|
|
422
|
+
for (const executablePath of variant.paths(context)) {
|
|
423
|
+
if (context.pathExists(executablePath)) {
|
|
424
|
+
return executablePath;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const pathImplementation = context.platform === 'win32' ? node_path_1.default.win32 : node_path_1.default.posix;
|
|
428
|
+
for (const directory of getPathDirectories(context)) {
|
|
429
|
+
for (const command of variant.commands) {
|
|
430
|
+
const executablePath = pathImplementation.join(directory, command);
|
|
431
|
+
if (context.pathExists(executablePath)) {
|
|
432
|
+
return executablePath;
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
return null;
|
|
437
|
+
};
|
|
438
|
+
const findExecutableEditor = ({ id, variants, context, additionalPaths, }) => {
|
|
439
|
+
for (const executablePath of additionalPaths) {
|
|
440
|
+
if (context.pathExists(executablePath)) {
|
|
441
|
+
return {
|
|
442
|
+
id,
|
|
443
|
+
name: variants[0].name,
|
|
444
|
+
process: executablePath,
|
|
445
|
+
command: executablePath,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
for (const variant of variants) {
|
|
450
|
+
const executablePath = findExecutable({ variant, context });
|
|
451
|
+
if (executablePath) {
|
|
452
|
+
return {
|
|
453
|
+
id,
|
|
454
|
+
name: variant.name,
|
|
455
|
+
process: executablePath,
|
|
456
|
+
command: executablePath,
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
return null;
|
|
461
|
+
};
|
|
462
|
+
const discoverAvailableEditors = async (context) => {
|
|
463
|
+
if (context.platform !== 'darwin' &&
|
|
464
|
+
context.platform !== 'linux' &&
|
|
465
|
+
context.platform !== 'win32') {
|
|
466
|
+
return [];
|
|
467
|
+
}
|
|
468
|
+
const results = [];
|
|
469
|
+
for (const id of renderer_1.defaultEditorIds) {
|
|
470
|
+
const definition = editorDefinitions[id];
|
|
471
|
+
const windowsApplications = context.platform === 'win32'
|
|
472
|
+
? await context.findWindowsApplications(id)
|
|
473
|
+
: [];
|
|
474
|
+
const editor = context.platform === 'darwin'
|
|
475
|
+
? await findDarwinEditor({
|
|
476
|
+
id,
|
|
477
|
+
variants: definition.darwin,
|
|
478
|
+
context,
|
|
479
|
+
})
|
|
480
|
+
: findExecutableEditor({
|
|
481
|
+
id,
|
|
482
|
+
variants: context.platform === 'win32'
|
|
483
|
+
? definition.win32
|
|
484
|
+
: definition.linux,
|
|
485
|
+
context,
|
|
486
|
+
additionalPaths: windowsApplications,
|
|
487
|
+
});
|
|
488
|
+
if (editor) {
|
|
489
|
+
results.push(editor);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return results;
|
|
493
|
+
};
|
|
494
|
+
exports.discoverAvailableEditors = discoverAvailableEditors;
|
|
495
|
+
let availableEditors = null;
|
|
496
|
+
const getAvailableEditors = () => {
|
|
497
|
+
availableEditors !== null && availableEditors !== void 0 ? availableEditors : (availableEditors = (0, exports.discoverAvailableEditors)(defaultDiscoveryContext));
|
|
498
|
+
return availableEditors;
|
|
499
|
+
};
|
|
500
|
+
exports.getAvailableEditors = getAvailableEditors;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { LogLevel } from '@remotion/renderer';
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
type
|
|
11
|
-
type ProcessAndCommand = {
|
|
8
|
+
export declare const getDisplayNameForEditor: (editor: string | null) => string | null;
|
|
9
|
+
type Editor = string;
|
|
10
|
+
export type ProcessAndCommand = {
|
|
12
11
|
process: string;
|
|
13
12
|
command: Editor;
|
|
14
13
|
};
|
|
14
|
+
export declare const findMacOsEditorsFromProcessOutput: (output: string) => ProcessAndCommand[];
|
|
15
15
|
export declare function guessEditor(): Promise<ProcessAndCommand[]>;
|
|
16
16
|
export declare function launchEditor({ colNumber, editor, fileName, lineNumber, vsCodeNewWindow, logLevel }: {
|
|
17
17
|
fileName: string;
|
|
@@ -37,7 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.getDisplayNameForEditor = void 0;
|
|
40
|
+
exports.findMacOsEditorsFromProcessOutput = exports.getDisplayNameForEditor = void 0;
|
|
41
41
|
exports.guessEditor = guessEditor;
|
|
42
42
|
exports.launchEditor = launchEditor;
|
|
43
43
|
const node_child_process_1 = __importStar(require("node:child_process"));
|
|
@@ -55,6 +55,7 @@ const isVsCodeDerivative = (editor) => {
|
|
|
55
55
|
editor === 'Code.exe' ||
|
|
56
56
|
editor === 'vscodium' ||
|
|
57
57
|
editor === 'VSCodium.exe' ||
|
|
58
|
+
editor === 'codium' ||
|
|
58
59
|
editor === 'Code - Insiders.exe' ||
|
|
59
60
|
editor === 'cursor' ||
|
|
60
61
|
editor === 'Cursor.exe' ||
|
|
@@ -71,81 +72,6 @@ function isTerminalEditor(editor) {
|
|
|
71
72
|
return false;
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
75
|
-
const editorNames = [
|
|
76
|
-
'atom',
|
|
77
|
-
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta',
|
|
78
|
-
'brackets',
|
|
79
|
-
'/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
|
80
|
-
'/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl',
|
|
81
|
-
'/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
|
|
82
|
-
'code',
|
|
83
|
-
'code-insiders',
|
|
84
|
-
'vscodium',
|
|
85
|
-
'/Applications/AppCode.app/Contents/MacOS/appcode',
|
|
86
|
-
'/Applications/CLion.app/Contents/MacOS/clion',
|
|
87
|
-
'/Applications/IntelliJ IDEA.app/Contents/MacOS/idea',
|
|
88
|
-
'/Applications/PhpStorm.app/Contents/MacOS/phpstorm',
|
|
89
|
-
'/Applications/PyCharm.app/Contents/MacOS/pycharm',
|
|
90
|
-
'/Applications/PyCharm CE.app/Contents/MacOS/pycharm',
|
|
91
|
-
'/Applications/RubyMine.app/Contents/MacOS/rubymine',
|
|
92
|
-
'/Applications/WebStorm.app/Contents/MacOS/webstorm',
|
|
93
|
-
'/Applications/GoLand.app/Contents/MacOS/goland',
|
|
94
|
-
'/Applications/Rider.app/Contents/MacOS/rider',
|
|
95
|
-
'mvim',
|
|
96
|
-
'emacs',
|
|
97
|
-
'gvim',
|
|
98
|
-
'idea',
|
|
99
|
-
'phpstorm',
|
|
100
|
-
'pycharm',
|
|
101
|
-
'rubymine',
|
|
102
|
-
'subl',
|
|
103
|
-
'sublime_text',
|
|
104
|
-
'vim',
|
|
105
|
-
'webstorm',
|
|
106
|
-
'goland',
|
|
107
|
-
'rider',
|
|
108
|
-
'Brackets.exe',
|
|
109
|
-
'Code.exe',
|
|
110
|
-
'Code - Insiders.exe',
|
|
111
|
-
'VSCodium.exe',
|
|
112
|
-
'atom.exe',
|
|
113
|
-
'sublime_text.exe',
|
|
114
|
-
'notepad++.exe',
|
|
115
|
-
'clion.exe',
|
|
116
|
-
'clion64.exe',
|
|
117
|
-
'idea.exe',
|
|
118
|
-
'idea64.exe',
|
|
119
|
-
'phpstorm.exe',
|
|
120
|
-
'phpstorm64.exe',
|
|
121
|
-
'pycharm.exe',
|
|
122
|
-
'pycharm64.exe',
|
|
123
|
-
'rubymine.exe',
|
|
124
|
-
'rubymine64.exe',
|
|
125
|
-
'webstorm.exe',
|
|
126
|
-
'webstorm64.exe',
|
|
127
|
-
'goland.exe',
|
|
128
|
-
'goland64.exe',
|
|
129
|
-
'rider.exe',
|
|
130
|
-
'rider64.exe',
|
|
131
|
-
'nano',
|
|
132
|
-
'cursor',
|
|
133
|
-
'/Applications/Cursor.app/Contents/MacOS/Cursor',
|
|
134
|
-
'Cursor.exe',
|
|
135
|
-
'windsurf',
|
|
136
|
-
'/Applications/Windsurf.app/Contents/MacOS/Windsurf',
|
|
137
|
-
'Windsurf.exe',
|
|
138
|
-
'zed',
|
|
139
|
-
'zedit',
|
|
140
|
-
'zeditor',
|
|
141
|
-
'zed-editor',
|
|
142
|
-
'/Applications/Zed.app/Contents/MacOS/zed',
|
|
143
|
-
'/Applications/Zed.app/Contents/MacOS/cli',
|
|
144
|
-
'/Applications/Zed Preview.app/Contents/MacOS/zed',
|
|
145
|
-
'/Applications/Zed Preview.app/Contents/MacOS/cli',
|
|
146
|
-
'/Applications/Zed Preview.app/Contents/MacOS/Zed Preview',
|
|
147
|
-
'Zed.exe',
|
|
148
|
-
];
|
|
149
75
|
const displayNameForEditor = {
|
|
150
76
|
'/Applications/AppCode.app/Contents/MacOS/appcode': 'AppCode',
|
|
151
77
|
'/Applications/Atom Beta.app/Contents/MacOS/Atom Beta': 'Atom Beta',
|
|
@@ -241,6 +167,7 @@ const COMMON_EDITORS_OSX = {
|
|
|
241
167
|
'/Applications/Sublime Text.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl',
|
|
242
168
|
'/Applications/Sublime Text Dev.app/Contents/MacOS/Sublime Text': '/Applications/Sublime Text Dev.app/Contents/SharedSupport/bin/subl',
|
|
243
169
|
'/Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2': '/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl',
|
|
170
|
+
'/Applications/Visual Studio Code.app/Contents/MacOS/Code': 'code',
|
|
244
171
|
'/Applications/Visual Studio Code.app/Contents/MacOS/Electron': 'code',
|
|
245
172
|
'/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron': 'code-insiders',
|
|
246
173
|
'/Applications/VSCodium.app/Contents/MacOS/Electron': 'vscodium',
|
|
@@ -363,6 +290,10 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, colNumber) {
|
|
|
363
290
|
case 'Code - Insiders':
|
|
364
291
|
case 'vscodium':
|
|
365
292
|
case 'VSCodium':
|
|
293
|
+
case 'codium':
|
|
294
|
+
case 'com.vscodium.codium':
|
|
295
|
+
case 'com.visualstudio.code':
|
|
296
|
+
case 'com.visualstudio.code.insiders':
|
|
366
297
|
case 'cursor':
|
|
367
298
|
case 'Cursor':
|
|
368
299
|
case 'windsurf':
|
|
@@ -393,6 +324,21 @@ function getArgumentsForLineNumber(editor, fileName, lineNumber, colNumber) {
|
|
|
393
324
|
return [fileName];
|
|
394
325
|
}
|
|
395
326
|
}
|
|
327
|
+
const findMacOsEditorsFromProcessOutput = (output) => {
|
|
328
|
+
const availableEditors = [];
|
|
329
|
+
const processNames = Object.keys(COMMON_EDITORS_OSX);
|
|
330
|
+
for (let i = 0; i < processNames.length; i++) {
|
|
331
|
+
const processName = processNames[i];
|
|
332
|
+
if (output.includes(processName)) {
|
|
333
|
+
availableEditors.push({
|
|
334
|
+
process: processName,
|
|
335
|
+
command: COMMON_EDITORS_OSX[processName],
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return availableEditors;
|
|
340
|
+
};
|
|
341
|
+
exports.findMacOsEditorsFromProcessOutput = findMacOsEditorsFromProcessOutput;
|
|
396
342
|
async function guessEditor() {
|
|
397
343
|
// We can find out which editor is currently running by:
|
|
398
344
|
// `ps x` on macOS and Linux
|
|
@@ -401,17 +347,7 @@ async function guessEditor() {
|
|
|
401
347
|
try {
|
|
402
348
|
if (process.platform === 'darwin') {
|
|
403
349
|
const output = (await execProm('ps x')).stdout.toString();
|
|
404
|
-
|
|
405
|
-
for (let i = 0; i < processNames.length; i++) {
|
|
406
|
-
const processName = processNames[i];
|
|
407
|
-
if (output.indexOf(processName) !== -1) {
|
|
408
|
-
availableEditors.push({
|
|
409
|
-
process: processName,
|
|
410
|
-
command: COMMON_EDITORS_OSX[processName],
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return availableEditors;
|
|
350
|
+
return (0, exports.findMacOsEditorsFromProcessOutput)(output);
|
|
415
351
|
}
|
|
416
352
|
if (process.platform === 'win32') {
|
|
417
353
|
// Some processes need elevated rights to get its executable path.
|