@demotime/video 0.0.1-beta.1

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/LICENSE ADDED
@@ -0,0 +1,188 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+
4
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
5
+
6
+ 1. Definitions.
7
+
8
+ "License" shall mean the terms and conditions for use, reproduction,
9
+ and distribution as defined in Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by
12
+ the copyright owner that is granting the License.
13
+
14
+ "Legal Entity" shall mean the union of the acting entity and all
15
+ other entities that control, are controlled by, or are under common
16
+ control with that entity. For the purposes of this definition,
17
+ "control" means (i) the power, direct or indirect, to cause the
18
+ direction or management of such entity, whether by contract or
19
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications,
26
+ including but not limited to software source code, documentation
27
+ source, and configuration files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical
30
+ transformation or translation of a Source form, including but
31
+ not limited to compiled object code, generated documentation,
32
+ and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object
35
+ form, made available under the License, as indicated by a copyright
36
+ notice that is included in or attached to the work (an example is
37
+ provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including
48
+ the original Work and any Derivative Works thereof, that is intentionally
49
+ submitted to, or received by, Licensor for inclusion in the Work by the
50
+ copyright owner or by an individual or Legal Entity authorized to submit
51
+ on behalf of the copyright owner. For the purposes of this definition,
52
+ "submitted" means any form of electronic, verbal, or written communication
53
+ sent to the Licensor or its representatives, such as but not limited to
54
+ communication on electronic mailing lists, source code control systems,
55
+ and issue tracking systems that are managed by, or on behalf of, the
56
+ Licensor for the purpose of discussing and improving the Work, but
57
+ excluding communication that is conspicuously marked or otherwise
58
+ designated in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
61
+ whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of
65
+ this License, each Contributor hereby grants to You a perpetual,
66
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
67
+ copyright license to reproduce, prepare Derivative Works of,
68
+ publicly display, publicly perform, sublicense, and distribute the
69
+ Work and such Derivative Works in Source or Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of
72
+ this License, each Contributor hereby grants to You a perpetual,
73
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
+ (except as stated in this section) patent license to make, have made,
75
+ use, offer to sell, sell, import, and otherwise transfer the Work,
76
+ where such license applies only to those patent claims licensable
77
+ by such Contributor that are necessarily infringed by their
78
+ Contribution(s) alone or by combination of their Contribution(s)
79
+ with the Work to which such Contribution(s) was submitted. If You
80
+ institute patent litigation against any entity (including a
81
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
82
+ or a Contribution incorporated within the Work constitutes direct
83
+ or contributory patent infringement, then any patent licenses
84
+ granted to You under this License for that Work shall terminate
85
+ as of the date such litigation is filed.
86
+
87
+ 4. Redistribution. You may reproduce and distribute copies of the
88
+ Work or Derivative Works thereof in any medium, with or without
89
+ modifications, and in Source or Object form, provided that You
90
+ meet the following conditions:
91
+
92
+ (a) You must give any other recipients of the Work or
93
+ Derivative Works a copy of this License; and
94
+
95
+ (b) You must cause any modified files to carry prominent notices
96
+ stating that You changed the files; and
97
+
98
+ (c) You must retain, in the Source form of any Derivative Works
99
+ that You distribute, all copyright, patent, trademark, and
100
+ attribution notices from the Source form of the Work,
101
+ excluding those notices that do not pertain to any part of
102
+ the Derivative Works; and
103
+
104
+ (d) If the Work includes a "NOTICE" text file, then any
105
+ Derivative Works that You distribute must include a readable
106
+ copy of the attribution notices contained
107
+ within such NOTICE file, excluding those notices that do not
108
+ pertain to any part of the Derivative Works, in at least one
109
+ of the following places: within a NOTICE text file distributed
110
+ as part of the Derivative Works; within the Source form or
111
+ documentation, if provided along with the Derivative Works; or,
112
+ within a display generated by the Derivative Works, if and
113
+ wherever such third-party notices normally appear. The contents
114
+ of the NOTICE file are for informational purposes only and
115
+ do not modify the License. You may add Your own attribution
116
+ notices within Derivative Works that You distribute, alongside
117
+ or as an addendum to the NOTICE from the Work, provided that
118
+ such additional attribution notices cannot be construed
119
+ as modifying the License.
120
+
121
+ You may add Your own copyright statement to Your modifications and
122
+ may provide additional or different license terms and conditions
123
+ for use, reproduction, or distribution of Your modifications, or
124
+ for any such Derivative Works as a whole, provided Your use,
125
+ reproduction, and distribution of the Work otherwise complies with
126
+ the conditions of this License.
127
+
128
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
129
+ any Contribution intentionally submitted for inclusion in the Work
130
+ by You to the Licensor shall be under the terms and conditions of
131
+ this License, without any additional terms or conditions.
132
+ Notwithstanding the above, nothing herein shall supersede or modify
133
+ the terms of any separate license agreement you may have executed
134
+ with Licensor regarding such Contribution.
135
+
136
+ 6. Trademarks. This License does not grant permission to use the trade
137
+ names, trademarks, service marks, or product names of the Licensor,
138
+ except as required for reasonable and customary use in describing the
139
+ origin of the Work and reproducing the content of the NOTICE file.
140
+
141
+ 7. Disclaimer of Warranty. Unless required by applicable law or
142
+ agreed to in writing, Licensor provides the Work (and each
143
+ Contributor provides its Contributions) on an "AS IS" BASIS,
144
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
145
+ implied, including, without limitation, any warranties or conditions
146
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
147
+ PARTICULAR PURPOSE. You are solely responsible for determining the
148
+ appropriateness of using or redistributing the Work and assume any
149
+ risks associated with Your exercise of permissions under this License.
150
+
151
+ 8. Limitation of Liability. In no event and under no legal theory,
152
+ whether in tort (including negligence), contract, or otherwise,
153
+ unless required by applicable law (such as deliberate and grossly
154
+ negligent acts) or agreed to in writing, shall any Contributor be
155
+ liable to You for damages, including any direct, indirect, special,
156
+ incidental, or consequential damages of any character arising as a
157
+ result of this License or out of the use or inability to use the
158
+ Work (including but not limited to damages for loss of goodwill,
159
+ work stoppage, computer failure or malfunction, or any and all
160
+ other commercial damages or losses), even if such Contributor
161
+ has been advised of the possibility of such damages.
162
+
163
+ 9. Accepting Warranty or Additional Liability. While redistributing
164
+ the Work or Derivative Works thereof, You may choose to offer,
165
+ and charge a fee for, acceptance of support, warranty, indemnity,
166
+ or other liability obligations and/or rights consistent with this
167
+ License. However, in accepting such obligations, You may act only
168
+ on Your own behalf and on Your sole responsibility, not on behalf
169
+ of any other Contributor, and only if You agree to indemnify,
170
+ defend, and hold each Contributor harmless for any liability
171
+ incurred by, or claims asserted against, such Contributor by reason
172
+ of your accepting any such warranty or additional liability.
173
+
174
+ END OF TERMS AND CONDITIONS
175
+
176
+ Copyright 2025 Elio Struyf
177
+
178
+ Licensed under the Apache License, Version 2.0 (the "License");
179
+ you may not use this file except in compliance with the License.
180
+ You may obtain a copy of the License at
181
+
182
+ http://www.apache.org/licenses/LICENSE-2.0
183
+
184
+ Unless required by applicable law or agreed to in writing, software
185
+ distributed under the License is distributed on an "AS IS" BASIS,
186
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
187
+ See the License for the specific language governing permissions and
188
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,193 @@
1
+ # @demotime/video
2
+
3
+ Export a [Demo Time](https://demotime.show) play as a video. It runs the play unattended in VS Code,
4
+ records the window, and writes an MP4, plus a GIF, captions and chapters if you ask for them.
5
+
6
+ When the demo changes, you run it again. No screen recording, no editing.
7
+
8
+ 📖 **Documentation**:
9
+ [demotime.show/features/video-export](https://demotime.show/features/video-export/)
10
+
11
+ ## Run it from a terminal
12
+
13
+ You don't need to open VS Code or install anything first. From the folder that contains your `.demo`
14
+ folder:
15
+
16
+ ```bash
17
+ npx @demotime/video export
18
+ ```
19
+
20
+ The CLI opens its own VS Code window with an empty profile and installs the Demo Time extension into
21
+ it from the Marketplace. The VS Code you work in and its extensions aren't touched.
22
+
23
+ The files go to `.demo/exports`:
24
+
25
+ | File | What it is |
26
+ | ------------------- | ---------------------------------------------------------------- |
27
+ | `demo.mp4` | The video, with chapters when you ask for them |
28
+ | `demo.gif` | With `--gif` |
29
+ | `demo.srt` | With `--srt` |
30
+ | `demo-chapters.txt` | With `--chapters`, as `0:00 Title` lines for a video description |
31
+ | `demo-events.jsonl` | When each scene and slide started, and which moves were skipped |
32
+
33
+ In VS Code, **Demo Time: Export play as video** runs this same CLI for you. It uses the VS Code
34
+ you're running, your theme and your fonts.
35
+
36
+ ## Examples
37
+
38
+ ```bash
39
+ # The second act as a vertical video with captions from the scene notes
40
+ npx @demotime/video export --range act:2 --preset 9:16 --captions notes
41
+
42
+ # A GIF of scenes 1 to 3 of the first act, for a README
43
+ npx @demotime/video export --range act:1/scenes:1-3 --gif --name readme
44
+
45
+ # Everything, with your theme, in a specific folder
46
+ npx @demotime/video export ./my-talk --out ./videos --gif --srt --chapters --cards \
47
+ --extensions eliostruyf.vscode-demotime-theme --settings ./recording-settings.json
48
+ ```
49
+
50
+ `recording-settings.json` holds VS Code settings for the recording, such as
51
+ `{ "workbench.colorTheme": "Demo Time Dark" }`.
52
+
53
+ ## Options
54
+
55
+ | Option | What it does |
56
+ | -------------------------------------------- | ------------------------------------------------------------------------ |
57
+ | `[workspace]` | The folder with the `.demo` folder (default: the current folder) |
58
+ | `--range <range>` | `all` (default), `act:2`, `act:2/scenes:3-5` or `act:2/scenes:3-` |
59
+ | `--preset <preset>` | `16:9` (1920×1080, default), `1:1` (1080×1080) or `9:16` (1080×1920) |
60
+ | `--fps <n>` | Frame rate (default 30) |
61
+ | `--out <dir>`, `--name <name>` | Where the files go (default `<workspace>/.demo/exports/demo.*`) |
62
+ | `--gif`, `--gif-width <px>`, `--gif-fps <n>` | Also write a GIF (default 960 pixels wide, 12 fps) |
63
+ | `--srt` | Also write captions as `<name>.srt`, from scene titles |
64
+ | `--captions titles\|notes` | What the captions say: scene titles (default) or notes; implies `--srt` |
65
+ | `--chapters` | Add chapters to the MP4 and write a chapter list |
66
+ | `--cards`, `--card-seconds <n>` | Add a title and end card from the first and last slide |
67
+ | `--strict` | Fail when a move cannot be recorded, instead of skipping it |
68
+ | `--show-notes` | Keep notes that open with `showOnTrigger` in the video |
69
+ | `--vscode <path>` | The VS Code to record in (default: the installed one) |
70
+ | `--vscode-version <v>` | Download this VS Code version instead: `stable`, `insiders` or `1.105.0` |
71
+ | `--extension <id\|vsix>` | The Demo Time to install (default: the latest from the Marketplace) |
72
+ | `--extensions <ids>` | More extensions to install, comma separated, such as your theme |
73
+ | `--settings <file>` | A JSON file with VS Code settings for the recording |
74
+ | `--vscode-arg=<arg>` | An extra argument for VS Code, such as `--vscode-arg=--disable-gpu` |
75
+ | `--in-place` | Run in the workspace itself instead of a copy |
76
+ | `--copy-node-modules` | Copy `node_modules` into the workspace copy instead of linking them |
77
+ | `--keep-temp` | Keep the temporary profile, workspace copy and frames |
78
+ | `--scene-hold <s>` | Seconds a scene without slides stays on screen (default 2) |
79
+ | `--slide-min <s>`, `--slide-max <s>` | The shortest and longest time a slide stays on screen (default 3 and 12) |
80
+ | `--terminal-timeout <s>` | Seconds a terminal command gets to finish (default 30) |
81
+ | `--timeout <minutes>` | Give up after this long (default 60) |
82
+ | `--ffmpeg <path>` | The ffmpeg to use (default: the bundled one, then `FFMPEG` or `PATH`) |
83
+
84
+ `npx @demotime/video --help` lists them too.
85
+
86
+ ## Captions
87
+
88
+ `--srt` writes the captions as `<name>.srt`, a subtitle file next to the MP4. They aren't burned
89
+ into the picture. Players such as VLC load the file when it has the same name as the video, and
90
+ YouTube, Vimeo and LinkedIn take it as the video's subtitles.
91
+
92
+ - **`--captions titles`** (the default): each scene's title, for its first 4 seconds.
93
+ - **`--captions notes`**: the scene's notes file turned into plain-text sentences, in cues of at
94
+ most two lines. The cues are spread over the scene, and the scene stays on screen long enough to
95
+ read them. Scenes without notes get their title.
96
+
97
+ The [documentation](https://demotime.show/features/video-export/#captions) shows examples of both,
98
+ and how to burn the captions into the picture for social media.
99
+
100
+ ## How it works
101
+
102
+ 1. **A copy of the workspace.** The play runs in a temporary copy, so every export starts from the
103
+ same state and the files it creates or changes don't end up in your workspace. Symbolic links are
104
+ copied as the files they point to. `node_modules` folders are linked instead of copied, so
105
+ scripts in the demo run without a long copy; a demo that installs packages therefore changes your
106
+ real `node_modules`, unless you pass `--copy-node-modules`.
107
+ 2. **A clean VS Code.** VS Code opens with an empty profile and no Chat, tips or other UI. The
108
+ window is sized for the preset, and Demo Time and any extensions you name are installed into the
109
+ profile.
110
+ 3. **The play runs unattended.** Demo Time plays every scene in the range the way a presenter would,
111
+ and hides the status bar, tabs, side bars and panel. After a scene's moves finish, it stays on
112
+ screen for the scene's `autoAdvanceAfter`. Without one, a slide stays for its reading time and
113
+ other scenes for 2 seconds. Terminal commands get up to 30 seconds to finish
114
+ (`--terminal-timeout`).
115
+ 4. **Moves that need a presenter are handled.**
116
+ - `pause` and `waitForInput` continue after a second.
117
+ - Hacker-typer typing becomes character by character.
118
+ - Moves outside VS Code (an external browser, PowerPoint, desktop and macOS moves) are skipped
119
+ with a warning.
120
+ 5. **The window is recorded.** The DevTools screencast captures only the VS Code window, not the
121
+ rest of your screen. The frames are resampled to a fixed frame rate and cut from the first to the
122
+ last scene.
123
+ 6. **ffmpeg encodes the files.** It writes the MP4 with its chapters and the GIF. The CLI writes the
124
+ captions and the chapter list from the timing of each scene.
125
+
126
+ ## Run it in CI
127
+
128
+ The export needs no one at the keyboard, so CI can keep the video in sync with the demo. On Linux,
129
+ run it under a virtual display:
130
+
131
+ ```yaml
132
+ - run: >
133
+ xvfb-run -a npx --yes @demotime/video export . --vscode-version stable --out video --gif
134
+ --chapters --srt
135
+ - uses: actions/upload-artifact@v6
136
+ with:
137
+ name: demo-video
138
+ path: video
139
+ ```
140
+
141
+ The [documentation](https://demotime.show/features/video-export/#keep-the-video-in-sync-in-ci) has a
142
+ complete workflow.
143
+
144
+ ## Requirements
145
+
146
+ - **Node.js 20 or later.**
147
+ - **VS Code**: the installed one is used. With `--vscode-version`, or when none is installed, it is
148
+ downloaded.
149
+ - **Demo Time with video export support**: installed from the Marketplace automatically. Pass
150
+ `--extension` for a specific version or a VSIX.
151
+ - **ffmpeg**: a static build is installed with the package. Otherwise pass `--ffmpeg` or set
152
+ `FFMPEG`.
153
+ - **A display**: on Linux without one, use `xvfb-run -a`.
154
+
155
+ While it records, a VS Code window opens on your screen. Leave it alone until it closes.
156
+
157
+ ## Limitations
158
+
159
+ - Only the main VS Code window is recorded: not the presenter view, other windows, native dialogs or
160
+ other apps.
161
+ - The play runs in a copy of the workspace folder. For paths outside the folder, or a monorepo
162
+ package that needs the parent's `node_modules`, use `--in-place`.
163
+ - A terminal command that keeps running, such as a dev server, holds its scene for
164
+ `--terminal-timeout` seconds.
165
+
166
+ ## Beta
167
+
168
+ Every change on the `dev` branch of Demo Time can be published as a beta:
169
+ `npx @demotime/video@next export`. The beta (pre-release) version of the Demo Time extension uses
170
+ it.
171
+
172
+ ## Development
173
+
174
+ ```bash
175
+ yarn install
176
+ npx nx build common
177
+ cd apps/video
178
+ npm run build
179
+ npx jest
180
+ node dist/cli.js export ../../promo/demo/ship-it --extension path/to/demo-time.vsix
181
+ ```
182
+
183
+ ## License
184
+
185
+ Apache License 2.0. See the [LICENSE](./LICENSE) file.
186
+
187
+ <br />
188
+
189
+ <p align="center">
190
+ <a href="https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Festruyf%2Fvscode-demo-time%2Ftree%2Fmain%2Fapps%2Fvideo">
191
+ <img src="https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Festruyf%2Fvscode-demo-time%2Ftree%2Fmain%2Fapps%2Fvideo&labelColor=%23555555&countColor=%2397ca00" height="25px" alt="Demo Time video CLI visitors" />
192
+ </a>
193
+ </p>
package/dist/args.js ADDED
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseExportArgs = exports.USAGE = void 0;
4
+ const node_util_1 = require("node:util");
5
+ const node_path_1 = require("node:path");
6
+ const presets_1 = require("./presets");
7
+ exports.USAGE = `Usage: demotime-video export [workspace] [options]
8
+
9
+ Runs a Demo Time play unattended in VS Code, records it, and writes an MP4.
10
+
11
+ Options:
12
+ --range <range> all (default), act:2, act:2/scenes:3-5 or act:2/scenes:3-
13
+ --preset <preset> 16:9 (default), 1:1 or 9:16
14
+ --fps <n> Frame rate (default 30)
15
+ --out <dir> Output folder (default <workspace>/.demo/exports)
16
+ --name <name> File name without extension (default "demo")
17
+ --gif Also write a GIF
18
+ --gif-width <px> GIF width (default 960)
19
+ --gif-fps <n> GIF frame rate (default 12)
20
+ --srt Also write captions as an SRT file, next to the MP4
21
+ --captions <source> What the captions say: titles (default) or notes;
22
+ implies --srt
23
+ --chapters Add chapter markers and write a chapter list
24
+ --cards Add a title and end card from the first and last slide
25
+ --card-seconds <n> How long each card shows (default 3)
26
+ --strict Fail when a move cannot be recorded instead of skipping it
27
+ --show-notes Keep scene notes that open on trigger in the video
28
+ --vscode <path> VS Code executable or app to record in (default: the installed one)
29
+ --vscode-version <v> Download this VS Code version instead (stable, insiders, 1.105.0)
30
+ --extension <id|vsix> Demo Time to install (default eliostruyf.vscode-demo-time)
31
+ --extensions <ids> More extensions to install, comma separated (a theme, for example)
32
+ --settings <file> JSON file with VS Code user settings for the recording
33
+ --vscode-arg=<arg> Extra argument for VS Code, such as --vscode-arg=--disable-gpu;
34
+ repeat for more
35
+ --in-place Run in the workspace itself instead of a temporary copy
36
+ --copy-node-modules Copy node_modules into the workspace copy instead of linking
37
+ them, so a demo that installs packages leaves yours alone
38
+ --keep-temp Keep the temporary profile, workspace copy and frames
39
+ --scene-hold <s> Seconds a scene without slides stays on screen (default 2)
40
+ --slide-min <s> Minimum seconds for a slide (default 3)
41
+ --slide-max <s> Maximum seconds for a slide's reading time (default 12)
42
+ --terminal-timeout <s> Seconds a terminal command gets to finish (default 30)
43
+ --timeout <minutes> Give up after this long (default 60)
44
+ --ffmpeg <path> ffmpeg to use (default: ffmpeg-static, FFMPEG, or PATH)
45
+ -h, --help Show this help
46
+ `;
47
+ /// The largest value each number option takes. Anything above is a typo, and would make the
48
+ /// export plan billions of frames or wait for days.
49
+ const MAX = {
50
+ fps: 120,
51
+ 'gif-width': 3840,
52
+ 'gif-fps': 50,
53
+ 'card-seconds': 60,
54
+ timeout: 24 * 60,
55
+ 'scene-hold': 600,
56
+ 'slide-min': 600,
57
+ 'slide-max': 600,
58
+ 'terminal-timeout': 3600,
59
+ };
60
+ const toNumber = (value, name, fallback) => {
61
+ if (value === undefined) {
62
+ return fallback;
63
+ }
64
+ const number = Number(value);
65
+ if (!Number.isFinite(number) || number <= 0) {
66
+ throw new Error(`--${name} needs a positive number, got "${value}".`);
67
+ }
68
+ if (MAX[name] !== undefined && number > MAX[name]) {
69
+ throw new Error(`--${name} can be at most ${MAX[name]}, got "${value}".`);
70
+ }
71
+ return number;
72
+ };
73
+ const optionalNumber = (value, name) => value === undefined ? undefined : toNumber(value, name, 0);
74
+ /**
75
+ * Parses the `export` command's arguments. Returns `undefined` when help was asked for.
76
+ */
77
+ const parseExportArgs = (argv, cwd = process.cwd()) => {
78
+ const { values, positionals } = (0, node_util_1.parseArgs)({
79
+ args: argv,
80
+ allowPositionals: true,
81
+ strict: true,
82
+ options: {
83
+ range: { type: 'string' },
84
+ preset: { type: 'string' },
85
+ fps: { type: 'string' },
86
+ out: { type: 'string' },
87
+ name: { type: 'string' },
88
+ gif: { type: 'boolean' },
89
+ 'gif-width': { type: 'string' },
90
+ 'gif-fps': { type: 'string' },
91
+ srt: { type: 'boolean' },
92
+ captions: { type: 'string' },
93
+ chapters: { type: 'boolean' },
94
+ cards: { type: 'boolean' },
95
+ 'card-seconds': { type: 'string' },
96
+ strict: { type: 'boolean' },
97
+ 'show-notes': { type: 'boolean' },
98
+ vscode: { type: 'string' },
99
+ 'vscode-version': { type: 'string' },
100
+ extension: { type: 'string' },
101
+ extensions: { type: 'string' },
102
+ settings: { type: 'string' },
103
+ 'vscode-arg': { type: 'string', multiple: true },
104
+ 'in-place': { type: 'boolean' },
105
+ 'keep-temp': { type: 'boolean' },
106
+ 'copy-node-modules': { type: 'boolean' },
107
+ timeout: { type: 'string' },
108
+ 'scene-hold': { type: 'string' },
109
+ 'slide-min': { type: 'string' },
110
+ 'slide-max': { type: 'string' },
111
+ 'terminal-timeout': { type: 'string' },
112
+ ffmpeg: { type: 'string' },
113
+ help: { type: 'boolean', short: 'h' },
114
+ },
115
+ });
116
+ if (values.help) {
117
+ return undefined;
118
+ }
119
+ if (positionals.length > 1) {
120
+ throw new Error(`Expected one workspace folder, got: ${positionals.join(', ')}.`);
121
+ }
122
+ const abs = (path) => ((0, node_path_1.isAbsolute)(path) ? path : (0, node_path_1.resolve)(cwd, path));
123
+ const workspace = abs(positionals[0] ?? '.');
124
+ const captions = (values.captions ?? 'titles');
125
+ if (captions !== 'titles' && captions !== 'notes') {
126
+ throw new Error(`--captions is "titles" or "notes", got "${values.captions}".`);
127
+ }
128
+ const name = values.name ?? 'demo';
129
+ // "." and ".." pass the character check but point at the output folder or its parent
130
+ if (!/^[\w.-]+$/.test(name) || /^\.+$/.test(name)) {
131
+ throw new Error(`--name can only use letters, numbers, ".", "-" and "_", got "${name}".`);
132
+ }
133
+ const minSlideSeconds = optionalNumber(values['slide-min'], 'slide-min');
134
+ const maxSlideSeconds = optionalNumber(values['slide-max'], 'slide-max');
135
+ if (minSlideSeconds !== undefined &&
136
+ maxSlideSeconds !== undefined &&
137
+ minSlideSeconds > maxSlideSeconds) {
138
+ throw new Error('--slide-min cannot be more than --slide-max.');
139
+ }
140
+ return {
141
+ workspace,
142
+ range: values.range ?? 'all',
143
+ preset: (0, presets_1.getPreset)(values.preset ?? '16:9'),
144
+ fps: toNumber(values.fps, 'fps', 30),
145
+ outDir: values.out ? abs(values.out) : (0, node_path_1.join)(workspace, '.demo', 'exports'),
146
+ name,
147
+ gif: !!values.gif,
148
+ gifWidth: toNumber(values['gif-width'], 'gif-width', 960),
149
+ gifFps: toNumber(values['gif-fps'], 'gif-fps', 12),
150
+ // Asking for a caption source is asking for captions
151
+ srt: !!values.srt || values.captions !== undefined,
152
+ captions,
153
+ chapters: !!values.chapters,
154
+ cards: !!values.cards,
155
+ cardSeconds: toNumber(values['card-seconds'], 'card-seconds', 3),
156
+ strict: !!values.strict,
157
+ showNotes: !!values['show-notes'],
158
+ vscodePath: values.vscode ? abs(values.vscode) : undefined,
159
+ vscodeVersion: values['vscode-version'],
160
+ extension: values.extension
161
+ ? /\.vsix$/i.test(values.extension)
162
+ ? abs(values.extension)
163
+ : values.extension
164
+ : 'eliostruyf.vscode-demo-time',
165
+ extensions: (values.extensions ?? '')
166
+ .split(',')
167
+ .map((id) => id.trim())
168
+ .filter(Boolean),
169
+ settingsFile: values.settings ? abs(values.settings) : undefined,
170
+ vscodeArgs: values['vscode-arg'] ?? [],
171
+ inPlace: !!values['in-place'],
172
+ copyNodeModules: !!values['copy-node-modules'],
173
+ keepTemp: !!values['keep-temp'],
174
+ timeoutMinutes: toNumber(values.timeout, 'timeout', 60),
175
+ timing: {
176
+ sceneHoldSeconds: optionalNumber(values['scene-hold'], 'scene-hold'),
177
+ minSlideSeconds,
178
+ maxSlideSeconds,
179
+ terminalTimeoutSeconds: optionalNumber(values['terminal-timeout'], 'terminal-timeout'),
180
+ },
181
+ ffmpegPath: values.ffmpeg ? abs(values.ffmpeg) : undefined,
182
+ };
183
+ };
184
+ exports.parseExportArgs = parseExportArgs;
185
+ //# sourceMappingURL=args.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"args.js","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":";;;AAAA,yCAAsC;AACtC,yCAAsD;AACtD,uCAA8C;AA+CjC,QAAA,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCpB,CAAC;AAEF,4FAA4F;AAC5F,oDAAoD;AACpD,MAAM,GAAG,GAA2B;IAClC,GAAG,EAAE,GAAG;IACR,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,EAAE;IACb,cAAc,EAAE,EAAE;IAClB,OAAO,EAAE,EAAE,GAAG,EAAE;IAChB,YAAY,EAAE,GAAG;IACjB,WAAW,EAAE,GAAG;IAChB,WAAW,EAAE,GAAG;IAChB,kBAAkB,EAAE,IAAI;CACzB,CAAC;AAEF,MAAM,QAAQ,GAAG,CAAC,KAAyB,EAAE,IAAY,EAAE,QAAgB,EAAU,EAAE;IACrF,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,kCAAkC,KAAK,IAAI,CAAC,CAAC;IACxE,CAAC;IACD,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,IAAI,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CAAC,KAAK,IAAI,mBAAmB,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,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