automovie 0.0.0 → 0.2.0
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/README.md +145 -18
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +16 -0
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +14 -0
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +15 -0
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +6 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +14 -0
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -0
- package/lib/AutoMovieCaptureBackend.d.ts +9 -0
- package/lib/{IAutoMoviePackageManager.js → AutoMovieCaptureBackend.js} +1 -1
- package/lib/AutoMovieCaptureBackend.js.map +1 -0
- package/lib/AutoMovieCaptureHost.d.ts +114 -0
- package/lib/AutoMovieCaptureHost.js +219 -0
- package/lib/AutoMovieCaptureHost.js.map +1 -0
- package/lib/AutoMovieCommand.d.ts +24 -13
- package/lib/IAutoMovieChromium.d.ts +75 -0
- package/lib/IAutoMovieChromium.js +3 -0
- package/lib/IAutoMovieChromium.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -0
- package/lib/captureAutoMovie.js +133 -0
- package/lib/captureAutoMovie.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +1 -1
- package/lib/deriveAutoMovieProjectName.js +1 -1
- package/lib/findAutoMovieFreePort.d.ts +14 -0
- package/lib/findAutoMovieFreePort.js +61 -0
- package/lib/findAutoMovieFreePort.js.map +1 -0
- package/lib/formatAutoMovieInspectUrl.d.ts +14 -0
- package/lib/formatAutoMovieInspectUrl.js +24 -0
- package/lib/formatAutoMovieInspectUrl.js.map +1 -0
- package/lib/index.d.ts +30 -2
- package/lib/index.js +30 -2
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +19 -0
- package/lib/inspectAutoMovie.js +97 -0
- package/lib/inspectAutoMovie.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +28 -0
- package/lib/launchAutoMovieChromium.js +42 -0
- package/lib/launchAutoMovieChromium.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +14 -0
- package/lib/loadAutoMovieProductionModule.js +61 -0
- package/lib/loadAutoMovieProductionModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +27 -0
- package/lib/planAutoMovieChromiumLaunch.js +34 -0
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +37 -0
- package/lib/planAutoMovieModulePageViteConfig.js +27 -0
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +1 -1
- package/lib/readAutoMovieAddArguments.js +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +36 -0
- package/lib/readAutoMovieCaptureHostOptions.js +57 -0
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -0
- package/lib/readAutoMovieCommandArguments.d.ts +1 -1
- package/lib/readAutoMovieCommandArguments.js +10 -5
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +1 -1
- package/lib/readAutoMovieCreateArguments.js +1 -1
- package/lib/readAutoMovieInspectHostOptions.d.ts +29 -0
- package/lib/readAutoMovieInspectHostOptions.js +48 -0
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +33 -0
- package/lib/readAutoMovieRenderOptions.js +51 -0
- package/lib/readAutoMovieRenderOptions.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +27 -0
- package/lib/readAutoMovieReviewOptions.js +54 -0
- package/lib/readAutoMovieReviewOptions.js.map +1 -0
- package/lib/readAutoMovieRevision.d.ts +12 -0
- package/lib/readAutoMovieRevision.js +32 -0
- package/lib/readAutoMovieRevision.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +23 -0
- package/lib/readAutoMovieVideoProbe.js +39 -0
- package/lib/readAutoMovieVideoProbe.js.map +1 -0
- package/lib/recordAutoMoviePlayback.d.ts +37 -0
- package/lib/recordAutoMoviePlayback.js +122 -0
- package/lib/recordAutoMoviePlayback.js.map +1 -0
- package/lib/renderAutoMovie.d.ts +21 -0
- package/lib/renderAutoMovie.js +95 -0
- package/lib/renderAutoMovie.js.map +1 -0
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +3 -5
- package/lib/renderAutoMovieScaffoldNextSteps.js +5 -14
- package/lib/renderAutoMovieScaffoldNextSteps.js.map +1 -1
- package/lib/renderAutoMovieVideo.d.ts +35 -0
- package/lib/renderAutoMovieVideo.js +110 -0
- package/lib/renderAutoMovieVideo.js.map +1 -0
- package/lib/resolveAutoMovieFfmpeg.d.ts +19 -0
- package/lib/resolveAutoMovieFfmpeg.js +32 -0
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -0
- package/lib/reviewAutoMovie.d.ts +21 -0
- package/lib/reviewAutoMovie.js +71 -0
- package/lib/reviewAutoMovie.js.map +1 -0
- package/lib/run.d.ts +14 -11
- package/lib/run.js +103 -67
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieFfmpeg.d.ts +14 -0
- package/lib/runAutoMovieFfmpeg.js +40 -0
- package/lib/runAutoMovieFfmpeg.js.map +1 -0
- package/lib/serveAutoMovieDrawPage.d.ts +28 -0
- package/lib/serveAutoMovieDrawPage.js +108 -0
- package/lib/serveAutoMovieDrawPage.js.map +1 -0
- package/lib/serveAutoMovieInspectorPage.d.ts +32 -0
- package/lib/serveAutoMovieInspectorPage.js +52 -0
- package/lib/serveAutoMovieInspectorPage.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +38 -0
- package/lib/writeAutoMovieModulePage.js +75 -0
- package/lib/writeAutoMovieModulePage.js.map +1 -0
- package/package.json +27 -6
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +12 -0
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +10 -0
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +11 -0
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +10 -0
- package/src/AutoMovieCaptureBackend.ts +9 -0
- package/src/AutoMovieCaptureHost.ts +245 -0
- package/src/AutoMovieCommand.ts +28 -13
- package/src/IAutoMovieChromium.ts +78 -0
- package/src/captureAutoMovie.ts +148 -0
- package/src/deriveAutoMovieProjectName.ts +1 -1
- package/src/findAutoMovieFreePort.ts +27 -0
- package/src/formatAutoMovieInspectUrl.ts +25 -0
- package/src/index.ts +30 -2
- package/src/inspectAutoMovie.ts +81 -0
- package/src/launchAutoMovieChromium.ts +61 -0
- package/src/loadAutoMovieProductionModule.ts +30 -0
- package/src/planAutoMovieChromiumLaunch.ts +45 -0
- package/src/planAutoMovieModulePageViteConfig.ts +53 -0
- package/src/readAutoMovieAddArguments.ts +1 -1
- package/src/readAutoMovieCaptureHostOptions.ts +76 -0
- package/src/readAutoMovieCommandArguments.ts +6 -4
- package/src/readAutoMovieCreateArguments.ts +1 -1
- package/src/readAutoMovieInspectHostOptions.ts +66 -0
- package/src/readAutoMovieRenderOptions.ts +67 -0
- package/src/readAutoMovieReviewOptions.ts +70 -0
- package/src/readAutoMovieRevision.ts +29 -0
- package/src/readAutoMovieVideoProbe.ts +55 -0
- package/src/recordAutoMoviePlayback.ts +168 -0
- package/src/renderAutoMovie.ts +86 -0
- package/src/renderAutoMovieScaffoldNextSteps.ts +4 -18
- package/src/renderAutoMovieVideo.ts +127 -0
- package/src/resolveAutoMovieFfmpeg.ts +33 -0
- package/src/reviewAutoMovie.ts +65 -0
- package/src/run.ts +116 -105
- package/src/runAutoMovieFfmpeg.ts +50 -0
- package/src/serveAutoMovieDrawPage.ts +105 -0
- package/src/serveAutoMovieInspectorPage.ts +82 -0
- package/src/writeAutoMovieModulePage.ts +83 -0
- package/lib/IAutoMoviePackageManager.d.ts +0 -14
- package/lib/IAutoMoviePackageManager.js.map +0 -1
- package/lib/readAutoMovieSyncArguments.d.ts +0 -13
- package/lib/readAutoMovieSyncArguments.js +0 -49
- package/lib/readAutoMovieSyncArguments.js.map +0 -1
- package/lib/selectAutoMoviePackageManager.d.ts +0 -23
- package/lib/selectAutoMoviePackageManager.js +0 -70
- package/lib/selectAutoMoviePackageManager.js.map +0 -1
- package/src/IAutoMoviePackageManager.ts +0 -15
- package/src/readAutoMovieSyncArguments.ts +0 -48
- package/src/selectAutoMoviePackageManager.ts +0 -45
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planAutoMovieModulePageViteConfig.js","sourceRoot":"","sources":["../src/planAutoMovieModulePageViteConfig.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,2CAAkD,IASjD;IAsBC,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,MAAM;QACjB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,MAAM;QAChB,WAAW,EAAE,KAAK;QAClB,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE;KAC1C,CAAC;AACJ,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
|
9
9
|
* @throws On an unknown or repeated option, a missing name value, a target count other than one, an unknown family, or a refused directory segment.
|
|
10
10
|
*
|
|
11
11
|
* @evidence contracts/development/implementation.md#principled-implementation The directory segment passes the same portable-segment rule as a project name and must equal its trimmed form, so no separator, `.`, `..` or padding reaches the joined path.
|
|
12
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create; the template owns the segment rule and `run` owns the workspace path.
|
|
13
13
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No family is inferred from the name and no workspace is searched for; the family is typed explicitly.
|
|
14
14
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the family pair, the segment rule and why it matters, and what throws.
|
|
15
15
|
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens and one split of the target.
|
|
@@ -13,7 +13,7 @@ const readAutoMovieNameOption_1 = require("./readAutoMovieNameOption");
|
|
|
13
13
|
* @throws On an unknown or repeated option, a missing name value, a target count other than one, an unknown family, or a refused directory segment.
|
|
14
14
|
*
|
|
15
15
|
* @evidence contracts/development/implementation.md#principled-implementation The directory segment passes the same portable-segment rule as a project name and must equal its trimmed form, so no separator, `.`, `..` or padding reaches the joined path.
|
|
16
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The add grammar is separate from create; the template owns the segment rule and `run` owns the workspace path.
|
|
17
17
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No family is inferred from the name and no workspace is searched for; the family is typed explicitly.
|
|
18
18
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the family pair, the segment rule and why it matters, and what throws.
|
|
19
19
|
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens and one split of the target.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AutoMovieCaptureBackend } from "./AutoMovieCaptureBackend";
|
|
2
|
+
/**
|
|
3
|
+
* Split the options of `automovie capture` into the host's own, `AUTOMOVIE_CAPTURE_OPTIONS`, and the capture request's, which `parseAutoMovieCapturePlanRequest` reads.
|
|
4
|
+
*
|
|
5
|
+
* | Option | Meaning | Absent |
|
|
6
|
+
* | --- | --- | --- |
|
|
7
|
+
* | `--module <file>` | The subject module whose `subjects` the draw page offers | Required unless `--file` |
|
|
8
|
+
* | `--file <video>` | An encoded video file captured from its own frames instead of a drawn subject | A drawn subject |
|
|
9
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with, for subjects built from data a host computes | `null` |
|
|
10
|
+
* | `--out <folder>` | The capture's root folder | `media/capture/<subject>` |
|
|
11
|
+
* | `--backend <software\|gpu>` | How the browser draws | `software` |
|
|
12
|
+
*
|
|
13
|
+
* Every other option is left for the request reader, which refuses one it does not know. It throws for `--module` beside `--file`, neither of them, an empty value of any host option, and a backend that is not `software` or `gpu`.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the host's options with their meaning and absent value, says where the rest go, and states every refusal.
|
|
16
|
+
* @evidence contracts/development/implementation.md#principled-implementation The host's keys are removed before the request is read, so the request grammar stays one grammar for the address, the command and props, and a host key cannot be mistaken for a request key.
|
|
17
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the listed options that takes the host's keys out, then the checks; the list is the one the README test reads.
|
|
18
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No subject module is guessed from the folder: a capture names what it draws.
|
|
19
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
20
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
21
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh map and keeps nothing.
|
|
22
|
+
*/
|
|
23
|
+
export declare function readAutoMovieCaptureHostOptions(values: ReadonlyMap<string, string>): {
|
|
24
|
+
/** Subject module path, or null for a video file. */
|
|
25
|
+
module: string | null;
|
|
26
|
+
/** Video file path, or null for a drawn subject. */
|
|
27
|
+
file: string | null;
|
|
28
|
+
/** Path of the props JSON file, or null for none. */
|
|
29
|
+
props: string | null;
|
|
30
|
+
/** Root folder, or null for the default. */
|
|
31
|
+
out: string | null;
|
|
32
|
+
/** How the browser draws. */
|
|
33
|
+
backend: AutoMovieCaptureBackend;
|
|
34
|
+
/** The request's own options, for the request reader. */
|
|
35
|
+
request: Map<string, string>;
|
|
36
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieCaptureHostOptions = readAutoMovieCaptureHostOptions;
|
|
4
|
+
const AUTOMOVIE_CAPTURE_OPTIONS_1 = require("./AUTOMOVIE_CAPTURE_OPTIONS");
|
|
5
|
+
/**
|
|
6
|
+
* Split the options of `automovie capture` into the host's own, `AUTOMOVIE_CAPTURE_OPTIONS`, and the capture request's, which `parseAutoMovieCapturePlanRequest` reads.
|
|
7
|
+
*
|
|
8
|
+
* | Option | Meaning | Absent |
|
|
9
|
+
* | --- | --- | --- |
|
|
10
|
+
* | `--module <file>` | The subject module whose `subjects` the draw page offers | Required unless `--file` |
|
|
11
|
+
* | `--file <video>` | An encoded video file captured from its own frames instead of a drawn subject | A drawn subject |
|
|
12
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with, for subjects built from data a host computes | `null` |
|
|
13
|
+
* | `--out <folder>` | The capture's root folder | `media/capture/<subject>` |
|
|
14
|
+
* | `--backend <software\|gpu>` | How the browser draws | `software` |
|
|
15
|
+
*
|
|
16
|
+
* Every other option is left for the request reader, which refuses one it does not know. It throws for `--module` beside `--file`, neither of them, an empty value of any host option, and a backend that is not `software` or `gpu`.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the host's options with their meaning and absent value, says where the rest go, and states every refusal.
|
|
19
|
+
* @evidence contracts/development/implementation.md#principled-implementation The host's keys are removed before the request is read, so the request grammar stays one grammar for the address, the command and props, and a host key cannot be mistaken for a request key.
|
|
20
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the listed options that takes the host's keys out, then the checks; the list is the one the README test reads.
|
|
21
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No subject module is guessed from the folder: a capture names what it draws.
|
|
22
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
24
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh map and keeps nothing.
|
|
25
|
+
*/
|
|
26
|
+
function readAutoMovieCaptureHostOptions(values) {
|
|
27
|
+
const request = new Map(values);
|
|
28
|
+
const taken = new Map();
|
|
29
|
+
for (const key of AUTOMOVIE_CAPTURE_OPTIONS_1.AUTOMOVIE_CAPTURE_OPTIONS) {
|
|
30
|
+
const value = request.get(key);
|
|
31
|
+
request.delete(key);
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
if (value.trim() === "")
|
|
35
|
+
throw new Error(`Capture option --${key} needs a value`);
|
|
36
|
+
taken.set(key, value);
|
|
37
|
+
}
|
|
38
|
+
const module = taken.get("module") ?? null;
|
|
39
|
+
const file = taken.get("file") ?? null;
|
|
40
|
+
const out = taken.get("out") ?? null;
|
|
41
|
+
const backend = taken.get("backend") ?? "software";
|
|
42
|
+
if (module !== null && file !== null)
|
|
43
|
+
throw new Error("Capture takes --module or --file, not both");
|
|
44
|
+
if (module === null && file === null)
|
|
45
|
+
throw new Error("Capture needs --module <subject module> to draw a subject, or --file <video> to capture a video file");
|
|
46
|
+
if (backend !== "software" && backend !== "gpu")
|
|
47
|
+
throw new Error(`Capture --backend "${backend}" is not software or gpu`);
|
|
48
|
+
return {
|
|
49
|
+
module,
|
|
50
|
+
file,
|
|
51
|
+
props: taken.get("props") ?? null,
|
|
52
|
+
out,
|
|
53
|
+
backend,
|
|
54
|
+
request,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=readAutoMovieCaptureHostOptions.js.map
|
|
@@ -0,0 +1 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OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,KAAK;QAC7C,MAAM,IAAI,KAAK,CAAC,sBAAsB,OAAO,0BAA0B,CAAC,CAAC;IAC3E,OAAO;QACL,MAAM;QACN,IAAI;QACJ,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI;QACjC,GAAG;QACH,OAAO;QACP,OAAO;KACR,CAAC;AACJ,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { type AutoMovieCommand } from "./AutoMovieCommand";
|
|
|
2
2
|
/**
|
|
3
3
|
* Resolve one complete CLI request before any scaffold publication begins.
|
|
4
4
|
*
|
|
5
|
-
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create
|
|
5
|
+
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create` and `add` delegate their grammars to {@link readAutoMovieCreateArguments} and {@link readAutoMovieAddArguments}; `capture`, `inspect`, `render` and `review` keep their tokens for the production's option reader, which `run` loads. Every refusal throws an `Error` whose message names the correction.
|
|
6
6
|
*
|
|
7
7
|
* @param args The command-line tokens after the executable and script.
|
|
8
8
|
* @returns The admitted request.
|
|
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readAutoMovieCommandArguments = readAutoMovieCommandArguments;
|
|
4
4
|
const readAutoMovieAddArguments_1 = require("./readAutoMovieAddArguments");
|
|
5
5
|
const readAutoMovieCreateArguments_1 = require("./readAutoMovieCreateArguments");
|
|
6
|
-
const readAutoMovieSyncArguments_1 = require("./readAutoMovieSyncArguments");
|
|
7
6
|
/**
|
|
8
7
|
* Resolve one complete CLI request before any scaffold publication begins.
|
|
9
8
|
*
|
|
10
|
-
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create
|
|
9
|
+
* `args` excludes the node executable and script positions. No arguments, or a lone `-h`/`--help`, means help; a lone `-v`/`--version` means version. `create` and `add` delegate their grammars to {@link readAutoMovieCreateArguments} and {@link readAutoMovieAddArguments}; `capture`, `inspect`, `render` and `review` keep their tokens for the production's option reader, which `run` loads. Every refusal throws an `Error` whose message names the correction.
|
|
11
10
|
*
|
|
12
11
|
* @param args The command-line tokens after the executable and script.
|
|
13
12
|
* @returns The admitted request.
|
|
@@ -33,9 +32,15 @@ function readAutoMovieCommandArguments(args) {
|
|
|
33
32
|
return (0, readAutoMovieCreateArguments_1.readAutoMovieCreateArguments)(rest);
|
|
34
33
|
if (command === "add")
|
|
35
34
|
return (0, readAutoMovieAddArguments_1.readAutoMovieAddArguments)(rest);
|
|
36
|
-
if (command === "
|
|
37
|
-
return
|
|
38
|
-
|
|
35
|
+
if (command === "capture")
|
|
36
|
+
return { command: "capture", args: [...rest] };
|
|
37
|
+
if (command === "inspect")
|
|
38
|
+
return { command: "inspect", args: [...rest] };
|
|
39
|
+
if (command === "render")
|
|
40
|
+
return { command: "render", args: [...rest] };
|
|
41
|
+
if (command === "review")
|
|
42
|
+
return { command: "review", args: [...rest] };
|
|
43
|
+
throw new Error(`Unknown command ${JSON.stringify(command)}; the commands are create, add, capture, inspect, render and review (see --help).`);
|
|
39
44
|
}
|
|
40
45
|
/** Admit a standalone flag only when no other argument follows it. */
|
|
41
46
|
function standalone(flag, rest, request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAutoMovieCommandArguments.js","sourceRoot":"","sources":["../src/readAutoMovieCommandArguments.ts"],"names":[],"mappings":";;;AACA,2EAAwE;AACxE,iFAA8E;
|
|
1
|
+
{"version":3,"file":"readAutoMovieCommandArguments.js","sourceRoot":"","sources":["../src/readAutoMovieCommandArguments.ts"],"names":[],"mappings":";;;AACA,2EAAwE;AACxE,iFAA8E;AAE9E;;;;;;;;;;;;;;;;GAgBG;AACH,uCACE,IAAuB;IAEvB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,O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IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IAC7E,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
|
9
9
|
* @throws On an unknown or repeated option, a missing name value, or anything other than one non-blank directory.
|
|
10
10
|
*
|
|
11
11
|
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right scan admits each flag once and consumes `--name`'s value, so every token is classified before any filesystem work.
|
|
12
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The create grammar is separate from add
|
|
12
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The create grammar is separate from add; `readAutoMovieNameOption` owns the shared value rule and `run` owns resolution.
|
|
13
13
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default directory, inferred workspace mode or derived name is introduced here.
|
|
14
14
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the dash-leading spelling and that refusals name their correction.
|
|
15
15
|
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens.
|
|
@@ -12,7 +12,7 @@ const readAutoMovieNameOption_1 = require("./readAutoMovieNameOption");
|
|
|
12
12
|
* @throws On an unknown or repeated option, a missing name value, or anything other than one non-blank directory.
|
|
13
13
|
*
|
|
14
14
|
* @evidence contracts/development/implementation.md#principled-implementation A complete left-to-right scan admits each flag once and consumes `--name`'s value, so every token is classified before any filesystem work.
|
|
15
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The create grammar is separate from add
|
|
15
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The create grammar is separate from add; `readAutoMovieNameOption` owns the shared value rule and `run` owns resolution.
|
|
16
16
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No default directory, inferred workspace mode or derived name is introduced here.
|
|
17
17
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states the grammar, the dash-leading spelling and that refusals name their correction.
|
|
18
18
|
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split the options of `automovie inspect` into the command's own, `AUTOMOVIE_INSPECT_OPTIONS`, and the request the page opens on, which `parseAutoMovieCapturePlanRequest` reads.
|
|
3
|
+
*
|
|
4
|
+
* | Option | Meaning | Absent |
|
|
5
|
+
* | --- | --- | --- |
|
|
6
|
+
* | `--module <file>` | The subject module whose `subjects` the inspector page offers | Required |
|
|
7
|
+
* | `--port <n>` | The port the page is served on, 1 to 65535 | A free port |
|
|
8
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with, for a module whose subjects are built from data a host computes, such as a motion case | `null` |
|
|
9
|
+
*
|
|
10
|
+
* Every other option is left for the request reader, which refuses one it does not know. It throws for a missing `--module`, an empty value of any of its options, and a port that is not a whole number from 1 to 65535.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the command's options with their meaning and absent value, says where the rest go, and states every refusal.
|
|
13
|
+
* @evidence contracts/development/implementation.md#principled-implementation The command's keys are removed before the request is read, as the capture command does, so the address and the command line share one grammar and a command key cannot be mistaken for a request key.
|
|
14
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass that takes the command's keys out, then the checks.
|
|
15
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No module is guessed from the folder: the page shows what the command names.
|
|
16
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
17
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
18
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh map and keeps nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readAutoMovieInspectHostOptions(values: ReadonlyMap<string, string>): {
|
|
21
|
+
/** Subject module path, relative to the production or absolute. */
|
|
22
|
+
module: string;
|
|
23
|
+
/** The port to serve on, or null for a free one. */
|
|
24
|
+
port: number | null;
|
|
25
|
+
/** Path of the props JSON file, relative to the production or absolute, or null for none. */
|
|
26
|
+
props: string | null;
|
|
27
|
+
/** The request's own options, for the request reader. */
|
|
28
|
+
request: Map<string, string>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieInspectHostOptions = readAutoMovieInspectHostOptions;
|
|
4
|
+
const AUTOMOVIE_INSPECT_OPTIONS_1 = require("./AUTOMOVIE_INSPECT_OPTIONS");
|
|
5
|
+
/** Highest TCP port. */
|
|
6
|
+
const PORTS = 65_535;
|
|
7
|
+
/**
|
|
8
|
+
* Split the options of `automovie inspect` into the command's own, `AUTOMOVIE_INSPECT_OPTIONS`, and the request the page opens on, which `parseAutoMovieCapturePlanRequest` reads.
|
|
9
|
+
*
|
|
10
|
+
* | Option | Meaning | Absent |
|
|
11
|
+
* | --- | --- | --- |
|
|
12
|
+
* | `--module <file>` | The subject module whose `subjects` the inspector page offers | Required |
|
|
13
|
+
* | `--port <n>` | The port the page is served on, 1 to 65535 | A free port |
|
|
14
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with, for a module whose subjects are built from data a host computes, such as a motion case | `null` |
|
|
15
|
+
*
|
|
16
|
+
* Every other option is left for the request reader, which refuses one it does not know. It throws for a missing `--module`, an empty value of any of its options, and a port that is not a whole number from 1 to 65535.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the command's options with their meaning and absent value, says where the rest go, and states every refusal.
|
|
19
|
+
* @evidence contracts/development/implementation.md#principled-implementation The command's keys are removed before the request is read, as the capture command does, so the address and the command line share one grammar and a command key cannot be mistaken for a request key.
|
|
20
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass that takes the command's keys out, then the checks.
|
|
21
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No module is guessed from the folder: the page shows what the command names.
|
|
22
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
24
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh map and keeps nothing.
|
|
25
|
+
*/
|
|
26
|
+
function readAutoMovieInspectHostOptions(values) {
|
|
27
|
+
const request = new Map(values);
|
|
28
|
+
const taken = new Map();
|
|
29
|
+
for (const key of AUTOMOVIE_INSPECT_OPTIONS_1.AUTOMOVIE_INSPECT_OPTIONS) {
|
|
30
|
+
const value = request.get(key);
|
|
31
|
+
request.delete(key);
|
|
32
|
+
if (value === undefined)
|
|
33
|
+
continue;
|
|
34
|
+
if (value.trim() === "")
|
|
35
|
+
throw new Error(`Inspect option --${key} needs a value`);
|
|
36
|
+
taken.set(key, value);
|
|
37
|
+
}
|
|
38
|
+
const module = taken.get("module");
|
|
39
|
+
if (module === undefined)
|
|
40
|
+
throw new Error("Inspect needs --module <subject module>, the module whose subjects the page offers");
|
|
41
|
+
const text = taken.get("port");
|
|
42
|
+
const port = text === undefined ? null : Number(text);
|
|
43
|
+
if (port !== null &&
|
|
44
|
+
!(Number.isSafeInteger(port) && port >= 1 && port <= PORTS))
|
|
45
|
+
throw new Error(`Inspect --port "${text}" is not a whole number from 1 to ${PORTS}`);
|
|
46
|
+
return { module, port, props: taken.get("props") ?? null, request };
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=readAutoMovieInspectHostOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieInspectHostOptions.js","sourceRoot":"","sources":["../src/readAutoMovieInspectHostOptions.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AAExE,wBAAwB;AACxB,MAAM,KAAK,GAAW,MAAM,CAAC;AAE7B;;;;;;;;;;;;;;;;;;GAkBG;AACH,yCACE,MAAmC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import type { AutoMovieCaptureBackend } from "./AutoMovieCaptureBackend";
|
|
2
|
+
/**
|
|
3
|
+
* Split the options of `automovie render` into the command's own, `AUTOMOVIE_RENDER_OPTIONS`, and the request's, which `parseAutoMovieCapturePlanRequest` reads for the request's `subject`.
|
|
4
|
+
*
|
|
5
|
+
* | Option | Meaning | Absent |
|
|
6
|
+
* | --- | --- | --- |
|
|
7
|
+
* | `--module <file>` | The subject module whose `subjects` the draw page offers | Required |
|
|
8
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with | `null` |
|
|
9
|
+
* | `--out <folder>` | Where `film.mp4` and `render-report.json` go | `media/automovie/<subject>/videos` |
|
|
10
|
+
* | `--backend <software\|gpu>` | How the browser draws | `software` |
|
|
11
|
+
*
|
|
12
|
+
* Every other option is left for the request reader, which names the subject as `capture` and the inspector do; a render draws the subject's whole clock through its own camera, so `renderAutoMovie` refuses any request key but `subject`. It throws for an empty value of its own options, a missing `--module`, and a backend that is not `software` or `gpu`.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the command's options with their meaning and absent value, says where the rest go and which of them a render admits, and states every refusal.
|
|
15
|
+
* @evidence contracts/development/implementation.md#principled-implementation The command's keys are removed before the request is read, as `capture` and `inspect` do, so the subject has one name and one reader in every host.
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the listed options that takes them out, then the checks.
|
|
17
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No module is guessed from the folder.
|
|
18
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
19
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
20
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh record and keeps nothing.
|
|
21
|
+
*/
|
|
22
|
+
export declare function readAutoMovieRenderOptions(values: ReadonlyMap<string, string>): {
|
|
23
|
+
/** Subject module path, relative to the production or absolute. */
|
|
24
|
+
module: string;
|
|
25
|
+
/** Path of the props JSON file, or null for none. */
|
|
26
|
+
props: string | null;
|
|
27
|
+
/** The output folder, or null for the default. */
|
|
28
|
+
out: string | null;
|
|
29
|
+
/** How the browser draws. */
|
|
30
|
+
backend: AutoMovieCaptureBackend;
|
|
31
|
+
/** The request's own options, for the request reader. */
|
|
32
|
+
request: Map<string, string>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieRenderOptions = readAutoMovieRenderOptions;
|
|
4
|
+
const AUTOMOVIE_RENDER_OPTIONS_1 = require("./AUTOMOVIE_RENDER_OPTIONS");
|
|
5
|
+
/**
|
|
6
|
+
* Split the options of `automovie render` into the command's own, `AUTOMOVIE_RENDER_OPTIONS`, and the request's, which `parseAutoMovieCapturePlanRequest` reads for the request's `subject`.
|
|
7
|
+
*
|
|
8
|
+
* | Option | Meaning | Absent |
|
|
9
|
+
* | --- | --- | --- |
|
|
10
|
+
* | `--module <file>` | The subject module whose `subjects` the draw page offers | Required |
|
|
11
|
+
* | `--props <file>` | A JSON file whose value the module's `subjects` is called with | `null` |
|
|
12
|
+
* | `--out <folder>` | Where `film.mp4` and `render-report.json` go | `media/automovie/<subject>/videos` |
|
|
13
|
+
* | `--backend <software\|gpu>` | How the browser draws | `software` |
|
|
14
|
+
*
|
|
15
|
+
* Every other option is left for the request reader, which names the subject as `capture` and the inspector do; a render draws the subject's whole clock through its own camera, so `renderAutoMovie` refuses any request key but `subject`. It throws for an empty value of its own options, a missing `--module`, and a backend that is not `software` or `gpu`.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates the command's options with their meaning and absent value, says where the rest go and which of them a render admits, and states every refusal.
|
|
18
|
+
* @evidence contracts/development/implementation.md#principled-implementation The command's keys are removed before the request is read, as `capture` and `inspect` do, so the subject has one name and one reader in every host.
|
|
19
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass over the listed options that takes them out, then the checks.
|
|
20
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No module is guessed from the folder.
|
|
21
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
22
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh record and keeps nothing.
|
|
24
|
+
*/
|
|
25
|
+
function readAutoMovieRenderOptions(values) {
|
|
26
|
+
const request = new Map(values);
|
|
27
|
+
const taken = new Map();
|
|
28
|
+
for (const key of AUTOMOVIE_RENDER_OPTIONS_1.AUTOMOVIE_RENDER_OPTIONS) {
|
|
29
|
+
const value = request.get(key);
|
|
30
|
+
request.delete(key);
|
|
31
|
+
if (value === undefined)
|
|
32
|
+
continue;
|
|
33
|
+
if (value.trim() === "")
|
|
34
|
+
throw new Error(`Render option --${key} needs a value`);
|
|
35
|
+
taken.set(key, value);
|
|
36
|
+
}
|
|
37
|
+
const module = taken.get("module");
|
|
38
|
+
if (module === undefined)
|
|
39
|
+
throw new Error("Render needs --module <subject module>, the module whose subjects the draw page offers");
|
|
40
|
+
const backend = taken.get("backend") ?? "software";
|
|
41
|
+
if (backend !== "software" && backend !== "gpu")
|
|
42
|
+
throw new Error(`Render --backend "${backend}" is not software or gpu`);
|
|
43
|
+
return {
|
|
44
|
+
module,
|
|
45
|
+
props: taken.get("props") ?? null,
|
|
46
|
+
out: taken.get("out") ?? null,
|
|
47
|
+
backend,
|
|
48
|
+
request,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=readAutoMovieRenderOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieRenderOptions.js","sourceRoot":"","sources":["../src/readAutoMovieRenderOptions.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAG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4
|
+
* | Option | Meaning | Absent |
|
|
5
|
+
* | --- | --- | --- |
|
|
6
|
+
* | `--url <address>` | The running inspector page, with the request it opens on | Required |
|
|
7
|
+
* | `--seconds <s>` | Wall-clock seconds of playback recorded, positive, at most a day | Required |
|
|
8
|
+
* | `--out <folder>` | Where the recording and `playback.json` go | `media/automovie/review` |
|
|
9
|
+
*
|
|
10
|
+
* It throws naming the option for an option outside the list, an empty value, a missing `--url` or `--seconds`, an address that is not HTTP on this machine, and seconds out of range.
|
|
11
|
+
*
|
|
12
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates every option with its meaning and absent value, and states every refusal.
|
|
13
|
+
* @evidence contracts/development/implementation.md#principled-implementation A review records the page a person would watch, so the command names that page and how long to watch it; only a loopback address is admitted, so the command never drives a page elsewhere.
|
|
14
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass admitting the listed options, then the checks.
|
|
15
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No address or duration is guessed.
|
|
16
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
17
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
18
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh record and keeps nothing.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readAutoMovieReviewOptions(values: ReadonlyMap<string, string>): {
|
|
21
|
+
/** The page's address. */
|
|
22
|
+
url: string;
|
|
23
|
+
/** Seconds of playback recorded. */
|
|
24
|
+
seconds: number;
|
|
25
|
+
/** The output folder, or null for the default. */
|
|
26
|
+
out: string | null;
|
|
27
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieReviewOptions = readAutoMovieReviewOptions;
|
|
4
|
+
const AUTOMOVIE_REVIEW_OPTIONS_1 = require("./AUTOMOVIE_REVIEW_OPTIONS");
|
|
5
|
+
/** Longest observation in seconds: one day, beyond any film's playback a person reviews. */
|
|
6
|
+
const LONGEST = 86_400;
|
|
7
|
+
/**
|
|
8
|
+
* Read the options of `automovie review`, `AUTOMOVIE_REVIEW_OPTIONS`.
|
|
9
|
+
*
|
|
10
|
+
* | Option | Meaning | Absent |
|
|
11
|
+
* | --- | --- | --- |
|
|
12
|
+
* | `--url <address>` | The running inspector page, with the request it opens on | Required |
|
|
13
|
+
* | `--seconds <s>` | Wall-clock seconds of playback recorded, positive, at most a day | Required |
|
|
14
|
+
* | `--out <folder>` | Where the recording and `playback.json` go | `media/automovie/review` |
|
|
15
|
+
*
|
|
16
|
+
* It throws naming the option for an option outside the list, an empty value, a missing `--url` or `--seconds`, an address that is not HTTP on this machine, and seconds out of range.
|
|
17
|
+
*
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation Tabulates every option with its meaning and absent value, and states every refusal.
|
|
19
|
+
* @evidence contracts/development/implementation.md#principled-implementation A review records the page a person would watch, so the command names that page and how long to watch it; only a loopback address is admitted, so the command never drives a page elsewhere.
|
|
20
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pass admitting the listed options, then the checks.
|
|
21
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No address or duration is guessed.
|
|
22
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the options.
|
|
23
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per command.
|
|
24
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh record and keeps nothing.
|
|
25
|
+
*/
|
|
26
|
+
function readAutoMovieReviewOptions(values) {
|
|
27
|
+
for (const [key, value] of values) {
|
|
28
|
+
if (!AUTOMOVIE_REVIEW_OPTIONS_1.AUTOMOVIE_REVIEW_OPTIONS.includes(key))
|
|
29
|
+
throw new Error(`Review takes no option --${key}; it takes ${AUTOMOVIE_REVIEW_OPTIONS_1.AUTOMOVIE_REVIEW_OPTIONS.map((option) => `--${option}`).join(", ")}`);
|
|
30
|
+
if (value.trim() === "")
|
|
31
|
+
throw new Error(`Review option --${key} needs a value`);
|
|
32
|
+
}
|
|
33
|
+
const url = values.get("url");
|
|
34
|
+
const text = values.get("seconds");
|
|
35
|
+
if (url === undefined || text === undefined)
|
|
36
|
+
throw new Error("Review needs --url <inspector address> and --seconds <s>");
|
|
37
|
+
let address;
|
|
38
|
+
try {
|
|
39
|
+
address = new URL(url);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
throw new Error(`Review --url "${url}" is not an address`, {
|
|
43
|
+
cause: error,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (address.protocol !== "http:" ||
|
|
47
|
+
!["127.0.0.1", "localhost", "[::1]"].includes(address.hostname))
|
|
48
|
+
throw new Error(`Review --url "${url}" is not an HTTP page on this machine`);
|
|
49
|
+
const seconds = Number(text);
|
|
50
|
+
if (!(Number.isFinite(seconds) && seconds > 0 && seconds <= LONGEST))
|
|
51
|
+
throw new Error(`Review --seconds "${text}" is not a number of seconds above 0 and at most ${LONGEST}`);
|
|
52
|
+
return { url: address.href, seconds, out: values.get("out") ?? null };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=readAutoMovieReviewOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieReviewOptions.js","sourceRoot":"","sources":["../src/readAutoMovieReviewOptions.ts"],"names":[],"mappings":";;;AAAA,yEAAsE;AAEtE,4FAA4F;AAC5F,MAAM,OAAO,GAAW,MAAM,CAAC;AAE/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,oCACE,MAAmC;IAWnC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,EAAE,CAAC;QAClC,IAAI,CAAC,mDAAwB,CAAC,QAAQ,CAAC,GAAG,CAAC;YACzC,MAAM,IAAI,KAAK,CACb,4BAA4B,GAAG,cAAc,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AC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The source revision a capture records: the production's git commit, with `+changes` when its working tree differs from that commit, or `unrecorded` when the folder is not in a git checkout or git is not installed.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the three forms and when each is written.
|
|
5
|
+
* @evidence contracts/development/implementation.md#principled-implementation `git rev-parse HEAD` names the commit and `git status --porcelain` is empty exactly when nothing differs from it, so the revision says whether the commit alone repeats the capture.
|
|
6
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Two git calls, one fallback.
|
|
7
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing revision is written as `unrecorded`, never as a guessed commit.
|
|
8
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Two short processes per capture.
|
|
9
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per capture, since the tree may change between captures.
|
|
10
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Both processes end before it returns.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readAutoMovieRevision(root: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieRevision = readAutoMovieRevision;
|
|
4
|
+
const node_child_process_1 = require("node:child_process");
|
|
5
|
+
/**
|
|
6
|
+
* The source revision a capture records: the production's git commit, with `+changes` when its working tree differs from that commit, or `unrecorded` when the folder is not in a git checkout or git is not installed.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the three forms and when each is written.
|
|
9
|
+
* @evidence contracts/development/implementation.md#principled-implementation `git rev-parse HEAD` names the commit and `git status --porcelain` is empty exactly when nothing differs from it, so the revision says whether the commit alone repeats the capture.
|
|
10
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Two git calls, one fallback.
|
|
11
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing revision is written as `unrecorded`, never as a guessed commit.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Two short processes per capture.
|
|
13
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Read once per capture, since the tree may change between captures.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Both processes end before it returns.
|
|
15
|
+
*/
|
|
16
|
+
function readAutoMovieRevision(root) {
|
|
17
|
+
const git = (args) => (0, node_child_process_1.execFileSync)("git", ["-C", root, ...args], {
|
|
18
|
+
encoding: "utf8",
|
|
19
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
20
|
+
windowsHide: true,
|
|
21
|
+
}).trim();
|
|
22
|
+
try {
|
|
23
|
+
const commit = git(["rev-parse", "HEAD"]);
|
|
24
|
+
return git(["status", "--porcelain", "--", "."]) === ""
|
|
25
|
+
? commit
|
|
26
|
+
: `${commit}+changes`;
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
return "unrecorded";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=readAutoMovieRevision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieRevision.js","sourceRoot":"","sources":["../src/readAutoMovieRevision.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAElD;;;;;;;;;;GAUG;AACH,+BAAsC,IAAY;IAChD,MAAM,GAAG,GAA+B,CAAC,IAAc,EAAU,EAAE,CACjE,IAAA,iCAAY,EAAC,KAAK,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE;QACzC,QAAQ,EAAE,MAAM;QAChB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;QACnC,WAAW,EAAE,IAAI;KAClB,CAAC,CAAC,IAAI,EAAE,CAAC;IACZ,IAAI,CAAC;QACH,MAAM,MAAM,GAAW,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;QAClD,OAAO,GAAG,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE;YACrD,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,GAAG,MAAM,UAAU,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a video file's clock and raster from the log FFmpeg writes when it opens the file: the `Duration:` of the input and the size and rate of its first video stream.
|
|
3
|
+
*
|
|
4
|
+
* The rate is the stream's `fps` value, or its `tbr` when FFmpeg prints no `fps`. It throws naming what is missing when the log holds no duration, no video stream, or a stream without a size or a rate.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is read from where, the rate's fallback and the refusal.
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation FFmpeg prints `Duration: HH:MM:SS.ss` for every input and, for a video stream, `WxH` followed by `fps` and `tbr`, its frame and base rates; reading the log FFmpeg already writes needs no `ffprobe`, which `ffmpeg-static` does not ship.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One expression per value.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing value throws instead of taking a default raster or rate.
|
|
10
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the log.
|
|
11
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure reading of one log.
|
|
12
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns four numbers.
|
|
13
|
+
*/
|
|
14
|
+
export declare function readAutoMovieVideoProbe(log: string): {
|
|
15
|
+
/** Running time in seconds. */
|
|
16
|
+
durationSeconds: number;
|
|
17
|
+
/** Frames per second. */
|
|
18
|
+
fps: number;
|
|
19
|
+
/** Width in pixels. */
|
|
20
|
+
width: number;
|
|
21
|
+
/** Height in pixels. */
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readAutoMovieVideoProbe = readAutoMovieVideoProbe;
|
|
4
|
+
/**
|
|
5
|
+
* Read a video file's clock and raster from the log FFmpeg writes when it opens the file: the `Duration:` of the input and the size and rate of its first video stream.
|
|
6
|
+
*
|
|
7
|
+
* The rate is the stream's `fps` value, or its `tbr` when FFmpeg prints no `fps`. It throws naming what is missing when the log holds no duration, no video stream, or a stream without a size or a rate.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is read from where, the rate's fallback and the refusal.
|
|
10
|
+
* @evidence contracts/development/implementation.md#principled-implementation FFmpeg prints `Duration: HH:MM:SS.ss` for every input and, for a video stream, `WxH` followed by `fps` and `tbr`, its frame and base rates; reading the log FFmpeg already writes needs no `ffprobe`, which `ffmpeg-static` does not ship.
|
|
11
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure One expression per value.
|
|
12
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing value throws instead of taking a default raster or rate.
|
|
13
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the log.
|
|
14
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure reading of one log.
|
|
15
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns four numbers.
|
|
16
|
+
*/
|
|
17
|
+
function readAutoMovieVideoProbe(log) {
|
|
18
|
+
const duration = log.match(/Duration:\s*(\d+):(\d{2}):(\d{2}(?:\.\d+)?)/u);
|
|
19
|
+
if (duration === null)
|
|
20
|
+
throw new Error("FFmpeg reported no duration for the video");
|
|
21
|
+
const stream = log
|
|
22
|
+
.split(/\r?\n/u)
|
|
23
|
+
.find((line) => /Stream #.*Video:/u.test(line));
|
|
24
|
+
if (stream === undefined)
|
|
25
|
+
throw new Error("FFmpeg reported no video stream in the file");
|
|
26
|
+
const size = stream.match(/[ ,](\d{2,5})x(\d{2,5})[ ,[]/u);
|
|
27
|
+
const rate = stream.match(/([\d.]+) fps/u) ?? stream.match(/([\d.]+) tbr/u);
|
|
28
|
+
if (size === null || rate === null)
|
|
29
|
+
throw new Error(`FFmpeg reported no size or rate for the video stream: ${stream.trim()}`);
|
|
30
|
+
return {
|
|
31
|
+
durationSeconds: Number(duration[1]) * 3600 +
|
|
32
|
+
Number(duration[2]) * 60 +
|
|
33
|
+
Number(duration[3]),
|
|
34
|
+
fps: Number(rate[1]),
|
|
35
|
+
width: Number(size[1]),
|
|
36
|
+
height: Number(size[2]),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=readAutoMovieVideoProbe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAutoMovieVideoProbe.js","sourceRoot":"","sources":["../src/readAutoMovieVideoProbe.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,iCAAwC,GAAW;IAajD,MAAM,QAAQ,GAA4B,GAAG,CAAC,KAAK,CACjD,8CAA8C,CAC/C,CAAC;IACF,IAAI,QAAQ,KAAK,IAAI;QACnB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,MAAM,MAAM,GAAuB,GAAG;SACnC,KAAK,CAAC,QAAQ,CAAC;SACf,IAAI,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,IAAI,MAAM,KAAK,SAAS;QACtB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,MAAM,I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