@remotion/cli 3.2.35-crf.3 → 3.2.36

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.
Files changed (45) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/benchmark.js +8 -5
  3. package/dist/check-version.d.ts +1 -0
  4. package/dist/check-version.js +14 -0
  5. package/dist/composition-prompts.d.ts +8 -0
  6. package/dist/composition-prompts.js +26 -0
  7. package/dist/editor/components/Editor.js +4 -1
  8. package/dist/editor/components/GlobalKeybindings.js +11 -0
  9. package/dist/editor/components/MenuToolbar.js +3 -449
  10. package/dist/editor/components/NewComposition/ComboBox.d.ts +2 -1
  11. package/dist/editor/components/NewComposition/NewComposition.js +3 -0
  12. package/dist/editor/components/PlayPause.js +2 -1
  13. package/dist/editor/components/PlaybackRateSelector.js +1 -0
  14. package/dist/editor/components/QuickSwitcher/NoResults.d.ts +6 -0
  15. package/dist/editor/components/QuickSwitcher/NoResults.js +15 -0
  16. package/dist/editor/components/QuickSwitcher/QuickSwitcher.d.ts +3 -0
  17. package/dist/editor/components/QuickSwitcher/QuickSwitcher.js +16 -0
  18. package/dist/editor/components/QuickSwitcher/QuickSwitcherContent.d.ts +2 -0
  19. package/dist/editor/components/QuickSwitcher/QuickSwitcherContent.js +179 -0
  20. package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.d.ts +17 -0
  21. package/dist/editor/components/QuickSwitcher/QuickSwitcherResult.js +90 -0
  22. package/dist/editor/components/QuickSwitcher/fuzzy-search.d.ts +2 -0
  23. package/dist/editor/components/QuickSwitcher/fuzzy-search.js +26 -0
  24. package/dist/editor/components/QuickSwitcher.d.ts +3 -0
  25. package/dist/editor/components/QuickSwitcher.js +32 -0
  26. package/dist/editor/components/SizeSelector.js +1 -0
  27. package/dist/editor/helpers/use-menu-structure.d.ts +7 -0
  28. package/dist/editor/helpers/use-menu-structure.js +547 -0
  29. package/dist/editor/helpers/use-menu-toolbar.d.ts +0 -0
  30. package/dist/editor/helpers/use-menu-toolbar.js +1 -0
  31. package/dist/editor/state/modals.d.ts +2 -0
  32. package/dist/get-composition-id.d.ts +6 -1
  33. package/dist/get-composition-id.js +27 -6
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.js +2 -0
  36. package/dist/preview-server/start-server.js +9 -5
  37. package/dist/render.js +9 -13
  38. package/dist/select-composition.d.ts +7 -0
  39. package/dist/select-composition.js +51 -0
  40. package/dist/still.js +11 -15
  41. package/dist/validate-ffmpeg-version.d.ts +3 -0
  42. package/dist/validate-ffmpeg-version.js +17 -0
  43. package/dist/warn-about-ffmpeg-version.d.ts +5 -0
  44. package/dist/warn-about-ffmpeg-version.js +38 -0
  45. package/package.json +9 -7
