automovie 0.3.3 → 0.4.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 +40 -139
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
- package/lib/AutoMovieCaptureBackend.d.ts +4 -6
- package/lib/AutoMovieCaptureHost.d.ts +73 -53
- package/lib/AutoMovieCaptureHost.js +89 -56
- package/lib/AutoMovieCaptureHost.js.map +1 -1
- package/lib/AutoMovieCommand.d.ts +69 -20
- package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
- package/lib/AutoMovieFfmpegStaticPath.js +3 -0
- package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
- package/lib/AutoMovieMp4Boxes.d.ts +78 -0
- package/lib/AutoMovieMp4Boxes.js +227 -0
- package/lib/AutoMovieMp4Boxes.js.map +1 -0
- package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
- package/lib/AutoMovieRenderOutputReservation.js +118 -0
- package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
- package/lib/IAutoMovieChromium.d.ts +13 -57
- package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
- package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
- package/lib/IAutoMovieFfmpegSources.js +3 -0
- package/lib/IAutoMovieFfmpegSources.js.map +1 -0
- package/lib/IAutoMovieReviewObservation.d.ts +66 -0
- package/lib/IAutoMovieReviewObservation.js +3 -0
- package/lib/IAutoMovieReviewObservation.js.map +1 -0
- package/lib/IAutoMovieVerification.d.ts +163 -0
- package/lib/IAutoMovieVerification.js +3 -0
- package/lib/IAutoMovieVerification.js.map +1 -0
- package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
- package/lib/auditAutoMovieAlphaSamples.js +183 -0
- package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
- package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
- package/lib/auditAutoMovieDeliveryProfile.js +93 -0
- package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -11
- package/lib/captureAutoMovie.js +102 -18
- package/lib/captureAutoMovie.js.map +1 -1
- package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
- package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
- package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
- package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
- package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
- package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
- package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
- package/lib/createAutoMovieVerificationInputScope.js +147 -0
- package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
- package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
- package/lib/createAutoMovieVerificationMediaHash.js +61 -0
- package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
- package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
- package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
- package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +14 -11
- package/lib/deriveAutoMovieProjectName.js +14 -11
- package/lib/deriveAutoMovieProjectName.js.map +1 -1
- package/lib/findAutoMovieFreePort.d.ts +5 -10
- package/lib/findAutoMovieFreePort.js +5 -10
- package/lib/findAutoMovieFreePort.js.map +1 -1
- package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
- package/lib/formatAutoMovieInspectUrl.js +6 -10
- package/lib/formatAutoMovieInspectUrl.js.map +1 -1
- package/lib/hashAutoMovieFile.d.ts +5 -0
- package/lib/hashAutoMovieFile.js +16 -0
- package/lib/hashAutoMovieFile.js.map +1 -0
- package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
- package/lib/importAutoMovieVerificationEntry.mjs +6 -0
- package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +15 -9
- package/lib/inspectAutoMovie.js +25 -9
- package/lib/inspectAutoMovie.js.map +1 -1
- package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
- package/lib/inspectAutoMovieVerificationCapture.js +221 -0
- package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
- package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
- package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
- package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
- package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
- package/lib/inspectAutoMovieVerificationReview.js +141 -0
- package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +9 -11
- package/lib/launchAutoMovieChromium.js +10 -11
- package/lib/launchAutoMovieChromium.js.map +1 -1
- package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
- package/lib/listAutoMovieReleaseFindings.js +58 -0
- package/lib/listAutoMovieReleaseFindings.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +11 -10
- package/lib/loadAutoMovieProductionModule.js +18 -10
- package/lib/loadAutoMovieProductionModule.js.map +1 -1
- package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
- package/lib/loadAutoMovieVerificationModule.js +246 -0
- package/lib/loadAutoMovieVerificationModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
- package/lib/planAutoMovieChromiumLaunch.js +7 -13
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
- package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/planAutoMovieDeliveryDecode.js +57 -0
- package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
- package/lib/planAutoMovieDeliveryInput.js +26 -0
- package/lib/planAutoMovieDeliveryInput.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
- package/lib/promptAutoMovieProjectName.d.ts +6 -10
- package/lib/promptAutoMovieProjectName.js +6 -10
- package/lib/promptAutoMovieProjectName.js.map +1 -1
- package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
- package/lib/publishAutoMovieRenderAttempt.js +91 -0
- package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +10 -11
- package/lib/readAutoMovieAddArguments.js +10 -11
- package/lib/readAutoMovieAddArguments.js.map +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
- package/lib/readAutoMovieCaptureHostOptions.js +16 -17
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
- package/lib/readAutoMovieCommandArguments.d.ts +6 -9
- package/lib/readAutoMovieCommandArguments.js +9 -10
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +7 -11
- package/lib/readAutoMovieCreateArguments.js +7 -11
- package/lib/readAutoMovieCreateArguments.js.map +1 -1
- package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/readAutoMovieDeliveryDecode.js +209 -0
- package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
- package/lib/readAutoMovieDeliveryProbe.js +363 -0
- package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
- package/lib/readAutoMovieErrorCode.d.ts +9 -0
- package/lib/readAutoMovieErrorCode.js +18 -0
- package/lib/readAutoMovieErrorCode.js.map +1 -0
- package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
- package/lib/readAutoMovieInspectHostOptions.js +11 -15
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
- package/lib/readAutoMovieNameOption.d.ts +4 -10
- package/lib/readAutoMovieNameOption.js +4 -10
- package/lib/readAutoMovieNameOption.js.map +1 -1
- package/lib/readAutoMoviePageTimeout.d.ts +13 -0
- package/lib/readAutoMoviePageTimeout.js +21 -0
- package/lib/readAutoMoviePageTimeout.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +24 -16
- package/lib/readAutoMovieRenderOptions.js +23 -16
- package/lib/readAutoMovieRenderOptions.js.map +1 -1
- package/lib/readAutoMovieReviewObservation.d.ts +6 -0
- package/lib/readAutoMovieReviewObservation.js +108 -0
- package/lib/readAutoMovieReviewObservation.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +32 -24
- package/lib/readAutoMovieReviewOptions.js +82 -18
- package/lib/readAutoMovieReviewOptions.js.map +1 -1
- package/lib/readAutoMovieRevision.d.ts +3 -9
- package/lib/readAutoMovieRevision.js +3 -9
- package/lib/readAutoMovieRevision.js.map +1 -1
- package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
- package/lib/readAutoMovieVerifyOptions.js +45 -0
- package/lib/readAutoMovieVerifyOptions.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +6 -10
- package/lib/readAutoMovieVideoProbe.js +20 -13
- package/lib/readAutoMovieVideoProbe.js.map +1 -1
- package/lib/recordAutoMoviePlayback.d.ts +18 -11
- package/lib/recordAutoMoviePlayback.js +26 -13
- package/lib/recordAutoMoviePlayback.js.map +1 -1
- package/lib/renderAutoMovie.d.ts +16 -10
- package/lib/renderAutoMovie.js +31 -14
- package/lib/renderAutoMovie.js.map +1 -1
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
- package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
- package/lib/renderAutoMovieVideo.d.ts +53 -15
- package/lib/renderAutoMovieVideo.js +290 -45
- package/lib/renderAutoMovieVideo.js.map +1 -1
- package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
- package/lib/resolveAutoMovieFfmpeg.js +12 -17
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
- package/lib/reviewAutoMovie.d.ts +10 -10
- package/lib/reviewAutoMovie.js +15 -10
- package/lib/reviewAutoMovie.js.map +1 -1
- package/lib/reviewAutoMovieFile.d.ts +21 -0
- package/lib/reviewAutoMovieFile.js +378 -0
- package/lib/reviewAutoMovieFile.js.map +1 -0
- package/lib/run.d.ts +32 -18
- package/lib/run.js +67 -23
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/runAutoMovieDeliveryDecode.js +42 -0
- package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
- package/lib/runAutoMovieFfmpeg.d.ts +15 -10
- package/lib/runAutoMovieFfmpeg.js +36 -13
- package/lib/runAutoMovieFfmpeg.js.map +1 -1
- package/lib/runAutoMovieVerification.d.ts +28 -0
- package/lib/runAutoMovieVerification.js +393 -0
- package/lib/runAutoMovieVerification.js.map +1 -0
- package/lib/sameAutoMovieReviewFile.d.ts +2 -0
- package/lib/sameAutoMovieReviewFile.js +57 -0
- package/lib/sameAutoMovieReviewFile.js.map +1 -0
- package/lib/selectAutoMovieProjectName.d.ts +8 -11
- package/lib/selectAutoMovieProjectName.js +8 -11
- package/lib/selectAutoMovieProjectName.js.map +1 -1
- package/lib/serveAutoMovieDrawPage.d.ts +14 -11
- package/lib/serveAutoMovieDrawPage.js +14 -11
- package/lib/serveAutoMovieDrawPage.js.map +1 -1
- package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
- package/lib/serveAutoMovieInspectorPage.js +3 -9
- package/lib/serveAutoMovieInspectorPage.js.map +1 -1
- package/lib/verifyAutoMovie.d.ts +19 -0
- package/lib/verifyAutoMovie.js +44 -0
- package/lib/verifyAutoMovie.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +17 -12
- package/lib/writeAutoMovieModulePage.js +13 -11
- package/lib/writeAutoMovieModulePage.js.map +1 -1
- package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
- package/lib/writeAutoMovieVerificationReceipt.js +75 -0
- package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
- package/package.json +8 -8
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
- package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
- package/src/AutoMovieCaptureBackend.ts +4 -6
- package/src/AutoMovieCaptureHost.ts +122 -68
- package/src/AutoMovieCommand.ts +71 -20
- package/src/AutoMovieFfmpegStaticPath.ts +7 -0
- package/src/AutoMovieMp4Boxes.ts +263 -0
- package/src/AutoMovieRenderOutputReservation.ts +97 -0
- package/src/IAutoMovieChromium.ts +13 -57
- package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
- package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
- package/src/IAutoMovieFfmpegSources.ts +13 -0
- package/src/IAutoMovieReviewObservation.ts +59 -0
- package/src/IAutoMovieVerification.ts +207 -0
- package/src/auditAutoMovieAlphaSamples.ts +201 -0
- package/src/auditAutoMovieDeliveryProfile.ts +125 -0
- package/src/captureAutoMovie.ts +137 -28
- package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
- package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
- package/src/createAutoMovieVerificationInputScope.ts +156 -0
- package/src/createAutoMovieVerificationMediaHash.ts +32 -0
- package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
- package/src/deriveAutoMovieProjectName.ts +14 -11
- package/src/findAutoMovieFreePort.ts +5 -10
- package/src/formatAutoMovieInspectUrl.ts +6 -10
- package/src/hashAutoMovieFile.ts +12 -0
- package/src/importAutoMovieVerificationEntry.mts +6 -0
- package/src/index.ts +9 -0
- package/src/inspectAutoMovie.ts +28 -11
- package/src/inspectAutoMovieVerificationCapture.ts +292 -0
- package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
- package/src/inspectAutoMovieVerificationReview.ts +130 -0
- package/src/launchAutoMovieChromium.ts +14 -12
- package/src/listAutoMovieReleaseFindings.ts +87 -0
- package/src/loadAutoMovieProductionModule.ts +22 -15
- package/src/loadAutoMovieVerificationModule.ts +278 -0
- package/src/planAutoMovieChromiumLaunch.ts +7 -13
- package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
- package/src/planAutoMovieDeliveryDecode.ts +66 -0
- package/src/planAutoMovieDeliveryInput.ts +25 -0
- package/src/planAutoMovieModulePageViteConfig.ts +13 -10
- package/src/promptAutoMovieProjectName.ts +6 -10
- package/src/publishAutoMovieRenderAttempt.ts +89 -0
- package/src/readAutoMovieAddArguments.ts +10 -11
- package/src/readAutoMovieCaptureHostOptions.ts +22 -17
- package/src/readAutoMovieCommandArguments.ts +8 -10
- package/src/readAutoMovieCreateArguments.ts +7 -11
- package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
- package/src/readAutoMovieDeliveryDecode.ts +269 -0
- package/src/readAutoMovieDeliveryProbe.ts +499 -0
- package/src/readAutoMovieErrorCode.ts +13 -0
- package/src/readAutoMovieInspectHostOptions.ts +15 -16
- package/src/readAutoMovieNameOption.ts +4 -10
- package/src/readAutoMoviePageTimeout.ts +19 -0
- package/src/readAutoMovieRenderOptions.ts +34 -16
- package/src/readAutoMovieReviewObservation.ts +146 -0
- package/src/readAutoMovieReviewOptions.ts +133 -28
- package/src/readAutoMovieRevision.ts +3 -9
- package/src/readAutoMovieVerifyOptions.ts +50 -0
- package/src/readAutoMovieVideoProbe.ts +24 -13
- package/src/recordAutoMoviePlayback.ts +26 -13
- package/src/renderAutoMovie.ts +38 -17
- package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
- package/src/renderAutoMovieVideo.ts +474 -85
- package/src/resolveAutoMovieFfmpeg.ts +17 -24
- package/src/reviewAutoMovie.ts +21 -16
- package/src/reviewAutoMovieFile.ts +479 -0
- package/src/run.ts +75 -25
- package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
- package/src/runAutoMovieDeliveryDecode.ts +63 -0
- package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
- package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
- package/src/runAutoMovieFfmpeg.ts +48 -14
- package/src/runAutoMovieVerification.ts +487 -0
- package/src/sameAutoMovieReviewFile.ts +23 -0
- package/src/selectAutoMovieProjectName.ts +8 -11
- package/src/serveAutoMovieDrawPage.ts +16 -12
- package/src/serveAutoMovieInspectorPage.ts +6 -9
- package/src/verifyAutoMovie.ts +67 -0
- package/src/writeAutoMovieModulePage.ts +17 -12
- package/src/writeAutoMovieVerificationReceipt.ts +51 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFileSync, realpathSync, statSync } from "node:fs";
|
|
3
|
+
import {
|
|
4
|
+
type LoadHookSync,
|
|
5
|
+
type ResolveHookSync,
|
|
6
|
+
createRequire,
|
|
7
|
+
findPackageJSON,
|
|
8
|
+
registerHooks,
|
|
9
|
+
} from "node:module";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
12
|
+
|
|
13
|
+
import type { IAutoMovieVerification } from "./IAutoMovieVerification";
|
|
14
|
+
import { createAutoMovieVerificationInputScope } from "./createAutoMovieVerificationInputScope";
|
|
15
|
+
import { importAutoMovieVerificationEntry } from "./importAutoMovieVerificationEntry.mjs";
|
|
16
|
+
import { readAutoMovieErrorCode } from "./readAutoMovieErrorCode";
|
|
17
|
+
|
|
18
|
+
/** Load check definitions and bind their local sources to the bytes Node loaded. */
|
|
19
|
+
export async function loadAutoMovieVerificationModule(
|
|
20
|
+
root: string,
|
|
21
|
+
module: string,
|
|
22
|
+
): Promise<{
|
|
23
|
+
readonly targets: readonly IAutoMovieVerification[];
|
|
24
|
+
readonly sources: (file: string | undefined) => ReadonlyMap<string, string>;
|
|
25
|
+
}> {
|
|
26
|
+
const directory: string = realpathSync.native(root);
|
|
27
|
+
const load: NodeJS.Require = createRequire(
|
|
28
|
+
path.join(directory, "package.json"),
|
|
29
|
+
);
|
|
30
|
+
const entry: string = realpathSync.native(
|
|
31
|
+
load.resolve(path.resolve(directory, module)),
|
|
32
|
+
);
|
|
33
|
+
const entryUrl: string = pathToFileURL(entry).href;
|
|
34
|
+
const extension: string = path.extname(entry);
|
|
35
|
+
const requireEntry: boolean =
|
|
36
|
+
extension === ".json" || extension === ".cjs" || extension === ".cts";
|
|
37
|
+
const prior: Set<NodeJS.Module | undefined> = new Set(
|
|
38
|
+
Object.values(load.cache),
|
|
39
|
+
);
|
|
40
|
+
const names: Map<string, string> = new Map([[entry, entry]]);
|
|
41
|
+
const packages: Set<string> = new Set();
|
|
42
|
+
const local = (
|
|
43
|
+
file: string,
|
|
44
|
+
specifier?: string,
|
|
45
|
+
importer: string = entry,
|
|
46
|
+
): string | undefined => {
|
|
47
|
+
if (
|
|
48
|
+
!path.isAbsolute(file) ||
|
|
49
|
+
path.relative(directory, file).split(path.sep).includes("node_modules")
|
|
50
|
+
)
|
|
51
|
+
return undefined;
|
|
52
|
+
const known: string | undefined = names.get(file);
|
|
53
|
+
if (known !== undefined) return known;
|
|
54
|
+
const physical: string = realpathSync.native(file);
|
|
55
|
+
|
|
56
|
+
// Node follows pnpm links to their real paths. A package reached by name
|
|
57
|
+
// outside the production remains a dependency at that resolved path.
|
|
58
|
+
if (specifier === undefined) {
|
|
59
|
+
if (packages.has(file)) return undefined;
|
|
60
|
+
} else if (
|
|
61
|
+
!within(directory, physical) &&
|
|
62
|
+
isInstalledPackageFile(specifier, importer, physical)
|
|
63
|
+
) {
|
|
64
|
+
packages.add(file);
|
|
65
|
+
packages.add(physical);
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
names.set(file, physical);
|
|
69
|
+
names.set(physical, physical);
|
|
70
|
+
return physical;
|
|
71
|
+
};
|
|
72
|
+
const fromUrl = (url: string | undefined): string | undefined =>
|
|
73
|
+
url?.startsWith("file:") === true ? fileURLToPath(url) : undefined;
|
|
74
|
+
const edges: Map<string, Set<string>> = new Map([[entry, new Set()]]);
|
|
75
|
+
const digests: Map<string, string | null> = new Map();
|
|
76
|
+
let entryFormat: ReturnType<LoadHookSync>["format"];
|
|
77
|
+
const trackResolve: ResolveHookSync = (specifier, context, next) => {
|
|
78
|
+
const importer: string | undefined = fromUrl(context.parentURL);
|
|
79
|
+
const parent: string | undefined =
|
|
80
|
+
importer === undefined ? undefined : names.get(importer);
|
|
81
|
+
const children: Set<string> | undefined =
|
|
82
|
+
parent === undefined ? undefined : edges.get(parent);
|
|
83
|
+
const result: ReturnType<ResolveHookSync> =
|
|
84
|
+
children !== undefined && parent !== undefined
|
|
85
|
+
? resolveProjectImport(directory, parent, specifier, context, next)
|
|
86
|
+
: next(specifier, context);
|
|
87
|
+
if (children !== undefined || specifier === entryUrl) {
|
|
88
|
+
const filename: string | undefined = fromUrl(result.url);
|
|
89
|
+
const child: string | undefined =
|
|
90
|
+
filename === undefined ? undefined : local(filename, specifier, parent);
|
|
91
|
+
if (child !== undefined) {
|
|
92
|
+
children?.add(child);
|
|
93
|
+
if (!edges.has(child)) edges.set(child, new Set());
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return result;
|
|
97
|
+
};
|
|
98
|
+
const trackLoad: LoadHookSync = (url, context, next) => {
|
|
99
|
+
const filename: string | undefined = fromUrl(url);
|
|
100
|
+
const file: string | undefined =
|
|
101
|
+
filename === undefined ? undefined : names.get(filename);
|
|
102
|
+
if (file === undefined || !edges.has(file)) return next(url, context);
|
|
103
|
+
const format: typeof context.format = context.format;
|
|
104
|
+
|
|
105
|
+
// A linked CLI can run under ttsx, which rewrites TypeScript and CommonJS.
|
|
106
|
+
// Give Node the same authored bytes that identify the verification input.
|
|
107
|
+
const result: ReturnType<LoadHookSync> =
|
|
108
|
+
(format === "module-typescript" ||
|
|
109
|
+
format === "commonjs-typescript" ||
|
|
110
|
+
format === "commonjs") &&
|
|
111
|
+
Object.keys(context.importAttributes ?? {}).length === 0
|
|
112
|
+
? { format, source: readFileSync(file), shortCircuit: true }
|
|
113
|
+
: next(url, context);
|
|
114
|
+
if (
|
|
115
|
+
(result.format === "module" || result.format === "module-typescript") &&
|
|
116
|
+
context.conditions.includes("require")
|
|
117
|
+
)
|
|
118
|
+
throw new Error(
|
|
119
|
+
`Use a native import to verify the source of ${path.relative(directory, file)}. CommonJS require can return an earlier ES module evaluation.`,
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
if (file === entry) entryFormat = result.format;
|
|
123
|
+
const raw: typeof result.source = result.source;
|
|
124
|
+
const measured: string | null =
|
|
125
|
+
raw === null || raw === undefined
|
|
126
|
+
? null
|
|
127
|
+
: createHash("sha256")
|
|
128
|
+
.update(raw instanceof ArrayBuffer ? new Uint8Array(raw) : raw)
|
|
129
|
+
.digest("hex");
|
|
130
|
+
const former: string | null | undefined = digests.get(file);
|
|
131
|
+
digests.set(
|
|
132
|
+
file,
|
|
133
|
+
former === undefined || former === measured ? measured : null,
|
|
134
|
+
);
|
|
135
|
+
return result;
|
|
136
|
+
};
|
|
137
|
+
const hooks: ReturnType<typeof registerHooks> = registerHooks({
|
|
138
|
+
resolve: trackResolve,
|
|
139
|
+
load: trackLoad,
|
|
140
|
+
});
|
|
141
|
+
let namespace: { default?: unknown } | null | undefined;
|
|
142
|
+
try {
|
|
143
|
+
// Native CommonJS loading exposes the original dependency specifiers to
|
|
144
|
+
// the hooks, including require() of an installed ES module.
|
|
145
|
+
namespace = (
|
|
146
|
+
requireEntry
|
|
147
|
+
? load(entry)
|
|
148
|
+
: await importAutoMovieVerificationEntry(entryUrl)
|
|
149
|
+
) as typeof namespace;
|
|
150
|
+
} finally {
|
|
151
|
+
hooks.deregister();
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const common: Map<string, NodeJS.Module> = new Map();
|
|
155
|
+
for (const [native, file] of names) {
|
|
156
|
+
const loaded: NodeJS.Module | undefined = load.cache[native];
|
|
157
|
+
if (loaded !== undefined) common.set(file, loaded);
|
|
158
|
+
}
|
|
159
|
+
for (const [file, children] of edges) {
|
|
160
|
+
const parent: NodeJS.Module | undefined = common.get(file);
|
|
161
|
+
if (parent === undefined) continue;
|
|
162
|
+
if (prior.has(parent)) digests.set(file, null);
|
|
163
|
+
for (const child of parent.children) {
|
|
164
|
+
const dependency: string | undefined = local(child.filename);
|
|
165
|
+
if (dependency === undefined) continue;
|
|
166
|
+
children.add(dependency);
|
|
167
|
+
common.set(dependency, child);
|
|
168
|
+
if (!edges.has(dependency)) edges.set(dependency, new Set());
|
|
169
|
+
if (prior.has(child)) digests.set(dependency, null);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const sources = (file: string | undefined): ReadonlyMap<string, string> => {
|
|
173
|
+
const selected: string = file ?? entry;
|
|
174
|
+
const visited: Set<string> = new Set([selected]);
|
|
175
|
+
const measured: Map<string, string> = new Map();
|
|
176
|
+
for (const current of visited) {
|
|
177
|
+
const reference: string = path.relative(directory, current);
|
|
178
|
+
const hash: string | null | undefined = digests.get(current);
|
|
179
|
+
if (!edges.has(current))
|
|
180
|
+
throw new Error(
|
|
181
|
+
`Verification source was not loaded by ${module}: ${reference}.`,
|
|
182
|
+
);
|
|
183
|
+
if (typeof hash !== "string")
|
|
184
|
+
throw new Error(
|
|
185
|
+
`Verification source could not be observed: ${reference}. Run verify in a fresh process.`,
|
|
186
|
+
);
|
|
187
|
+
measured.set(reference, hash);
|
|
188
|
+
for (const child of edges.get(current)!) visited.add(child);
|
|
189
|
+
}
|
|
190
|
+
return new Map(
|
|
191
|
+
[...measured].sort(([left], [right]) =>
|
|
192
|
+
left < right ? -1 : left > right ? 1 : 0,
|
|
193
|
+
),
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
await createAutoMovieVerificationInputScope(directory).verifySources(
|
|
197
|
+
sources(undefined),
|
|
198
|
+
);
|
|
199
|
+
const targets: unknown =
|
|
200
|
+
!requireEntry &&
|
|
201
|
+
(entryFormat === "commonjs" || entryFormat === "commonjs-typescript")
|
|
202
|
+
? (namespace?.default as typeof namespace)?.default
|
|
203
|
+
: namespace?.default;
|
|
204
|
+
if (!Array.isArray(targets))
|
|
205
|
+
throw new Error(`${module} must default-export verification targets.`);
|
|
206
|
+
return { targets, sources };
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** Confirm a bare import belongs to a package Node can resolve natively. */
|
|
210
|
+
function isInstalledPackageFile(
|
|
211
|
+
specifier: string,
|
|
212
|
+
importer: string,
|
|
213
|
+
file: string,
|
|
214
|
+
): boolean {
|
|
215
|
+
if (
|
|
216
|
+
specifier.startsWith(".") ||
|
|
217
|
+
specifier.startsWith("#") ||
|
|
218
|
+
specifier.startsWith("file:") ||
|
|
219
|
+
path.isAbsolute(specifier)
|
|
220
|
+
)
|
|
221
|
+
return false;
|
|
222
|
+
try {
|
|
223
|
+
// Native resolution ignores compiler aliases and canonicalizes pnpm links.
|
|
224
|
+
const manifest: string | undefined = findPackageJSON(specifier, importer);
|
|
225
|
+
return (
|
|
226
|
+
manifest !== undefined &&
|
|
227
|
+
within(path.dirname(realpathSync.native(manifest)), file)
|
|
228
|
+
);
|
|
229
|
+
} catch {
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function resolveProjectImport(
|
|
235
|
+
root: string,
|
|
236
|
+
parent: string,
|
|
237
|
+
specifier: string,
|
|
238
|
+
context: Parameters<ResolveHookSync>[1],
|
|
239
|
+
next: Parameters<ResolveHookSync>[2],
|
|
240
|
+
): ReturnType<ResolveHookSync> {
|
|
241
|
+
try {
|
|
242
|
+
return next(specifier, context);
|
|
243
|
+
} catch (error) {
|
|
244
|
+
const code: unknown = readAutoMovieErrorCode(error);
|
|
245
|
+
if (
|
|
246
|
+
(code !== "ERR_MODULE_NOT_FOUND" &&
|
|
247
|
+
code !== "MODULE_NOT_FOUND" &&
|
|
248
|
+
code !== "ERR_UNSUPPORTED_DIR_IMPORT") ||
|
|
249
|
+
(!specifier.startsWith("./") && !specifier.startsWith("../")) ||
|
|
250
|
+
path.extname(specifier) !== "" ||
|
|
251
|
+
/[?#\\]/u.test(specifier) ||
|
|
252
|
+
!within(root, parent)
|
|
253
|
+
)
|
|
254
|
+
throw error;
|
|
255
|
+
for (const candidate of [
|
|
256
|
+
`${specifier}.ts`,
|
|
257
|
+
`${specifier.replace(/\/$/u, "")}/index.ts`,
|
|
258
|
+
]) {
|
|
259
|
+
const file: string = path.resolve(path.dirname(parent), candidate);
|
|
260
|
+
if (
|
|
261
|
+
within(root, file) &&
|
|
262
|
+
statSync(file, { throwIfNoEntry: false })?.isFile() === true &&
|
|
263
|
+
within(root, realpathSync.native(file))
|
|
264
|
+
)
|
|
265
|
+
return next(candidate, context);
|
|
266
|
+
}
|
|
267
|
+
throw error;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function within(root: string, file: string): boolean {
|
|
272
|
+
const relative: string = path.relative(root, file);
|
|
273
|
+
return (
|
|
274
|
+
!path.isAbsolute(relative) &&
|
|
275
|
+
relative !== ".." &&
|
|
276
|
+
!relative.startsWith(`..${path.sep}`)
|
|
277
|
+
);
|
|
278
|
+
}
|
|
@@ -3,20 +3,14 @@ import type { AutoMovieCaptureBackend } from "./AutoMovieCaptureBackend";
|
|
|
3
3
|
/**
|
|
4
4
|
* The Chromium switches and executable for a capture backend.
|
|
5
5
|
*
|
|
6
|
-
* | Backend
|
|
7
|
-
* |
|
|
8
|
-
* | `software` | `--use-gl=angle --use-angle=swiftshader`
|
|
9
|
-
* | `gpu`
|
|
6
|
+
* | Backend | Switches | Named |
|
|
7
|
+
* | ---------- | ----------------------------------------------------------- | ------------- |
|
|
8
|
+
* | `software` | `--use-gl=angle --use-angle=swiftshader` | `swiftshader` |
|
|
9
|
+
* | `gpu` | `--use-gl=angle --use-angle=default --ignore-gpu-blocklist` | `gpu` |
|
|
10
10
|
*
|
|
11
|
-
* The executable is `CHROME_PATH` when the environment sets it to a non-blank
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @evidence contracts/development/implementation.md#principled-implementation Chromium's SwiftShader documentation selects the software backend through ANGLE with exactly these two switches, and Playwright already adds `--enable-unsafe-swiftshader`; `--use-angle=default` lets ANGLE pick the platform's GPU backend, such as Direct3D 11 on Windows, and the blocklist switch keeps a headless browser from refusing it.
|
|
15
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One table lookup and one environment read.
|
|
16
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No backend is chosen from the machine; the caller states it, and the record names what the browser reported.
|
|
17
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Constant.
|
|
18
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure mapping.
|
|
19
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns fresh arrays and keeps nothing.
|
|
11
|
+
* The executable is `CHROME_PATH` when the environment sets it to a non-blank
|
|
12
|
+
* path, else the Chromium build Playwright pins, which `executablePath` leaves
|
|
13
|
+
* absent.
|
|
20
14
|
*/
|
|
21
15
|
export function planAutoMovieChromiumLaunch(
|
|
22
16
|
backend: AutoMovieCaptureBackend,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { planAutoMovieDeliveryInput } from "./planAutoMovieDeliveryInput";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Plans a read-only decode of a known present audio stream into interleaved
|
|
5
|
+
* little-endian 32-bit floating point samples. Its decoded frame log and PCM
|
|
6
|
+
* byte count provide independent timing and content evidence.
|
|
7
|
+
*
|
|
8
|
+
* @param path The delivery file to decode.
|
|
9
|
+
* @returns Shell-free FFmpeg arguments with PCM on stdout and frame timing on
|
|
10
|
+
* stderr.
|
|
11
|
+
*/
|
|
12
|
+
export function planAutoMovieDeliveryAudioDecode(path: string): string[] {
|
|
13
|
+
return [
|
|
14
|
+
...planAutoMovieDeliveryInput(path),
|
|
15
|
+
"-map",
|
|
16
|
+
"0:a:0",
|
|
17
|
+
"-vn",
|
|
18
|
+
"-af",
|
|
19
|
+
"aformat=sample_fmts=flt,ashowinfo",
|
|
20
|
+
"-c:a",
|
|
21
|
+
"pcm_f32le",
|
|
22
|
+
"-f",
|
|
23
|
+
"f32le",
|
|
24
|
+
"pipe:1",
|
|
25
|
+
];
|
|
26
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
|
|
2
|
+
|
|
3
|
+
import { planAutoMovieDeliveryInput } from "./planAutoMovieDeliveryInput";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Plans a read-only FFmpeg pass over the primary decoded video stream.
|
|
7
|
+
*
|
|
8
|
+
* The native freeze detector starts early so a freeze extending to EOF can
|
|
9
|
+
* qualify after the last frame's duration is included. The audit decides the
|
|
10
|
+
* final minimum duration and removes detector intervals containing one frame.
|
|
11
|
+
*
|
|
12
|
+
* The same plan measures the encoder's own image-sequence input when given the
|
|
13
|
+
* input options the encoder used, such as its `-framerate`.
|
|
14
|
+
*
|
|
15
|
+
* @param path The delivery file, or the encoder's input pattern, to decode.
|
|
16
|
+
* @param frameRate The commissioned rational delivery frame rate.
|
|
17
|
+
* @param thresholds The delivery audit's detector settings.
|
|
18
|
+
* @param inputOptions Demuxer options placed before the input, empty for a
|
|
19
|
+
* delivery file.
|
|
20
|
+
* @returns Arguments for a shell-free invocation with evidence on stderr.
|
|
21
|
+
*/
|
|
22
|
+
export function planAutoMovieDeliveryDecode(
|
|
23
|
+
path: string,
|
|
24
|
+
frameRate: IAutoMovieDeliveryContentAudit.Ratio,
|
|
25
|
+
thresholds: IAutoMovieDeliveryContentAudit.IThresholds,
|
|
26
|
+
inputOptions: readonly string[] = [],
|
|
27
|
+
): string[] {
|
|
28
|
+
const [frames, seconds] = frameRate;
|
|
29
|
+
const { minimumDuration, maximumMeanDifference } = thresholds.frozen;
|
|
30
|
+
const freezeSeconds =
|
|
31
|
+
(minimumDuration.ticks * minimumDuration.timeBase[0]) /
|
|
32
|
+
minimumDuration.timeBase[1];
|
|
33
|
+
const detectorMicroseconds = Math.max(
|
|
34
|
+
0,
|
|
35
|
+
Math.floor((freezeSeconds - seconds / frames) * 1_000_000) - 1,
|
|
36
|
+
);
|
|
37
|
+
if (!Number.isSafeInteger(detectorMicroseconds))
|
|
38
|
+
throw new Error("The delivery freeze detector duration is invalid");
|
|
39
|
+
|
|
40
|
+
return [
|
|
41
|
+
...planAutoMovieDeliveryInput(path, inputOptions),
|
|
42
|
+
"-map",
|
|
43
|
+
"0:v:0",
|
|
44
|
+
"-an",
|
|
45
|
+
"-vf",
|
|
46
|
+
[
|
|
47
|
+
"showinfo=checksum=0",
|
|
48
|
+
"blackdetect=d=0:" +
|
|
49
|
+
"pic_th=" +
|
|
50
|
+
thresholds.black.minimumPictureRatio +
|
|
51
|
+
":pix_th=" +
|
|
52
|
+
thresholds.black.maximumPixelThreshold,
|
|
53
|
+
"freezedetect=n=" +
|
|
54
|
+
maximumMeanDifference +
|
|
55
|
+
":d=" +
|
|
56
|
+
detectorMicroseconds +
|
|
57
|
+
"us",
|
|
58
|
+
"metadata=mode=print",
|
|
59
|
+
].join(","),
|
|
60
|
+
"-fps_mode",
|
|
61
|
+
"passthrough",
|
|
62
|
+
"-f",
|
|
63
|
+
"null",
|
|
64
|
+
"-",
|
|
65
|
+
];
|
|
66
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The read-only input arguments every delivery decode starts with: no banner,
|
|
3
|
+
* no stdin, no progress, fail on the first decoding error, keep the input's own
|
|
4
|
+
* timestamps, then the input itself.
|
|
5
|
+
*
|
|
6
|
+
* @param path The file or image-sequence pattern to decode.
|
|
7
|
+
* @param inputOptions Demuxer options placed before the input, such as an image
|
|
8
|
+
* sequence's `-framerate`.
|
|
9
|
+
* @returns The leading FFmpeg arguments, with the path as its own argument.
|
|
10
|
+
*/
|
|
11
|
+
export function planAutoMovieDeliveryInput(
|
|
12
|
+
path: string,
|
|
13
|
+
inputOptions: readonly string[] = [],
|
|
14
|
+
): string[] {
|
|
15
|
+
return [
|
|
16
|
+
"-hide_banner",
|
|
17
|
+
"-nostdin",
|
|
18
|
+
"-nostats",
|
|
19
|
+
"-xerror",
|
|
20
|
+
"-copyts",
|
|
21
|
+
...inputOptions,
|
|
22
|
+
"-i",
|
|
23
|
+
path,
|
|
24
|
+
];
|
|
25
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The Vite configuration every page `writeAutoMovieModulePage` writes is served
|
|
2
|
+
* The Vite configuration every page `writeAutoMovieModulePage` writes is served
|
|
3
|
+
* or built with: the page's folder as the root, the production's configuration
|
|
4
|
+
* file and public folder, quiet logging, and the page itself as the dependency
|
|
5
|
+
* scanner's entry.
|
|
3
6
|
*
|
|
4
|
-
* The page lives under `node_modules/.cache/automovie/`, and Vite's own entry
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
7
|
+
* The page lives under `node_modules/.cache/automovie/`, and Vite's own entry
|
|
8
|
+
* search skips everything under `node_modules`, so without an entry it finds
|
|
9
|
+
* none, logs "Could not auto-determine entry point" and skips pre-bundling,
|
|
10
|
+
* which makes the first load of a development server slow.
|
|
11
|
+
* `optimizeDeps.entries` is `index.html`, a name without glob characters, which
|
|
12
|
+
* Vite resolves against the root as it is instead of globbing with that skip;
|
|
13
|
+
* it also wins over the production's own `build.rollupOptions.input`, so the
|
|
14
|
+
* scan starts from this page rather than the production's. A host adds its own
|
|
15
|
+
* `server`, `build` or `base` beside these members.
|
|
13
16
|
*/
|
|
14
17
|
export function planAutoMovieModulePageViteConfig(page: {
|
|
15
18
|
/** The page's folder, the root it is served from. */
|
|
@@ -3,19 +3,15 @@ import * as readline from "node:readline/promises";
|
|
|
3
3
|
import { AUTOMOVIE_DEFAULT_PROJECT_NAME } from "./AUTOMOVIE_DEFAULT_PROJECT_NAME";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Ask the terminal for a project name, offering
|
|
6
|
+
* Ask the terminal for a project name, offering
|
|
7
|
+
* {@link AUTOMOVIE_DEFAULT_PROJECT_NAME}.
|
|
7
8
|
*
|
|
8
|
-
* Without an interactive terminal on both standard input and output, no
|
|
9
|
+
* Without an interactive terminal on both standard input and output, no
|
|
10
|
+
* question is asked and the default is returned, so scripted runs never wait. A
|
|
11
|
+
* blank answer also takes the default; any other answer is returned as typed
|
|
12
|
+
* for the template's name rule to admit.
|
|
9
13
|
*
|
|
10
14
|
* @returns The answered or default name.
|
|
11
|
-
*
|
|
12
|
-
* @evidence contracts/development/implementation.md#principled-implementation `isTTY` on both streams identifies an interactive terminal; the readline interface is closed in `finally`, so standard input is released even when the question fails.
|
|
13
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The prompt is the CLI's only interactive I/O, separate from the pure name decision.
|
|
14
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The answer is not normalized here; the template's one name rule admits it.
|
|
15
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment states when the question is asked, the default, and how a blank answer is treated.
|
|
16
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One question and one trim.
|
|
17
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each request asks at most once.
|
|
18
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The readline interface is closed before returning.
|
|
19
15
|
*/
|
|
20
16
|
export async function promptAutoMovieProjectName(): Promise<string> {
|
|
21
17
|
if (process.stdin.isTTY !== true || process.stdout.isTTY !== true)
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
|
|
3
|
+
import { readAutoMovieErrorCode } from "./readAutoMovieErrorCode";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Installs the approved film, its control channels when the attempt drew them,
|
|
7
|
+
* and then its report. The former film and former `controls/` wait in staging
|
|
8
|
+
* until all are in place; when any step fails they return and whatever was
|
|
9
|
+
* installed is removed, so the published film, channels and report always
|
|
10
|
+
* belong to the same attempt.
|
|
11
|
+
*
|
|
12
|
+
* An attempt without control channels leaves a former `controls/` folder where
|
|
13
|
+
* it is; its record's film digest then differs from the new report's
|
|
14
|
+
* `source.sha256`, which is how a reader tells it is stale.
|
|
15
|
+
*/
|
|
16
|
+
export async function publishAutoMovieRenderAttempt(paths: {
|
|
17
|
+
/** The staged encoded film. */
|
|
18
|
+
candidate: string;
|
|
19
|
+
|
|
20
|
+
/** Where the film is published. */
|
|
21
|
+
video: string;
|
|
22
|
+
|
|
23
|
+
/** The staged report. */
|
|
24
|
+
pendingReport: string;
|
|
25
|
+
|
|
26
|
+
/** Where the report is published. */
|
|
27
|
+
report: string;
|
|
28
|
+
|
|
29
|
+
/** Staging path the former film waits at. */
|
|
30
|
+
previous: string;
|
|
31
|
+
|
|
32
|
+
/** The attempt's control folder, when it drew control channels. */
|
|
33
|
+
controls?: {
|
|
34
|
+
/** The staged folder of frames and record. */
|
|
35
|
+
candidate: string;
|
|
36
|
+
|
|
37
|
+
/** Where the folder is published, `<out>/controls`. */
|
|
38
|
+
installed: string;
|
|
39
|
+
|
|
40
|
+
/** Staging path the former folder waits at. */
|
|
41
|
+
previous: string;
|
|
42
|
+
};
|
|
43
|
+
}): Promise<void> {
|
|
44
|
+
const keep: (from: string, to: string) => Promise<boolean> = (
|
|
45
|
+
from: string,
|
|
46
|
+
to: string,
|
|
47
|
+
): Promise<boolean> =>
|
|
48
|
+
fs
|
|
49
|
+
.rename(from, to)
|
|
50
|
+
.then(() => true)
|
|
51
|
+
.catch((error: unknown): false => {
|
|
52
|
+
if (readAutoMovieErrorCode(error) !== "ENOENT") throw error;
|
|
53
|
+
return false;
|
|
54
|
+
});
|
|
55
|
+
const kept: boolean = await keep(paths.video, paths.previous);
|
|
56
|
+
let keptControls: boolean = false;
|
|
57
|
+
let installedControls: boolean = false;
|
|
58
|
+
try {
|
|
59
|
+
if (paths.controls !== undefined)
|
|
60
|
+
keptControls = await keep(
|
|
61
|
+
paths.controls.installed,
|
|
62
|
+
paths.controls.previous,
|
|
63
|
+
);
|
|
64
|
+
await fs.rename(paths.candidate, paths.video);
|
|
65
|
+
if (paths.controls !== undefined) {
|
|
66
|
+
await fs.rename(paths.controls.candidate, paths.controls.installed);
|
|
67
|
+
installedControls = true;
|
|
68
|
+
}
|
|
69
|
+
await fs.rename(paths.pendingReport, paths.report);
|
|
70
|
+
} catch (cause) {
|
|
71
|
+
try {
|
|
72
|
+
if (kept) await fs.rename(paths.previous, paths.video);
|
|
73
|
+
else await fs.rm(paths.video, { force: true });
|
|
74
|
+
|
|
75
|
+
// Only this attempt's folder is removed; the former one returns.
|
|
76
|
+
if (paths.controls !== undefined && installedControls)
|
|
77
|
+
await fs.rm(paths.controls.installed, { recursive: true });
|
|
78
|
+
if (paths.controls !== undefined && keptControls)
|
|
79
|
+
await fs.rename(paths.controls.previous, paths.controls.installed);
|
|
80
|
+
} catch (restoreFailure) {
|
|
81
|
+
throw new AggregateError(
|
|
82
|
+
[cause, restoreFailure],
|
|
83
|
+
"Publishing failed and the previous film could not be restored to " +
|
|
84
|
+
paths.video,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
throw cause;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -4,21 +4,20 @@ import type { AutoMovieCommand } from "./AutoMovieCommand";
|
|
|
4
4
|
import { readAutoMovieNameOption } from "./readAutoMovieNameOption";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* Admit one `add` request: exactly one `shorts/<directory>` or
|
|
7
|
+
* Admit one `add` request: exactly one `shorts/<directory>` or
|
|
8
|
+
* `series/<directory>` target with optional single `--force` and `--name
|
|
9
|
+
* <name>`, in any order.
|
|
8
10
|
*
|
|
9
|
-
* The target is split at its one `/`; the family must be `shorts` or `series`,
|
|
11
|
+
* The target is split at its one `/`; the family must be `shorts` or `series`,
|
|
12
|
+
* and the directory must be one segment that the template's project-name rule
|
|
13
|
+
* admits unchanged, so `movies/<family>/<directory>` cannot leave the
|
|
14
|
+
* workspace. Every refusal throws an `Error` whose message names the
|
|
15
|
+
* correction.
|
|
10
16
|
*
|
|
11
17
|
* @param args The tokens after `add`.
|
|
12
18
|
* @returns The admitted request.
|
|
13
|
-
* @throws On an unknown or repeated option, a missing name value, a target
|
|
14
|
-
*
|
|
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; the template owns the segment rule and `run` owns the workspace path.
|
|
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
|
-
* @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
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One scan over the tokens and one split of the target.
|
|
20
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work This pure parser owns no cross-request effect to reuse.
|
|
21
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Local strings and arrays expire after return and no handle is acquired.
|
|
19
|
+
* @throws On an unknown or repeated option, a missing name value, a target
|
|
20
|
+
* count other than one, an unknown family, or a refused directory segment.
|
|
22
21
|
*/
|
|
23
22
|
export function readAutoMovieAddArguments(
|
|
24
23
|
args: readonly string[],
|