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,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Record real-time playback of the running inspector page: load it, press its Play button, and record the page as a video while reading its time readout, for a person to watch.
|
|
3
|
+
*
|
|
4
|
+
* The browser draws on the GPU backend, since playback is judged in real time; the recording is Playwright's own video of the page at a 1280 by 900 viewport, which `npx playwright-core install ffmpeg` provides. The page's Play button is found by its role and name, and the readout as the `output` showing `<second> / <duration> s`, both as the inspector renders them. The readout is read at most every half second for `seconds` of wall time after the click, and the page's script errors are collected. The video begins at navigation, so it includes the page's preparation; a reading's elapsed seconds count from the click.
|
|
5
|
+
*
|
|
6
|
+
* It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. The browser is closed on every outcome.
|
|
7
|
+
*
|
|
8
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is recorded and how, which backend and why, how the controls are found, the reading cadence, the clocks of the video and the readings, the refusals and the release.
|
|
9
|
+
* @evidence contracts/development/implementation.md#principled-implementation Playback is observed on the page a person uses, through its own controls, so the recording shows the real loop's pacing instead of seeks turned into a supposed playback; Playwright closes the context to finish writing the video.
|
|
10
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Launch, open a recording context, load, press Play, read for the duration, close.
|
|
11
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing control or video is an error, never a recording of nothing.
|
|
12
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One reading per half second.
|
|
13
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each review records afresh.
|
|
14
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser and its context are closed on every outcome; the readings grow by two per second of observation.
|
|
15
|
+
*/
|
|
16
|
+
export declare function recordAutoMoviePlayback(props: {
|
|
17
|
+
/** Playwright's `chromium`, loaded from the production. */
|
|
18
|
+
chromium: unknown;
|
|
19
|
+
/** The inspector page's address. */
|
|
20
|
+
url: string;
|
|
21
|
+
/** Wall-clock seconds observed after Play is pressed. */
|
|
22
|
+
seconds: number;
|
|
23
|
+
/** Folder the video is written into. */
|
|
24
|
+
out: string;
|
|
25
|
+
/** The environment, read for `CHROME_PATH`. */
|
|
26
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
/** The recording. */
|
|
29
|
+
video: string;
|
|
30
|
+
/** Each reading of the time readout, with wall seconds since Play was pressed. */
|
|
31
|
+
readings: {
|
|
32
|
+
elapsedSeconds: number;
|
|
33
|
+
text: string;
|
|
34
|
+
}[];
|
|
35
|
+
/** The page's script errors. */
|
|
36
|
+
errors: string[];
|
|
37
|
+
}>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.recordAutoMoviePlayback = recordAutoMoviePlayback;
|
|
37
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
38
|
+
const planAutoMovieChromiumLaunch_1 = require("./planAutoMovieChromiumLaunch");
|
|
39
|
+
/** Milliseconds the page may take to load and show its controls: ten minutes, room for a film that prepares its performance before its first frame. */
|
|
40
|
+
const PREPARE = 600_000;
|
|
41
|
+
/** Longest pause between two readings of the time readout, milliseconds. */
|
|
42
|
+
const READING = 500;
|
|
43
|
+
/** The time readout the inspector shows: the second and the duration, such as `1.25 / 12.00 s`. */
|
|
44
|
+
const READOUT = /\d+\.\d+ \/ \d+\.\d+ s/u;
|
|
45
|
+
/**
|
|
46
|
+
* Record real-time playback of the running inspector page: load it, press its Play button, and record the page as a video while reading its time readout, for a person to watch.
|
|
47
|
+
*
|
|
48
|
+
* The browser draws on the GPU backend, since playback is judged in real time; the recording is Playwright's own video of the page at a 1280 by 900 viewport, which `npx playwright-core install ffmpeg` provides. The page's Play button is found by its role and name, and the readout as the `output` showing `<second> / <duration> s`, both as the inspector renders them. The readout is read at most every half second for `seconds` of wall time after the click, and the page's script errors are collected. The video begins at navigation, so it includes the page's preparation; a reading's elapsed seconds count from the click.
|
|
49
|
+
*
|
|
50
|
+
* It rejects when the page shows no Play button or readout within ten minutes and when the browser produced no video. The browser is closed on every outcome.
|
|
51
|
+
*
|
|
52
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is recorded and how, which backend and why, how the controls are found, the reading cadence, the clocks of the video and the readings, the refusals and the release.
|
|
53
|
+
* @evidence contracts/development/implementation.md#principled-implementation Playback is observed on the page a person uses, through its own controls, so the recording shows the real loop's pacing instead of seeks turned into a supposed playback; Playwright closes the context to finish writing the video.
|
|
54
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Launch, open a recording context, load, press Play, read for the duration, close.
|
|
55
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A missing control or video is an error, never a recording of nothing.
|
|
56
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One reading per half second.
|
|
57
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each review records afresh.
|
|
58
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser and its context are closed on every outcome; the readings grow by two per second of observation.
|
|
59
|
+
*/
|
|
60
|
+
async function recordAutoMoviePlayback(props) {
|
|
61
|
+
const chromium = props.chromium;
|
|
62
|
+
const plan = (0, planAutoMovieChromiumLaunch_1.planAutoMovieChromiumLaunch)("gpu", props.env);
|
|
63
|
+
await fs.mkdir(props.out, { recursive: true });
|
|
64
|
+
const browser = await chromium.launch({
|
|
65
|
+
headless: true,
|
|
66
|
+
args: [
|
|
67
|
+
...plan.args,
|
|
68
|
+
"--autoplay-policy=no-user-gesture-required",
|
|
69
|
+
"--disable-background-timer-throttling",
|
|
70
|
+
],
|
|
71
|
+
...(plan.executablePath === undefined
|
|
72
|
+
? {}
|
|
73
|
+
: { executablePath: plan.executablePath }),
|
|
74
|
+
});
|
|
75
|
+
try {
|
|
76
|
+
const viewport = {
|
|
77
|
+
width: 1280,
|
|
78
|
+
height: 900,
|
|
79
|
+
};
|
|
80
|
+
const context = await browser.newContext({
|
|
81
|
+
viewport,
|
|
82
|
+
recordVideo: { dir: props.out, size: viewport },
|
|
83
|
+
});
|
|
84
|
+
const page = await context.newPage();
|
|
85
|
+
const errors = [];
|
|
86
|
+
page.on("pageerror", (error) => {
|
|
87
|
+
errors.push(error.message);
|
|
88
|
+
});
|
|
89
|
+
await page.goto(props.url, {
|
|
90
|
+
waitUntil: "domcontentloaded",
|
|
91
|
+
timeout: PREPARE,
|
|
92
|
+
});
|
|
93
|
+
const play = page
|
|
94
|
+
.getByRole("button", { name: "Play", exact: true })
|
|
95
|
+
.first();
|
|
96
|
+
const readout = page
|
|
97
|
+
.locator("output", { hasText: READOUT })
|
|
98
|
+
.first();
|
|
99
|
+
await play.waitFor({ timeout: PREPARE });
|
|
100
|
+
await readout.waitFor({ timeout: PREPARE });
|
|
101
|
+
// Press Play and read the readout for the observed seconds.
|
|
102
|
+
await play.click();
|
|
103
|
+
const started = performance.now();
|
|
104
|
+
const readings = [];
|
|
105
|
+
while (performance.now() - started < props.seconds * 1000) {
|
|
106
|
+
readings.push({
|
|
107
|
+
elapsedSeconds: (performance.now() - started) / 1000,
|
|
108
|
+
text: await readout.innerText(),
|
|
109
|
+
});
|
|
110
|
+
await page.waitForTimeout(Math.min(READING, Math.max(1, props.seconds * 1000 - (performance.now() - started))));
|
|
111
|
+
}
|
|
112
|
+
const video = page.video();
|
|
113
|
+
await context.close();
|
|
114
|
+
if (video === null)
|
|
115
|
+
throw new Error("The browser produced no playback recording");
|
|
116
|
+
return { video: await video.path(), readings, errors };
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
await browser.close();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=recordAutoMoviePlayback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recordAutoMoviePlayback.js","sourceRoot":"","sources":["../src/recordAutoMoviePlayback.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `automovie render` in a production: draw one subject of a module's draw page frame by frame in headless Chromium and encode it into one video, resolving to the exit status.
|
|
3
|
+
*
|
|
4
|
+
* Options are read by `readAutoMovieCaptureArguments` and split by `readAutoMovieRenderOptions`; the rest is the request, of which a render takes only `subject`, read by `parseAutoMovieCapturePlanRequest` as `capture` reads it, and any other key is refused. A `--props` file is read as JSON before anything starts. FFmpeg is resolved before the page is built, so a missing encoder costs no drawing. The work is `renderAutoMovieVideo` through one `AutoMovieCaptureHost`, closed on every outcome. It prints the video, the report and the frame count, and resolves to 0; a refusal throws to `run`, which prints it.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States how options are read, the order of the checks, what does the work, what is printed and the status.
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation Every rule is the render package's or `renderAutoMovieVideo`'s; the command loads the production's packages and reports.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read, resolve FFmpeg, open the host, render, report.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option and a request key a render cannot honour are refused, and FFmpeg's absence fails before any drawing.
|
|
10
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One page build, one browser and one encode.
|
|
11
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One render per command.
|
|
12
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The host is closed on every outcome.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderAutoMovie(props: {
|
|
15
|
+
/** The tokens after `render`. */
|
|
16
|
+
args: readonly string[];
|
|
17
|
+
/** The production's root folder, the working directory. */
|
|
18
|
+
root: string;
|
|
19
|
+
/** The environment, read for `CHROME_PATH` and `FFMPEG_PATH`. */
|
|
20
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
21
|
+
}): Promise<number>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.renderAutoMovie = renderAutoMovie;
|
|
37
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const AutoMovieCaptureHost_1 = require("./AutoMovieCaptureHost");
|
|
40
|
+
const loadAutoMovieProductionModule_1 = require("./loadAutoMovieProductionModule");
|
|
41
|
+
const readAutoMovieRenderOptions_1 = require("./readAutoMovieRenderOptions");
|
|
42
|
+
const renderAutoMovieVideo_1 = require("./renderAutoMovieVideo");
|
|
43
|
+
const resolveAutoMovieFfmpeg_1 = require("./resolveAutoMovieFfmpeg");
|
|
44
|
+
/**
|
|
45
|
+
* Run `automovie render` in a production: draw one subject of a module's draw page frame by frame in headless Chromium and encode it into one video, resolving to the exit status.
|
|
46
|
+
*
|
|
47
|
+
* Options are read by `readAutoMovieCaptureArguments` and split by `readAutoMovieRenderOptions`; the rest is the request, of which a render takes only `subject`, read by `parseAutoMovieCapturePlanRequest` as `capture` reads it, and any other key is refused. A `--props` file is read as JSON before anything starts. FFmpeg is resolved before the page is built, so a missing encoder costs no drawing. The work is `renderAutoMovieVideo` through one `AutoMovieCaptureHost`, closed on every outcome. It prints the video, the report and the frame count, and resolves to 0; a refusal throws to `run`, which prints it.
|
|
48
|
+
*
|
|
49
|
+
* @evidence contracts/development/common.md#meaningful-documentation States how options are read, the order of the checks, what does the work, what is printed and the status.
|
|
50
|
+
* @evidence contracts/development/implementation.md#principled-implementation Every rule is the render package's or `renderAutoMovieVideo`'s; the command loads the production's packages and reports.
|
|
51
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read, resolve FFmpeg, open the host, render, report.
|
|
52
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option and a request key a render cannot honour are refused, and FFmpeg's absence fails before any drawing.
|
|
53
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One page build, one browser and one encode.
|
|
54
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One render per command.
|
|
55
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The host is closed on every outcome.
|
|
56
|
+
*/
|
|
57
|
+
async function renderAutoMovie(props) {
|
|
58
|
+
const { root } = props;
|
|
59
|
+
const render = (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, "@automovie/render");
|
|
60
|
+
const options = (0, readAutoMovieRenderOptions_1.readAutoMovieRenderOptions)(render.readAutoMovieCaptureArguments(props.args));
|
|
61
|
+
// The request names the subject; a render draws its whole clock through its own camera, so no other key applies.
|
|
62
|
+
const request = render.parseAutoMovieCapturePlanRequest(options.request);
|
|
63
|
+
for (const key of options.request.keys())
|
|
64
|
+
if (key !== "subject")
|
|
65
|
+
throw new Error(`Render draws a subject's whole clock through its own camera; the request key --${key} does not apply, only --subject`);
|
|
66
|
+
const data = options.props === null
|
|
67
|
+
? null
|
|
68
|
+
: JSON.parse(await fs.readFile(path.resolve(root, options.props), "utf8"));
|
|
69
|
+
const ffmpeg = (0, resolveAutoMovieFfmpeg_1.resolveAutoMovieFfmpeg)({
|
|
70
|
+
env: props.env,
|
|
71
|
+
load: (id) => (0, loadAutoMovieProductionModule_1.loadAutoMovieProductionModule)(root, id),
|
|
72
|
+
});
|
|
73
|
+
const host = await AutoMovieCaptureHost_1.AutoMovieCaptureHost.open({
|
|
74
|
+
root,
|
|
75
|
+
module: options.module,
|
|
76
|
+
backend: options.backend,
|
|
77
|
+
env: props.env,
|
|
78
|
+
});
|
|
79
|
+
try {
|
|
80
|
+
const written = await (0, renderAutoMovieVideo_1.renderAutoMovieVideo)({
|
|
81
|
+
host,
|
|
82
|
+
root,
|
|
83
|
+
subject: request.subject,
|
|
84
|
+
props: data,
|
|
85
|
+
...(options.out === null ? {} : { out: options.out }),
|
|
86
|
+
ffmpeg,
|
|
87
|
+
});
|
|
88
|
+
process.stdout.write(`render: ${written.frames} frames into ${written.video}\nbackend ${host.backend}\n${written.report}\n`);
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
await host.close();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=renderAutoMovie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderAutoMovie.js","sourceRoot":"","sources":["../src/renderAutoMovie.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAY,EAAE,6CAAyB;AACvC,MAAY,IAAI,sCAAkB;AAElC,iEAA8D;AAC9D,mFAAgF;AAChF,6EAA0E;AAC1E,iEAA8D;AAC9D,qEAAkE;AAElE;;;;;;;;;;;;GAYG;AACI,KAAK,0BAA0B,KASrC;IACC,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,MAAM,GAAkB,IAAA,6DAA6B,EACzD,IAAI,EACJ,mBAAmB,CACH,CAAC;IACnB,MAAM,OAAO,GACX,IAAA,uDAA0B,EACxB,MAAM,CAAC,6BAA6B,CAAC,KAAK,CAAC,IAAI,CAAC,CACjD,CAAC;IAEJ,iHAAiH;IACjH,MAAM,OAAO,GACX,MAAM,CAAC,gCAAgC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE;QACtC,IAAI,GAAG,KAAK,SAAS;YACnB,MAAM,IAAI,KAAK,CACb,kFAAkF,GAAG,iCAAiC,CACvH,CAAC;IACN,MAAM,IAAI,GACR,OAAO,CAAC,KAAK,KAAK,IAAI;QACpB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,IAAI,CAAC,KAAK,CACR,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAC7D,CAAC;IACR,MAAM,MAAM,GAAW,IAAA,+CAAsB,EAAC;QAC5C,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,CAAC,EAAU,EAAW,EAAE,CAAC,IAAA,6DAA6B,EAAC,IAAI,EAAE,EAAE,CAAC;KACvE,CAAC,CAAC;IAEH,MAAM,IAAI,GAAyB,MAAM,2CAAoB,CAAC,IAAI,CAAC;QACjE,IAAI;QACJ,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,EAAE,KAAK,CAAC,GAAG;KACf,CAAC,CAAC;IACH,IAAI,CAAC;QACH,MAAM,OAAO,GACX,MAAM,IAAA,2CAAoB,EAAC;YACzB,IAAI;YACJ,IAAI;YACJ,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,KAAK,EAAE,IAAI;YACX,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;YACrD,MAAM;SACP,CAAC,CAAC;QACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,OAAO,CAAC,MAAM,gBAAgB,OAAO,CAAC,KAAK,aAAa,IAAI,CAAC,OAAO,KAAK,OAAO,CAAC,MAAM,IAAI,CACvG,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
|
|
2
1
|
/**
|
|
3
2
|
* Explain the work between a freshly written installation and a runnable production.
|
|
4
3
|
*
|
|
5
|
-
* `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production
|
|
4
|
+
* `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production in its own pnpm repository; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
|
|
6
5
|
*
|
|
7
6
|
* @param directory The installed directory.
|
|
8
7
|
* @param kind Which installation was written.
|
|
9
|
-
* @param packageManager The manager a `production` installs with, from `selectAutoMoviePackageManager`; workspace kinds always use pnpm.
|
|
10
8
|
* @returns The closing text.
|
|
11
9
|
*
|
|
12
|
-
* @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's install and checks
|
|
10
|
+
* @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's pnpm install and checks, and the workspace README's pnpm install and add.
|
|
13
11
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function returns the text for every installation kind and leaves writing to `run`, so the message has a single owner and no terminal effect.
|
|
14
12
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The text names no fixture or particular directory and is not altered by any caller; a closed union selects the variant.
|
|
15
13
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states how `directory` is printed, why the text opens with a blank line, what each kind means and what must change with the scaffold.
|
|
@@ -17,4 +15,4 @@ import type { IAutoMoviePackageManager } from "./IAutoMoviePackageManager";
|
|
|
17
15
|
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful installation.
|
|
18
16
|
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and holds no state, handle, or task after it returns.
|
|
19
17
|
*/
|
|
20
|
-
export declare function renderAutoMovieScaffoldNextSteps(directory: string, kind: "production" | "workspace" | "workspace-production"
|
|
18
|
+
export declare function renderAutoMovieScaffoldNextSteps(directory: string, kind: "production" | "workspace" | "workspace-production"): string;
|
|
@@ -4,14 +4,13 @@ exports.renderAutoMovieScaffoldNextSteps = renderAutoMovieScaffoldNextSteps;
|
|
|
4
4
|
/**
|
|
5
5
|
* Explain the work between a freshly written installation and a runnable production.
|
|
6
6
|
*
|
|
7
|
-
* `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production
|
|
7
|
+
* `directory` is printed as given (`run` passes the absolute target). The text starts with a blank line because `run` appends it to the written-file list. A `production` is a single production in its own pnpm repository; a `workspace` is a pnpm workspace root that still needs its first production; a `workspace-production` is a production added to such a root. The steps name the generated `README.md`, `AGENTS.md`, the `lint` and `evidence` scripts and the workspace's `add` command, so they must change with the scaffold's first-run README sections.
|
|
8
8
|
*
|
|
9
9
|
* @param directory The installed directory.
|
|
10
10
|
* @param kind Which installation was written.
|
|
11
|
-
* @param packageManager The manager a `production` installs with, from `selectAutoMoviePackageManager`; workspace kinds always use pnpm.
|
|
12
11
|
* @returns The closing text.
|
|
13
12
|
*
|
|
14
|
-
* @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's install and checks
|
|
13
|
+
* @evidence contracts/development/implementation.md#principled-implementation The steps are fixed text derived from each layer's first-run contract: the production README's pnpm install and checks, and the workspace README's pnpm install and add.
|
|
15
14
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure One pure function returns the text for every installation kind and leaves writing to `run`, so the message has a single owner and no terminal effect.
|
|
16
15
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The text names no fixture or particular directory and is not altered by any caller; a closed union selects the variant.
|
|
17
16
|
* @evidence contracts/development/common.md#meaningful-documentation The comment states how `directory` is printed, why the text opens with a blank line, what each kind means and what must change with the scaffold.
|
|
@@ -19,7 +18,7 @@ exports.renderAutoMovieScaffoldNextSteps = renderAutoMovieScaffoldNextSteps;
|
|
|
19
18
|
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` calls this once per successful installation.
|
|
20
19
|
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and holds no state, handle, or task after it returns.
|
|
21
20
|
*/
|
|
22
|
-
function renderAutoMovieScaffoldNextSteps(directory, kind
|
|
21
|
+
function renderAutoMovieScaffoldNextSteps(directory, kind) {
|
|
23
22
|
if (kind === "workspace")
|
|
24
23
|
return (`\n\nNext (from ${directory}):\n` +
|
|
25
24
|
` 1. Read README.md and AGENTS.md. The workspace has no production yet.\n` +
|
|
@@ -31,18 +30,10 @@ function renderAutoMovieScaffoldNextSteps(directory, kind, packageManager = { ma
|
|
|
31
30
|
` 2. Read README.md in ${directory} and the workspace AGENTS.md. This is an empty harness.\n` +
|
|
32
31
|
` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
|
|
33
32
|
` 4. Run pnpm run lint and pnpm run evidence there.\n`);
|
|
34
|
-
if (packageManager.manager === "pnpm")
|
|
35
|
-
return (`\n\nNext (from ${directory}):\n` +
|
|
36
|
-
` 1. Read README.md and AGENTS.md. This is an empty harness.\n` +
|
|
37
|
-
(packageManager.workspace === undefined
|
|
38
|
-
? ` 2. Run pnpm install.\n`
|
|
39
|
-
: ` 2. Run pnpm install at the workspace root ${packageManager.workspace}; its pnpm-workspace.yaml must list this directory.\n`) +
|
|
40
|
-
` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
|
|
41
|
-
` 4. Run pnpm run lint for source and pnpm run evidence for checklist answers.\n`);
|
|
42
33
|
return (`\n\nNext (from ${directory}):\n` +
|
|
43
34
|
` 1. Read README.md and AGENTS.md. This is an empty harness.\n` +
|
|
44
|
-
` 2. Run
|
|
35
|
+
` 2. Run pnpm install.\n` +
|
|
45
36
|
` 3. Author the production in TypeScript under src with the public AutoMovie package APIs.\n` +
|
|
46
|
-
` 4. Run
|
|
37
|
+
` 4. Run pnpm run lint for source and pnpm run evidence for checklist answers.\n`);
|
|
47
38
|
}
|
|
48
39
|
//# sourceMappingURL=renderAutoMovieScaffoldNextSteps.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderAutoMovieScaffoldNextSteps.js","sourceRoot":"","sources":["../src/renderAutoMovieScaffoldNextSteps.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"renderAutoMovieScaffoldNextSteps.js","sourceRoot":"","sources":["../src/renderAutoMovieScaffoldNextSteps.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,0CACE,SAAiB,EACjB,IAAyD;IAEzD,IAAI,IAAI,KAAK,WAAW;QACtB,OAAO,CACL,kBAAkB,SAAS,MAAM;YACjC,2EAA2E;YAC3E,0BAA0B;YAC1B,0GAA0G,CAC3G,CAAC;IACJ,IAAI,IAAI,KAAK,sBAAsB;QACjC,OAAO,CACL,aAAa;YACb,uEAAuE;YACvE,0BAA0B,SAAS,2DAA2D;YAC9F,8FAA8F;YAC9F,uDAAuD,CACxD,CAAC;IACJ,OAAO,CACL,kBAAkB,SAAS,MAAM;QACjC,gEAAgE;QAChE,0BAA0B;QAC1B,8FAA8F;QAC9F,kFAAkF,CACnF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { AutoMovieCaptureHost } from "./AutoMovieCaptureHost";
|
|
2
|
+
/**
|
|
3
|
+
* Render one subject of a host's draw page into `<out>/film.mp4`, with `render-report.json` beside it.
|
|
4
|
+
*
|
|
5
|
+
* The subject is opened through the host's draw session, every frame of its clock is drawn by `renderAutoMovieDrawnVideo` into a scratch folder under `<root>/.cache/render/`, and FFmpeg encodes them into a partial file that is renamed to `film.mp4` only once it is complete, so a failed render leaves no file that looks finished. The report names the subject, the source revision, the backend, the encoder's arguments and every frame's second and pixel hash. The scratch folder is deleted and the session closed on every outcome.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is written where, how a failure leaves the output, what the report holds, and what is released.
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Drawing and encoding are the render package's; this host supplies the session, files and FFmpeg, so a delivered frame is drawn by the same function as a capture's still.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Open, draw and encode, rename, report, release.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The output is replaced only by a complete encode; no frame is reused from an earlier render.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One draw and one PNG file per frame, then one FFmpeg run.
|
|
12
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each render draws afresh.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame files live in the scratch folder until the encode ends, then are deleted with it; the session's page is closed on every outcome.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderAutoMovieVideo(props: {
|
|
16
|
+
/** The opened draw host. */
|
|
17
|
+
host: AutoMovieCaptureHost;
|
|
18
|
+
/** The production's root folder. */
|
|
19
|
+
root: string;
|
|
20
|
+
/** The subject's name, or null for the page's only subject. */
|
|
21
|
+
subject: string | null;
|
|
22
|
+
/** Data the subject module reads, as JSON, or null. */
|
|
23
|
+
props: unknown;
|
|
24
|
+
/** Output folder, relative to the root or absolute; absent, `media/automovie/<subject>/videos`. */
|
|
25
|
+
out?: string;
|
|
26
|
+
/** FFmpeg executable. */
|
|
27
|
+
ffmpeg: string;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
/** The video written. */
|
|
30
|
+
video: string;
|
|
31
|
+
/** The report written beside it. */
|
|
32
|
+
report: string;
|
|
33
|
+
/** Frames drawn. */
|
|
34
|
+
frames: number;
|
|
35
|
+
}>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.renderAutoMovieVideo = renderAutoMovieVideo;
|
|
37
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const readAutoMovieRevision_1 = require("./readAutoMovieRevision");
|
|
40
|
+
const runAutoMovieFfmpeg_1 = require("./runAutoMovieFfmpeg");
|
|
41
|
+
/**
|
|
42
|
+
* The delivery encoding of a drawn subject: H.264 in yuv420p at CRF 18, without tone mapping, as the production's render used; the frame format is the subject's own clock and raster.
|
|
43
|
+
*/
|
|
44
|
+
const SPEC = {
|
|
45
|
+
target: "production",
|
|
46
|
+
toneMapping: "none",
|
|
47
|
+
codec: "h264",
|
|
48
|
+
pixelFormat: "yuv420p",
|
|
49
|
+
crf: 18,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Render one subject of a host's draw page into `<out>/film.mp4`, with `render-report.json` beside it.
|
|
53
|
+
*
|
|
54
|
+
* The subject is opened through the host's draw session, every frame of its clock is drawn by `renderAutoMovieDrawnVideo` into a scratch folder under `<root>/.cache/render/`, and FFmpeg encodes them into a partial file that is renamed to `film.mp4` only once it is complete, so a failed render leaves no file that looks finished. The report names the subject, the source revision, the backend, the encoder's arguments and every frame's second and pixel hash. The scratch folder is deleted and the session closed on every outcome.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is written where, how a failure leaves the output, what the report holds, and what is released.
|
|
57
|
+
* @evidence contracts/development/implementation.md#principled-implementation Drawing and encoding are the render package's; this host supplies the session, files and FFmpeg, so a delivered frame is drawn by the same function as a capture's still.
|
|
58
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Open, draw and encode, rename, report, release.
|
|
59
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The output is replaced only by a complete encode; no frame is reused from an earlier render.
|
|
60
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One draw and one PNG file per frame, then one FFmpeg run.
|
|
61
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each render draws afresh.
|
|
62
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame files live in the scratch folder until the encode ends, then are deleted with it; the session's page is closed on every outcome.
|
|
63
|
+
*/
|
|
64
|
+
async function renderAutoMovieVideo(props) {
|
|
65
|
+
const session = await props.host.session({
|
|
66
|
+
subject: props.subject,
|
|
67
|
+
props: props.props,
|
|
68
|
+
});
|
|
69
|
+
const name = session.subject.name;
|
|
70
|
+
const out = path.resolve(props.root, props.out ?? path.join("media", "automovie", name, "videos"));
|
|
71
|
+
const scratch = path.join(props.root, ".cache", "render", `${name}-${process.pid}-${Date.now()}`);
|
|
72
|
+
const partial = path.join(out, `.film-${process.pid}.mp4`);
|
|
73
|
+
try {
|
|
74
|
+
await fs.mkdir(scratch, { recursive: true });
|
|
75
|
+
await fs.mkdir(out, { recursive: true });
|
|
76
|
+
const result = await props.host.render.renderAutoMovieDrawnVideo({
|
|
77
|
+
session,
|
|
78
|
+
spec: SPEC,
|
|
79
|
+
frameDir: scratch.split(path.sep).join("/"),
|
|
80
|
+
outputPath: partial,
|
|
81
|
+
audio: null,
|
|
82
|
+
write: (file, data) => fs.writeFile(file, data),
|
|
83
|
+
encode: async (args) => {
|
|
84
|
+
await (0, runAutoMovieFfmpeg_1.runAutoMovieFfmpeg)(props.ffmpeg, args);
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
const video = path.join(out, "film.mp4");
|
|
88
|
+
await fs.rename(partial, video);
|
|
89
|
+
const report = path.join(out, "render-report.json");
|
|
90
|
+
await fs.writeFile(report, JSON.stringify({
|
|
91
|
+
subject: name,
|
|
92
|
+
revision: (0, readAutoMovieRevision_1.readAutoMovieRevision)(props.root),
|
|
93
|
+
backend: session.backend,
|
|
94
|
+
video: "film.mp4",
|
|
95
|
+
args: result.args,
|
|
96
|
+
frames: result.frames.map((frame) => ({
|
|
97
|
+
index: frame.index,
|
|
98
|
+
seconds: frame.seconds,
|
|
99
|
+
hash: frame.hash,
|
|
100
|
+
})),
|
|
101
|
+
}, null, 2));
|
|
102
|
+
return { video, report, frames: result.frames.length };
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
await fs.rm(partial, { force: true });
|
|
106
|
+
await fs.rm(scratch, { recursive: true, force: true });
|
|
107
|
+
await session.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=renderAutoMovieVideo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderAutoMovieVideo.js","sourceRoot":"","sources":["../src/renderAutoMovieVideo.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when the environment sets it to a non-blank path, else the binary of the production's `ffmpeg-static`.
|
|
3
|
+
*
|
|
4
|
+
* It throws naming both `FFMPEG_PATH` and `ffmpeg-static` when neither gives a path, so a capture that plans a video says how to supply one before it touches its folder.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the order of the two sources and the refusal.
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation `ffmpeg-static` exports the path of the binary it downloaded, or null on a platform it has none for; the environment variable wins so a machine's own build can be used.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read the variable, else load the package, else refuse.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No `ffmpeg` on the search path is guessed, because a capture records the binary it ran.
|
|
10
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One module load at most.
|
|
11
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Resolved once per capture.
|
|
12
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a path and keeps nothing.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveAutoMovieFfmpeg(props: {
|
|
15
|
+
/** The environment, read for `FFMPEG_PATH`. */
|
|
16
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
17
|
+
/** Loads a package from the production, throwing when it is not installed. */
|
|
18
|
+
load: (id: string) => unknown;
|
|
19
|
+
}): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveAutoMovieFfmpeg = resolveAutoMovieFfmpeg;
|
|
4
|
+
/**
|
|
5
|
+
* Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when the environment sets it to a non-blank path, else the binary of the production's `ffmpeg-static`.
|
|
6
|
+
*
|
|
7
|
+
* It throws naming both `FFMPEG_PATH` and `ffmpeg-static` when neither gives a path, so a capture that plans a video says how to supply one before it touches its folder.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the order of the two sources and the refusal.
|
|
10
|
+
* @evidence contracts/development/implementation.md#principled-implementation `ffmpeg-static` exports the path of the binary it downloaded, or null on a platform it has none for; the environment variable wins so a machine's own build can be used.
|
|
11
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read the variable, else load the package, else refuse.
|
|
12
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No `ffmpeg` on the search path is guessed, because a capture records the binary it ran.
|
|
13
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One module load at most.
|
|
14
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Resolved once per capture.
|
|
15
|
+
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a path and keeps nothing.
|
|
16
|
+
*/
|
|
17
|
+
function resolveAutoMovieFfmpeg(props) {
|
|
18
|
+
const given = props.env.FFMPEG_PATH?.trim();
|
|
19
|
+
if (given !== undefined && given !== "")
|
|
20
|
+
return given;
|
|
21
|
+
let binary = null;
|
|
22
|
+
try {
|
|
23
|
+
binary = props.load("ffmpeg-static");
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
binary = null;
|
|
27
|
+
}
|
|
28
|
+
if (typeof binary === "string" && binary !== "")
|
|
29
|
+
return binary;
|
|
30
|
+
throw new Error("A video capture needs FFmpeg: set FFMPEG_PATH to an ffmpeg executable, or install ffmpeg-static in the production");
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=resolveAutoMovieFfmpeg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveAutoMovieFfmpeg.js","sourceRoot":"","sources":["../src/resolveAutoMovieFfmpeg.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,gCAAuC,KAMtC;IACC,MAAM,KAAK,GAAuB,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;IAChE,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IACtD,IAAI,MAAM,GAAY,IAAI,CAAC;IAC3B,IAAI,CAAC;QACH,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC;IAC/D,MAAM,IAAI,KAAK,CACb,mHAAmH,CACpH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run `automovie review` in a production: record real-time playback of its running inspector page for a person to watch, and resolve to the exit status.
|
|
3
|
+
*
|
|
4
|
+
* Options are read by `readAutoMovieCaptureArguments` and admitted by `readAutoMovieReviewOptions`. The recording is `recordAutoMoviePlayback` with the production's `playwright-core`; it and `playback.json`, holding the time readings and the page's script errors, go into `--out` or `media/automovie/review`. It prints the video and the number of errors, and resolves to 1 when the page reported a script error, since a playback that errors is not one to watch, and 0 otherwise.
|
|
5
|
+
*
|
|
6
|
+
* @evidence contracts/development/common.md#meaningful-documentation States how options are read, what records, what is written where, what is printed and the status with its reason.
|
|
7
|
+
* @evidence contracts/development/implementation.md#principled-implementation The recording's rules are `recordAutoMoviePlayback`'s; the command supplies the production's Playwright and writes the result.
|
|
8
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read, record, write, report.
|
|
9
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown option is refused; a page error is reported in the status, not hidden.
|
|
10
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms One recording.
|
|
11
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One review per command.
|
|
12
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser is the recording's and closed by it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function reviewAutoMovie(props: {
|
|
15
|
+
/** The tokens after `review`. */
|
|
16
|
+
args: readonly string[];
|
|
17
|
+
/** The production's root folder, the working directory. */
|
|
18
|
+
root: string;
|
|
19
|
+
/** The environment, read for `CHROME_PATH`. */
|
|
20
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
21
|
+
}): Promise<number>;
|