pup-recorder 0.2.7 → 0.2.8

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/build.ts CHANGED
@@ -3,15 +3,12 @@ import { rm } from "fs/promises";
3
3
  import { createRequire } from "module";
4
4
  import { join } from "path";
5
5
  import { build, type Options } from "tsup";
6
- import { buildRust } from "./build_rust";
7
6
  import { dependencies } from "./package.json";
8
7
 
9
8
  const require = createRequire(import.meta.url);
10
9
  const tsPath = require.resolve("@typescript/native-preview/package.json");
11
10
  const tsgo = join(tsPath, "..", "bin", "tsgo.js");
12
11
 
13
- await buildRust();
14
-
15
12
  await $`${tsgo}`;
16
13
  await rm("dist", { recursive: true, force: true });
17
14
 
@@ -14,6 +14,7 @@ import type { NativeImage } from 'electron';
14
14
  import { Packet } from 'node-av';
15
15
  import { Size } from 'electron';
16
16
  import { Socket } from 'net';
17
+ import { SoftwareScaleContext } from 'node-av';
17
18
  import { SpawnOptions } from 'child_process';
18
19
  import z from 'zod';
19
20
 
@@ -67,23 +68,45 @@ export declare function buildRust(): Promise<void>;
67
68
  export declare function buildStegoHTML(targetURL: string, size: Size): string;
68
69
 
69
70
  /**
70
- * Builds the JS injector that hooks all time-related globals in the target iframe.
71
- * Guards against running in the wrapper (top-level) frame so the stego canvas is unaffected.
71
+ * Builds the JS injector that hooks all time-related globals in the target frame.
72
+ * In Electron/stego mode (default), guards against running in the top-level frame.
73
+ * In Puppeteer mode (skipFrameGuard: true), injects directly into the main document.
72
74
  * Must be injected via Page.addScriptToEvaluateOnNewDocument AND directly into
73
- * already-loaded sub-frames.
75
+ * already-loaded frames.
74
76
  */
75
- export declare function buildTickInjector(): string;
77
+ export declare function buildTickInjector(opts?: TickInjectorOptions): string;
76
78
 
77
79
  export declare const canIUseGPU: Promise<boolean>;
78
80
 
79
81
  export declare function checkHTML(source: string): void;
80
82
 
83
+ export declare function chromiumOptions(): Promise<string[]>;
84
+
81
85
  export declare interface CLIOptions {
82
86
  name: string;
83
87
  defaults: RenderOptions;
84
88
  run: (source: string, options: RenderOptions) => Promise<unknown>;
85
89
  }
86
90
 
91
+ declare class CodecState_2 implements Disposable {
92
+ readonly src: Frame;
93
+ readonly dst: Frame;
94
+ readonly pkt: Packet;
95
+ private _sws?;
96
+ private _png?;
97
+ static create(width: number, height: number): Promise<CodecState_2>;
98
+ private constructor();
99
+ /**
100
+ * Create a fresh PNG decoder context.
101
+ * The FFmpeg PNG decoder accumulates APNG blending state
102
+ * across frames, so a shared instance corrupts output when decoding standalone PNGs.
103
+ */
104
+ png(): Promise<CodecContext>;
105
+ get sws(): SoftwareScaleContext;
106
+ [Symbol.dispose](): void;
107
+ }
108
+ export { CodecState_2 as CodecState }
109
+
87
110
  declare class ConcurrencyLimiter {
88
111
  readonly maxConcurrency: number;
89
112
  private _active;
@@ -120,7 +143,7 @@ declare const DEFAULT_HEIGHT = 1080;
120
143
  export { DEFAULT_HEIGHT }
121
144
  export { DEFAULT_HEIGHT as DEFAULT_HEIGHT_alias_1 }
122
145
 
123
- declare const DEFAULT_OUT_FILE = "output.mov";
146
+ declare const DEFAULT_OUT_FILE = "output.mp4";
124
147
  export { DEFAULT_OUT_FILE }
125
148
  export { DEFAULT_OUT_FILE as DEFAULT_OUT_FILE_alias_1 }
126
149
 
@@ -136,6 +159,8 @@ export declare function doEject(): string;
136
159
 
137
160
  export declare function doProcess(timestampMs: number): string;
138
161
 
162
+ export declare function doPuppeteer(source: string, options: RenderOptions, onProgress?: (p: number) => void): Promise<IpcDonePayload>;
163
+
139
164
  export declare function electronOpts(): Promise<string[]>;
140
165
 
141
166
  declare class EncoderPipeline {
@@ -144,14 +169,13 @@ declare class EncoderPipeline {
144
169
  private _muxer;
145
170
  private _limiter;
146
171
  private _outFile;
147
- private _sws;
148
- private _srcFrame;
149
- private _dstFrame;
172
+ private _codec;
150
173
  private _disposed;
151
174
  private constructor();
152
175
  static create(opts: EncoderPipelineOptions): Promise<EncoderPipeline>;
153
176
  setupAudio(sampleRate: number): void;
154
- encodeFrame(input: Buffer): Promise<void>;
177
+ encodeBGRA(input: Buffer): Promise<void>;
178
+ encodePNG(pngData: Buffer): Promise<void>;
155
179
  encodeAudio(pcm: Buffer): Promise<void>;
156
180
  finish(): Promise<string>;
157
181
  [Symbol.asyncDispose](): Promise<void>;
@@ -389,6 +413,10 @@ declare const pupDisableGPU: boolean;
389
413
  export { pupDisableGPU }
390
414
  export { pupDisableGPU as pupDisableGPU_alias_1 }
391
415
 
416
+ declare const pupExperimentalPuppeteer: boolean;
417
+ export { pupExperimentalPuppeteer }
418
+ export { pupExperimentalPuppeteer as pupExperimentalPuppeteer_alias_1 }
419
+
392
420
  declare const pupIpcSocket: string | undefined;
393
421
  export { pupIpcSocket }
394
422
  export { pupIpcSocket as pupIpcSocket_alias_1 }
@@ -477,6 +505,15 @@ export declare function stopStego(cdp: Debugger): Promise<any>;
477
505
 
478
506
  export declare const TICK_SYMBOL = "__pup_tick__";
479
507
 
508
+ export declare interface TickInjectorOptions {
509
+ /**
510
+ * When true, skips the top-frame guard so the injector runs in the main document.
511
+ * Required for Puppeteer mode where the page is loaded directly (no stego iframe wrapper).
512
+ * Default: false (Electron/stego mode — only inject in iframes).
513
+ */
514
+ skipFrameGuard?: boolean;
515
+ }
516
+
480
517
  export declare function unsetInterceptor(window: BrowserWindow): void;
481
518
 
482
519
  declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
@@ -507,7 +544,6 @@ export declare interface VideoEncoderOptions {
507
544
  codecOpts: Record<string, string>;
508
545
  bitrate: number;
509
546
  pixelFormat: AVPixelFormat;
510
- threadCount?: number;
511
547
  muxer: FormatMuxer;
512
548
  }
513
549