pup-recorder 0.1.7 → 0.1.9

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
@@ -33,7 +33,7 @@ await Promise.all([
33
33
  entry: ["src/index.ts", "src/cli.ts"],
34
34
  format: "esm",
35
35
  outDir: "dist",
36
- dts: true,
36
+ experimentalDts: true,
37
37
  }),
38
38
  build({
39
39
  ...common,
package/build_rust.ts CHANGED
@@ -33,7 +33,7 @@ async function copyArtifact(platform: string, arch: string, dir: string) {
33
33
  const src = join(dir, libName);
34
34
  const destDir = join("rust");
35
35
  const dest = join(destDir, `${platform}-${arch}.bin`);
36
- const dts = `declare const sth: Uint8Array;\nexport = sth;\n`;
36
+ const dts = `declare const sth: unknown;\nexport = sth;\n`;
37
37
  await mkdir(destDir, { recursive: true });
38
38
  await copyFile(src, dest);
39
39
  await writeFile(`${dest}.d.ts`, dts);
@@ -0,0 +1,371 @@
1
+ import { BrowserWindow } from 'electron';
2
+ import { ChildProcess } from 'child_process';
3
+ import type { Debugger } from 'electron';
4
+ import type { NativeImage } from 'electron';
5
+ import { Size } from 'electron';
6
+ import { SpawnOptions } from 'child_process';
7
+ import z from 'zod';
8
+
9
+ declare class AbortLink {
10
+ readonly query?: AbortQuery | undefined;
11
+ readonly interval: number;
12
+ private _callback?;
13
+ private _aborted?;
14
+ private _stopped;
15
+ private constructor();
16
+ static start(query?: AbortQuery, interval?: number): AbortLink;
17
+ get aborted(): boolean | undefined;
18
+ get stopped(): boolean;
19
+ onAbort(callback: AsyncTask): Promise<void>;
20
+ wait(...handles: ProcessHandle[]): Promise<unknown>;
21
+ stop(): void;
22
+ private tick;
23
+ }
24
+ export { AbortLink }
25
+ export { AbortLink as AbortLink_alias_1 }
26
+
27
+ declare type AbortQuery = () => Promise<boolean> | boolean;
28
+ export { AbortQuery }
29
+ export { AbortQuery as AbortQuery_alias_1 }
30
+
31
+ export declare const app: string | undefined;
32
+
33
+ declare type AsyncTask = () => Promise<void> | void;
34
+ export { AsyncTask }
35
+ export { AsyncTask as AsyncTask_alias_1 }
36
+
37
+ export declare interface AudioCapture {
38
+ sampleRate?: number;
39
+ teardown(): Promise<void>;
40
+ }
41
+
42
+ declare interface AudioSpec {
43
+ pcmPath: string;
44
+ sampleRate: number;
45
+ }
46
+ export { AudioSpec }
47
+ export { AudioSpec as AudioSpec_alias_1 }
48
+
49
+ export declare const basedir: string;
50
+
51
+ export declare interface BGRAFileOptions {
52
+ bgra: string;
53
+ outFile: string;
54
+ spec: VideoSpec;
55
+ audio?: AudioSpec;
56
+ }
57
+
58
+ export declare function buildRust(): Promise<void>;
59
+
60
+ export declare function buildWrapperHTML(targetURL: string, size: Size): string;
61
+
62
+ export declare const canIUseGPU: Promise<boolean>;
63
+
64
+ export declare function checkHTML(source: string): void;
65
+
66
+ export declare type CLICallback = (source: string, options: RenderOptions) => Promise<unknown>;
67
+
68
+ declare interface Command {
69
+ command: string;
70
+ args: string[];
71
+ }
72
+
73
+ declare class ConcurrencyLimiter {
74
+ readonly maxConcurrency: number;
75
+ private _active;
76
+ private _queue;
77
+ private _ended;
78
+ constructor(maxConcurrency: number);
79
+ get active(): number;
80
+ get pending(): number;
81
+ get stats(): string;
82
+ schedule<T>(fn: () => Promise<T>): Promise<T>;
83
+ end(): Promise<void>;
84
+ private next;
85
+ }
86
+ export { ConcurrencyLimiter }
87
+ export { ConcurrencyLimiter as ConcurrencyLimiter_alias_1 }
88
+
89
+ export declare function createBGRA2MOVPipeline(x265: string, options: BGRAFileOptions): X265Pipeline;
90
+
91
+ export declare function createBGRAFileCommand(options: BGRAFileOptions): Command;
92
+
93
+ export declare function createCoverCommand(src: string, dst: string): Command;
94
+
95
+ export declare function decodeTimestamp(bitmap: Buffer, size: Size): number | undefined;
96
+
97
+ declare const DEFAULT_DURATION = 5;
98
+ export { DEFAULT_DURATION }
99
+ export { DEFAULT_DURATION as DEFAULT_DURATION_alias_1 }
100
+
101
+ declare const DEFAULT_FPS = 30;
102
+ export { DEFAULT_FPS }
103
+ export { DEFAULT_FPS as DEFAULT_FPS_alias_1 }
104
+
105
+ declare const DEFAULT_HEIGHT = 1080;
106
+ export { DEFAULT_HEIGHT }
107
+ export { DEFAULT_HEIGHT as DEFAULT_HEIGHT_alias_1 }
108
+
109
+ declare const DEFAULT_OUT_DIR = "out";
110
+ export { DEFAULT_OUT_DIR }
111
+ export { DEFAULT_OUT_DIR as DEFAULT_OUT_DIR_alias_1 }
112
+
113
+ declare const DEFAULT_WIDTH = 1920;
114
+ export { DEFAULT_WIDTH }
115
+ export { DEFAULT_WIDTH as DEFAULT_WIDTH_alias_1 }
116
+
117
+ export declare function electronOpts(): Promise<string[]>;
118
+
119
+ export declare function encodeBGRAFile(options: BGRAFileOptions): ProcessHandle;
120
+
121
+ export declare function encodeBgraToMov(options: BGRAFileOptions): ProcessHandle;
122
+
123
+ declare type EnvParser<T> = (value: unknown) => T;
124
+ export { EnvParser }
125
+ export { EnvParser as EnvParser_alias_1 }
126
+
127
+ declare function exec(cmd: string, options?: SpawnOptions): ProcessHandle;
128
+ export { exec }
129
+ export { exec as exec_alias_1 }
130
+
131
+ export declare interface FixedBufferWriter {
132
+ new (path: string, bufferSize: number, queueDepth?: number): FixedBufferWriter;
133
+ write(buffer: Buffer): void;
134
+ close(): Promise<void>;
135
+ }
136
+
137
+ export declare const FixedBufferWriter: FixedBufferWriter;
138
+
139
+ export declare const FRAME_SYNC_MARKER_HEIGHT = 1;
140
+
141
+ export declare const FRAME_SYNC_MARKER_WIDTH = 32;
142
+
143
+ export declare function isEmpty(image: NativeImage): boolean;
144
+
145
+ declare class Lazy<T> {
146
+ readonly makeValue: () => T;
147
+ constructor(makeValue: () => T);
148
+ get value(): T;
149
+ get initialized(): boolean;
150
+ private _initialized;
151
+ private _value;
152
+ }
153
+ export { Lazy }
154
+ export { Lazy as Lazy_alias_1 }
155
+
156
+ export declare function loadWindow(source: string, options: RenderOptions): Promise<BrowserWindow>;
157
+
158
+ declare class Logger implements LoggerLike {
159
+ private _impl?;
160
+ get impl(): LoggerLike | undefined;
161
+ set impl(value: LoggerLike);
162
+ constructor();
163
+ debug(...messages: unknown[]): void;
164
+ info(...messages: unknown[]): void;
165
+ warn(...messages: unknown[]): void;
166
+ error(...messages: unknown[]): void;
167
+ fatal(...messages: unknown[]): void;
168
+ private dispatch;
169
+ attach(proc: ChildProcess, name: string): Promise<void>;
170
+ }
171
+
172
+ declare const logger: Logger;
173
+ export { logger }
174
+ export { logger as logger_alias_1 }
175
+
176
+ declare interface LoggerLike {
177
+ debug?(this: void, ...messages: unknown[]): void;
178
+ info?(this: void, ...messages: unknown[]): void;
179
+ warn?(this: void, ...messages: unknown[]): void;
180
+ error?(this: void, ...messages: unknown[]): void;
181
+ }
182
+ export { LoggerLike }
183
+ export { LoggerLike as LoggerLike_alias_1 }
184
+
185
+ export declare function makeCLI(name: string, callback: CLICallback): Promise<void>;
186
+
187
+ export declare function mountX265(): string;
188
+
189
+ export declare interface NetworkOptions {
190
+ source: string;
191
+ window: BrowserWindow;
192
+ useInnerProxy?: boolean;
193
+ }
194
+
195
+ declare function noerr<Fn extends (...args: any[]) => any, D>(fn: Fn, defaultValue: D): (...args: Parameters<Fn>) => ReturnType<Fn> | D;
196
+ export { noerr }
197
+ export { noerr as noerr_alias_1 }
198
+
199
+ declare function pargs(): string[];
200
+ export { pargs }
201
+ export { pargs as pargs_alias_1 }
202
+
203
+ declare function parseNumber(value: unknown): number;
204
+ export { parseNumber }
205
+ export { parseNumber as parseNumber_alias_1 }
206
+
207
+ declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue: T): T;
208
+
209
+ declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue?: T): T | undefined;
210
+ export { penv }
211
+ export { penv as penv_alias_1 }
212
+
213
+ declare function periodical(callback: (count: number) => Promise<void> | void, ms: number): () => void;
214
+ export { periodical }
215
+ export { periodical as periodical_alias_1 }
216
+
217
+ declare interface ProcessHandle {
218
+ process: ChildProcess;
219
+ wait: Promise<void>;
220
+ }
221
+ export { ProcessHandle }
222
+ export { ProcessHandle as ProcessHandle_alias_1 }
223
+
224
+ export declare function proxiedUrl(url: string): string;
225
+
226
+ declare function pup(source: string, options: PupOptions): Promise<PupResult>;
227
+ export { pup }
228
+ export { pup as pup_alias_1 }
229
+
230
+ declare const PUP_ARGS_KEY = "--pup-priv-args";
231
+ export { PUP_ARGS_KEY }
232
+ export { PUP_ARGS_KEY as PUP_ARGS_KEY_alias_1 }
233
+
234
+ declare const pupDisableGPU: boolean;
235
+ export { pupDisableGPU }
236
+ export { pupDisableGPU as pupDisableGPU_alias_1 }
237
+
238
+ declare const pupFFmpegPath: string;
239
+ export { pupFFmpegPath }
240
+ export { pupFFmpegPath as pupFFmpegPath_alias_1 }
241
+
242
+ declare const pupLogLevel: number;
243
+ export { pupLogLevel }
244
+ export { pupLogLevel as pupLogLevel_alias_1 }
245
+
246
+ declare const pupNoCleanup: boolean;
247
+ export { pupNoCleanup }
248
+ export { pupNoCleanup as pupNoCleanup_alias_1 }
249
+
250
+ declare interface PupOptions extends Partial<RenderOptions> {
251
+ cancelQuery?: AbortQuery;
252
+ onProgress?: PupProgressCallback;
253
+ }
254
+ export { PupOptions }
255
+ export { PupOptions as PupOptions_alias_1 }
256
+
257
+ declare type PupProgressCallback = (progress: number) => Promise<void> | void;
258
+ export { PupProgressCallback }
259
+ export { PupProgressCallback as PupProgressCallback_alias_1 }
260
+
261
+ declare interface PupResult {
262
+ options: RenderOptions;
263
+ files: VideoFilesWithCover;
264
+ }
265
+ export { PupResult }
266
+ export { PupResult as PupResult_alias_1 }
267
+
268
+ declare const pupUseInnerProxy: boolean;
269
+ export { pupUseInnerProxy }
270
+ export { pupUseInnerProxy as pupUseInnerProxy_alias_1 }
271
+
272
+ export declare function render(source: string, options: RenderOptions): Promise<void>;
273
+
274
+ declare type RenderOptions = z.infer<typeof RenderSchema>;
275
+ export { RenderOptions }
276
+ export { RenderOptions as RenderOptions_alias_1 }
277
+
278
+ declare interface RenderResult {
279
+ options: RenderOptions;
280
+ written: number;
281
+ bgra: string;
282
+ audio?: AudioSpec;
283
+ }
284
+ export { RenderResult }
285
+ export { RenderResult as RenderResult_alias_1 }
286
+
287
+ declare const RenderSchema: z.ZodObject<{
288
+ duration: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
289
+ width: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
290
+ height: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
291
+ fps: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
292
+ withAlphaChannel: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
293
+ withAudio: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
294
+ outDir: z.ZodDefault<z.ZodOptional<z.ZodString>>;
295
+ useInnerProxy: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
296
+ }, z.core.$strip>;
297
+ export { RenderSchema }
298
+ export { RenderSchema as RenderSchema_alias_1 }
299
+
300
+ declare interface RetryOptions<Args extends any[], Ret> {
301
+ fn: (...args: Args) => Promise<Ret>;
302
+ maxAttempts?: number;
303
+ timeout?: number;
304
+ }
305
+ export { RetryOptions }
306
+ export { RetryOptions as RetryOptions_alias_1 }
307
+
308
+ export declare function runElectronApp(size: Size, args: unknown[]): Promise<ProcessHandle>;
309
+
310
+ export declare function setInterceptor({ source, window, useInnerProxy, }: NetworkOptions): void;
311
+
312
+ export declare function setupAudioCapture(pcmPath: string): Promise<AudioCapture>;
313
+
314
+ declare function sleep(ms: number): Promise<void>;
315
+ export { sleep }
316
+ export { sleep as sleep_alias_1 }
317
+
318
+ export declare function startSync(cdp: Debugger): Promise<any>;
319
+
320
+ export declare function stopSync(cdp: Debugger): Promise<any>;
321
+
322
+ export declare function unmountX265(path: string): void;
323
+
324
+ export declare function unsetInterceptor(window: BrowserWindow): void;
325
+
326
+ declare function useRetry<Args extends any[], Ret>({ fn, maxAttempts, timeout, }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
327
+ export { useRetry }
328
+ export { useRetry as useRetry_alias_1 }
329
+
330
+ declare interface VideoFiles {
331
+ mp4?: string;
332
+ webm?: string;
333
+ mov?: string;
334
+ }
335
+ export { VideoFiles }
336
+ export { VideoFiles as VideoFiles_alias_1 }
337
+
338
+ declare interface VideoFilesWithCover extends VideoFiles {
339
+ cover: string;
340
+ }
341
+ export { VideoFilesWithCover }
342
+ export { VideoFilesWithCover as VideoFilesWithCover_alias_1 }
343
+
344
+ declare interface VideoSpec {
345
+ fps: number;
346
+ frames: number;
347
+ size: Size;
348
+ }
349
+ export { VideoSpec }
350
+ export { VideoSpec as VideoSpec_alias_1 }
351
+
352
+ export declare class WaitableEvent {
353
+ private _promise?;
354
+ private _resolve?;
355
+ private _timeoutToken?;
356
+ wait(options?: WaitOptions): Promise<void>;
357
+ signal(): void;
358
+ }
359
+
360
+ export declare interface WaitOptions {
361
+ timeout: number;
362
+ onTimeout?: () => void;
363
+ }
364
+
365
+ declare interface X265Pipeline {
366
+ raw: Command;
367
+ x265: Command;
368
+ mux: Command;
369
+ }
370
+
371
+ export { }