@@ -0,0 +1,547 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeSearchResults = exports.useMenuStructure = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const remotion_1 = require("remotion");
7
+ const truthy_1 = require("../../truthy");
8
+ const layout_1 = require("../components/layout");
9
+ const SizeSelector_1 = require("../components/SizeSelector");
10
+ const TimelineInOutToggle_1 = require("../components/TimelineInOutToggle");
11
+ const Checkmark_1 = require("../icons/Checkmark");
12
+ const checkerboard_1 = require("../state/checkerboard");
13
+ const modals_1 = require("../state/modals");
14
+ const preview_size_1 = require("../state/preview-size");
15
+ const rich_timeline_1 = require("../state/rich-timeline");
16
+ const sidebar_1 = require("../state/sidebar");
17
+ const timeline_ref_1 = require("../state/timeline-ref");
18
+ const pick_color_1 = require("./pick-color");
19
+ const use_keybinding_1 = require("./use-keybinding");
20
+ const openExternal = (link) => {
21
+ window.open(link, '_blank');
22
+ };
23
+ const rotate = {
24
+ transform: `rotate(90deg)`,
25
+ };
26
+ const ICON_SIZE = 16;
27
+ const useMenuStructure = (closeMenu) => {
28
+ const { setSelectedModal } = (0, react_1.useContext)(modals_1.ModalsContext);
29
+ const { checkerboard, setCheckerboard } = (0, react_1.useContext)(checkerboard_1.CheckerboardContext);
30
+ const { richTimeline, setRichTimeline } = (0, react_1.useContext)(rich_timeline_1.RichTimelineContext);
31
+ const { size, setSize } = (0, react_1.useContext)(preview_size_1.PreviewSizeContext);
32
+ const { setSidebarCollapsedState, sidebarCollapsedState } = (0, react_1.useContext)(sidebar_1.SidebarContext);
33
+ const sizes = (0, SizeSelector_1.getUniqueSizes)(size);
34
+ const structure = (0, react_1.useMemo)(() => {
35
+ const struct = [
36
+ {
37
+ id: 'remotion',
38
+ label: ((0, jsx_runtime_1.jsx)(layout_1.Row, { align: "center", justify: "center", children: (0, jsx_runtime_1.jsx)("svg", { width: ICON_SIZE, height: ICON_SIZE, viewBox: "-100 -100 400 400", style: rotate, children: (0, jsx_runtime_1.jsx)("path", { fill: "#fff", stroke: "#fff", strokeWidth: "100", strokeLinejoin: "round", d: "M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z" }) }) })),
39
+ leaveLeftPadding: false,
40
+ items: [
41
+ {
42
+ id: 'about',
43
+ value: 'about',
44
+ label: 'About Remotion',
45
+ onClick: () => {
46
+ closeMenu();
47
+ openExternal('https://remotion.dev');
48
+ },
49
+ type: 'item',
50
+ keyHint: null,
51
+ leftItem: null,
52
+ subMenu: null,
53
+ quickSwitcherLabel: 'Help: About Remotion',
54
+ },
55
+ {
56
+ id: 'changelog',
57
+ value: 'changelog',
58
+ label: 'Changelog',
59
+ onClick: () => {
60
+ closeMenu();
61
+ openExternal('https://github.com/remotion-dev/remotion/releases');
62
+ },
63
+ type: 'item',
64
+ keyHint: null,
65
+ leftItem: null,
66
+ subMenu: null,
67
+ quickSwitcherLabel: 'Help: Changelog',
68
+ },
69
+ {
70
+ id: 'license',
71
+ value: 'license',
72
+ label: 'License',
73
+ onClick: () => {
74
+ closeMenu();
75
+ openExternal('https://github.com/remotion-dev/remotion/blob/main/LICENSE.md');
76
+ },
77
+ type: 'item',
78
+ keyHint: null,
79
+ leftItem: null,
80
+ subMenu: null,
81
+ quickSwitcherLabel: 'Help: License',
82
+ },
83
+ ],
84
+ quickSwitcherLabel: null,
85
+ },
86
+ {
87
+ id: 'file',
88
+ label: 'File',
89
+ leaveLeftPadding: false,
90
+ items: [
91
+ {
92
+ id: 'new-sequence',
93
+ value: 'new-sequence',
94
+ label: 'New composition...',
95
+ onClick: () => {
96
+ closeMenu();
97
+ setSelectedModal({
98
+ compType: 'composition',
99
+ type: 'new-comp',
100
+ });
101
+ },
102
+ type: 'item',
103
+ keyHint: 'N',
104
+ leftItem: null,
105
+ subMenu: null,
106
+ quickSwitcherLabel: 'New composition...',
107
+ },
108
+ {
109
+ id: 'new-still',
110
+ value: 'new-still',
111
+ label: 'New still...',
112
+ onClick: () => {
113
+ closeMenu();
114
+ setSelectedModal({
115
+ compType: 'still',
116
+ type: 'new-comp',
117
+ });
118
+ },
119
+ type: 'item',
120
+ keyHint: null,
121
+ leftItem: null,
122
+ subMenu: null,
123
+ quickSwitcherLabel: 'New still...',
124
+ },
125
+ ],
126
+ quickSwitcherLabel: null,
127
+ },
128
+ {
129
+ id: 'view',
130
+ label: 'View',
131
+ leaveLeftPadding: true,
132
+ items: [
133
+ {
134
+ id: 'preview-size',
135
+ keyHint: null,
136
+ label: 'Preview size',
137
+ onClick: () => undefined,
138
+ type: 'item',
139
+ value: 'preview-size',
140
+ leftItem: null,
141
+ subMenu: {
142
+ leaveLeftSpace: true,
143
+ preselectIndex: sizes.findIndex((s) => String(size.size) === String(s.size)),
144
+ items: sizes.map((newSize) => ({
145
+ id: String(newSize.size),
146
+ keyHint: newSize.size === 1 ? '0' : null,
147
+ label: (0, SizeSelector_1.getPreviewSizeLabel)(newSize),
148
+ leftItem: String(newSize.size) === String(size.size) ? ((0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {})) : null,
149
+ onClick: () => {
150
+ closeMenu();
151
+ setSize(() => newSize);
152
+ },
153
+ subMenu: null,
154
+ type: 'item',
155
+ value: newSize.size,
156
+ quickSwitcherLabel: null,
157
+ })),
158
+ quickSwitcherLabel: null,
159
+ },
160
+ quickSwitcherLabel: null,
161
+ },
162
+ {
163
+ id: 'timeline-divider',
164
+ type: 'divider',
165
+ },
166
+ {
167
+ id: 'left-sidebar',
168
+ label: 'Sidebar',
169
+ keyHint: null,
170
+ type: 'item',
171
+ value: 'preview-size',
172
+ leftItem: null,
173
+ quickSwitcherLabel: null,
174
+ subMenu: {
175
+ leaveLeftSpace: true,
176
+ preselectIndex: 0,
177
+ items: [
178
+ {
179
+ id: 'sidebar-responsive',
180
+ keyHint: null,
181
+ label: 'Responsive',
182
+ leftItem: sidebarCollapsedState === 'responsive' ? ((0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {})) : null,
183
+ onClick: () => {
184
+ setSidebarCollapsedState('responsive');
185
+ },
186
+ subMenu: null,
187
+ type: 'item',
188
+ value: 'responsive',
189
+ quickSwitcherLabel: null,
190
+ },
191
+ {
192
+ id: 'sidebar-expanded',
193
+ keyHint: null,
194
+ label: 'Expanded',
195
+ leftItem: sidebarCollapsedState === 'expanded' ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
196
+ onClick: () => {
197
+ setSidebarCollapsedState('expanded');
198
+ },
199
+ subMenu: null,
200
+ type: 'item',
201
+ value: 'expanded',
202
+ quickSwitcherLabel: null,
203
+ },
204
+ {
205
+ id: 'sidebar-collapsed',
206
+ keyHint: null,
207
+ label: 'Collapsed',
208
+ leftItem: sidebarCollapsedState === 'collapsed' ? ((0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {})) : null,
209
+ onClick: () => {
210
+ setSidebarCollapsedState('collapsed');
211
+ },
212
+ subMenu: null,
213
+ type: 'item',
214
+ value: 'collapsed',
215
+ quickSwitcherLabel: null,
216
+ },
217
+ ],
218
+ },
219
+ onClick: () => undefined,
220
+ },
221
+ {
222
+ id: 'timeline-divider',
223
+ type: 'divider',
224
+ },
225
+ {
226
+ id: 'checkerboard',
227
+ keyHint: 'T',
228
+ label: 'Transparency as checkerboard',
229
+ onClick: () => {
230
+ closeMenu();
231
+ setCheckerboard((c) => !c);
232
+ },
233
+ type: 'item',
234
+ value: 'checkerboard',
235
+ leftItem: checkerboard ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
236
+ subMenu: null,
237
+ quickSwitcherLabel: checkerboard
238
+ ? 'Disable Checkerboard Transparency'
239
+ : 'Enable Checkerboard Transparency',
240
+ },
241
+ {
242
+ id: 'timeline-divider',
243
+ type: 'divider',
244
+ },
245
+ {
246
+ id: 'rich-timeline',
247
+ keyHint: null,
248
+ label: 'Rich timeline',
249
+ onClick: () => {
250
+ closeMenu();
251
+ setRichTimeline((r) => !r);
252
+ },
253
+ type: 'item',
254
+ value: 'rich-timeline',
255
+ leftItem: richTimeline ? (0, jsx_runtime_1.jsx)(Checkmark_1.Checkmark, {}) : null,
256
+ subMenu: null,
257
+ quickSwitcherLabel: richTimeline
258
+ ? 'Timeline: Disable Rich Timeline'
259
+ : 'Timeline: Enable Rich Timeline',
260
+ },
261
+ {
262
+ id: 'expand-all',
263
+ keyHint: null,
264
+ label: 'Expand all',
265
+ onClick: () => {
266
+ var _a;
267
+ closeMenu();
268
+ (_a = timeline_ref_1.timelineRef.current) === null || _a === void 0 ? void 0 : _a.expandAll();
269
+ },
270
+ type: 'item',
271
+ value: 'expand-all',
272
+ leftItem: null,
273
+ subMenu: null,
274
+ quickSwitcherLabel: 'Timeline: Expand all Timeline layers',
275
+ },
276
+ {
277
+ id: 'collapse-all',
278
+ keyHint: null,
279
+ label: 'Collapse all',
280
+ onClick: () => {
281
+ var _a;
282
+ closeMenu();
283
+ (_a = timeline_ref_1.timelineRef.current) === null || _a === void 0 ? void 0 : _a.collapseAll();
284
+ },
285
+ type: 'item',
286
+ value: 'collapse-all',
287
+ leftItem: null,
288
+ subMenu: null,
289
+ quickSwitcherLabel: 'Timeline: Collapse all layers',
290
+ },
291
+ {
292
+ id: 'in-out-divider',
293
+ type: 'divider',
294
+ },
295
+ {
296
+ id: 'in-mark',
297
+ keyHint: 'I',
298
+ label: 'In Mark',
299
+ leftItem: null,
300
+ onClick: () => {
301
+ var _a;
302
+ closeMenu();
303
+ (_a = TimelineInOutToggle_1.inOutHandles.current) === null || _a === void 0 ? void 0 : _a.inMarkClick(null);
304
+ },
305
+ subMenu: null,
306
+ type: 'item',
307
+ value: 'in-mark',
308
+ quickSwitcherLabel: 'Timeline: Set In Mark',
309
+ },
310
+ {
311
+ id: 'out-mark',
312
+ keyHint: 'O',
313
+ label: 'Out Mark',
314
+ leftItem: null,
315
+ onClick: () => {
316
+ var _a;
317
+ closeMenu();
318
+ (_a = TimelineInOutToggle_1.inOutHandles.current) === null || _a === void 0 ? void 0 : _a.outMarkClick(null);
319
+ },
320
+ subMenu: null,
321
+ type: 'item',
322
+ value: 'out-mark',
323
+ quickSwitcherLabel: 'Timeline: Set Out Mark',
324
+ },
325
+ {
326
+ id: 'x-mark',
327
+ keyHint: 'X',
328
+ label: 'Clear In/Out Marks',
329
+ leftItem: null,
330
+ onClick: () => {
331
+ var _a;
332
+ closeMenu();
333
+ (_a = TimelineInOutToggle_1.inOutHandles.current) === null || _a === void 0 ? void 0 : _a.clearMarks();
334
+ },
335
+ subMenu: null,
336
+ type: 'item',
337
+ value: 'clear-marks',
338
+ quickSwitcherLabel: 'Timeline: Clear In and Out Mark',
339
+ },
340
+ ],
341
+ },
342
+ 'EyeDropper' in window
343
+ ? {
344
+ id: 'tools',
345
+ label: 'Tools',
346
+ leaveLeftPadding: false,
347
+ items: [
348
+ {
349
+ id: 'color-picker',
350
+ value: 'color-picker',
351
+ label: 'Color Picker',
352
+ onClick: () => (0, pick_color_1.pickColor)(),
353
+ leftItem: null,
354
+ keyHint: null,
355
+ subMenu: null,
356
+ type: 'item',
357
+ quickSwitcherLabel: 'Show Color Picker',
358
+ },
359
+ ],
360
+ quickSwitcherLabel: null,
361
+ }
362
+ : null,
363
+ {
364
+ id: 'help',
365
+ label: 'Help',
366
+ leaveLeftPadding: false,
367
+ items: [
368
+ {
369
+ id: 'shortcuts',
370
+ value: 'shortcuts',
371
+ label: (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
372
+ ? 'Shortcuts (disabled)'
373
+ : 'Shortcuts',
374
+ onClick: () => {
375
+ closeMenu();
376
+ setSelectedModal({
377
+ type: 'shortcuts',
378
+ });
379
+ },
380
+ keyHint: '?',
381
+ leftItem: null,
382
+ subMenu: null,
383
+ type: 'item',
384
+ quickSwitcherLabel: (0, use_keybinding_1.areKeyboardShortcutsDisabled)()
385
+ ? 'Show all Keyboard Shortcuts (disabled)'
386
+ : 'Show all Keyboard Shortcuts',
387
+ },
388
+ {
389
+ id: 'docs',
390
+ value: 'docs',
391
+ label: 'Docs',
392
+ onClick: () => {
393
+ closeMenu();
394
+ openExternal('https://remotion.dev/docs');
395
+ },
396
+ type: 'item',
397
+ keyHint: null,
398
+ leftItem: null,
399
+ subMenu: null,
400
+ quickSwitcherLabel: 'Visit Documentation',
401
+ },
402
+ {
403
+ id: 'file-issue',
404
+ value: 'file-issue',
405
+ label: 'File an issue',
406
+ onClick: () => {
407
+ closeMenu();
408
+ openExternal('https://github.com/remotion-dev/remotion/issues/new/choose');
409
+ },
410
+ type: 'item',
411
+ keyHint: null,
412
+ leftItem: null,
413
+ subMenu: null,
414
+ quickSwitcherLabel: 'File GitHub issue',
415
+ },
416
+ {
417
+ id: 'discord',
418
+ value: 'discord',
419
+ label: 'Join Discord community',
420
+ onClick: () => {
421
+ closeMenu();
422
+ openExternal('https://discord.com/invite/6VzzNDwUwV');
423
+ },
424
+ type: 'item',
425
+ keyHint: null,
426
+ leftItem: null,
427
+ subMenu: null,
428
+ quickSwitcherLabel: null,
429
+ },
430
+ {
431
+ id: 'help-divider',
432
+ type: 'divider',
433
+ },
434
+ {
435
+ id: 'insta',
436
+ value: 'insta',
437
+ label: 'Instagram',
438
+ onClick: () => {
439
+ closeMenu();
440
+ openExternal('https://instagram.com/remotion.dev');
441
+ },
442
+ type: 'item',
443
+ keyHint: null,
444
+ leftItem: null,
445
+ subMenu: null,
446
+ quickSwitcherLabel: 'Follow Remotion on Instagram',
447
+ },
448
+ {
449
+ id: 'twitter',
450
+ value: 'twitter',
451
+ label: 'Twitter',
452
+ onClick: () => {
453
+ closeMenu();
454
+ openExternal('https://twitter.com/remotion_dev');
455
+ },
456
+ type: 'item',
457
+ keyHint: null,
458
+ leftItem: null,
459
+ subMenu: null,
460
+ quickSwitcherLabel: 'Follow Remotion on Twitter',
461
+ },
462
+ {
463
+ id: 'tiktok',
464
+ value: 'tiktok',
465
+ label: 'TikTok',
466
+ onClick: () => {
467
+ closeMenu();
468
+ openExternal('https://www.tiktok.com/@remotion.dev');
469
+ },
470
+ type: 'item',
471
+ keyHint: null,
472
+ leftItem: null,
473
+ subMenu: null,
474
+ quickSwitcherLabel: 'Follow Remotion on TikTok',
475
+ },
476
+ ],
477
+ },
478
+ ].filter(remotion_1.Internals.truthy);
479
+ return struct;
480
+ }, [
481
+ checkerboard,
482
+ closeMenu,
483
+ richTimeline,
484
+ setCheckerboard,
485
+ setRichTimeline,
486
+ setSelectedModal,
487
+ setSidebarCollapsedState,
488
+ setSize,
489
+ sidebarCollapsedState,
490
+ size.size,
491
+ sizes,
492
+ ]);
493
+ return structure;
494
+ };
495
+ exports.useMenuStructure = useMenuStructure;
496
+ const getItemLabel = (item) => {
497
+ var _a;
498
+ if (item.quickSwitcherLabel !== null) {
499
+ return item.quickSwitcherLabel;
500
+ }
501
+ if (typeof item.label === 'string') {
502
+ return item.label;
503
+ }
504
+ return (_a = item.label) === null || _a === void 0 ? void 0 : _a.toString();
505
+ };
506
+ const itemToSearchResult = (item, setSelectedModal, prefixes) => {
507
+ if (item.subMenu) {
508
+ return item.subMenu.items
509
+ .map((subItem) => {
510
+ if (subItem.type === 'divider') {
511
+ return null;
512
+ }
513
+ return itemToSearchResult(subItem, setSelectedModal, [
514
+ ...prefixes,
515
+ getItemLabel(item),
516
+ ]);
517
+ })
518
+ .flat(1)
519
+ .filter(truthy_1.truthy);
520
+ }
521
+ return [
522
+ {
523
+ type: 'menu-item',
524
+ id: item.id,
525
+ onSelected: () => {
526
+ setSelectedModal(null);
527
+ item.onClick(item.id);
528
+ },
529
+ title: [...prefixes, getItemLabel(item)].join(': '),
530
+ },
531
+ ];
532
+ };
533
+ const makeSearchResults = (actions, setSelectedModal) => {
534
+ const items = actions
535
+ .map((menu) => {
536
+ return menu.items.map((item) => {
537
+ if (item.type === 'divider') {
538
+ return null;
539
+ }
540
+ return itemToSearchResult(item, setSelectedModal, []);
541
+ });
542
+ })
543
+ .flat(Infinity)
544
+ .filter(truthy_1.truthy);
545
+ return items;
546
+ };
547
+ exports.makeSearchResults = makeSearchResults;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -7,6 +7,8 @@ export declare type ModalState = {
7
7
  } | {
8
8
  type: 'update';
9
9
  info: UpdateInfo;
10
+ } | {
11
+ type: 'quick-switcher';
10
12
  } | {
11
13
  type: 'shortcuts';
12
14
  };
@@ -1 +1,6 @@
1
- export declare const getCompositionId: () => string;
1
+ import type { TCompMetadata } from 'remotion';
2
+ export declare const getCompositionId: (validCompositions: TCompMetadata[]) => Promise<{
3
+ compositionId: string;
4
+ reason: string;
5
+ config: TCompMetadata;
6
+ }>;
@@ -3,12 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCompositionId = void 0;
4
4
  const log_1 = require("./log");
5
5
  const parse_command_line_1 = require("./parse-command-line");
6
- const getCompositionId = () => {
7
- if (!parse_command_line_1.parsedCli._[2]) {
8
- log_1.Log.error('Composition ID not passed.');
9
- log_1.Log.error('Pass an extra argument <composition-id>.');
10
- process.exit(1);
6
+ const select_composition_1 = require("./select-composition");
7
+ const getCompositionId = async (validCompositions) => {
8
+ if (parse_command_line_1.parsedCli._[2]) {
9
+ const config = validCompositions.find((c) => c.id === parse_command_line_1.parsedCli._[2]);
10
+ if (!config) {
11
+ throw new Error(`Cannot find composition with ID "${parse_command_line_1.parsedCli._[2]}". Available composition: ${validCompositions
12
+ .map((c) => c.id)
13
+ .join(', ')}`);
14
+ }
15
+ return {
16
+ compositionId: parse_command_line_1.parsedCli._[2],
17
+ reason: 'Passed as argument',
18
+ config,
19
+ };
11
20
  }
12
- return parse_command_line_1.parsedCli._[2];
21
+ if (!process.env.CI) {
22
+ const { compositionId, reason } = await (0, select_composition_1.selectComposition)(validCompositions);
23
+ if (compositionId && typeof compositionId === 'string') {
24
+ return {
25
+ compositionId,
26
+ reason,
27
+ config: validCompositions.find((c) => c.id === compositionId),
28
+ };
29
+ }
30
+ }
31
+ log_1.Log.error('Composition ID not passed.');
32
+ log_1.Log.error('Pass an extra argument <composition-id>.');
33
+ process.exit(1);
13
34
  };
14
35
  exports.getCompositionId = getCompositionId;
package/dist/index.d.ts CHANGED
@@ -135,4 +135,8 @@ export declare const CliInternals: {
135
135
  source: string;
136
136
  };
137
137
  minimist: typeof minimist;
138
+ selectComposition: (validCompositions: import("remotion").TCompMetadata[]) => Promise<{
139
+ compositionId: string;
140
+ reason: string;
141
+ }>;
138
142
  };
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ const preview_1 = require("./preview");
41
41
  const print_help_1 = require("./print-help");
42
42
  const progress_bar_1 = require("./progress-bar");
43
43
  const render_1 = require("./render");
44
+ const select_composition_1 = require("./select-composition");
44
45
  const still_1 = require("./still");
45
46
  const upgrade_1 = require("./upgrade");
46
47
  const versions_1 = require("./versions");
@@ -129,4 +130,5 @@ exports.CliInternals = {
129
130
  getFinalCodec: get_cli_options_1.getFinalCodec,
130
131
  determineFinalImageFormat: determine_image_format_1.determineFinalImageFormat,
131
132
  minimist: minimist_1.default,
133
+ selectComposition: select_composition_1.selectComposition,
132
134
  };
@@ -68,12 +68,16 @@ const startServer = async (entry, userDefinedComponent, options) => {
68
68
  });
69
69
  })
70
70
  .catch((err) => {
71
- response.setHeader('content-type', 'application/json');
72
- response.writeHead(500);
73
71
  log_1.Log.error(`Error while calling ${request.url}`, err);
74
- response.end(JSON.stringify({
75
- err: err.message,
76
- }));
72
+ if (!response.headersSent) {
73
+ response.setHeader('content-type', 'application/json');
74
+ response.writeHead(500);
75
+ }
76
+ if (!response.writableEnded) {
77
+ response.end(JSON.stringify({
78
+ err: err.message,
79
+ }));
80
+ }
77
81
  });
78
82
  });
79
83
  const desiredPort = (_d = options === null || options === void 0 ? void 0 : options.port) !== null && _d !== void 0 ? _d : undefined;