pup-recorder 0.4.3 → 0.4.4

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/biome.json CHANGED
@@ -15,6 +15,7 @@
15
15
  "strictCase": false,
16
16
  "conventions": [
17
17
  { "selector": { "kind": "classProperty", "modifiers": ["private"] }, "match": "_(.+)" },
18
+ { "selector": { "kind": "classMethod", "modifiers": ["private"] }, "match": "[^_].*" },
18
19
  { "selector": { "kind": "typeProperty" }, "match": "__.+|[a-z][A-Za-z0-9]*|[a-z][a-z0-9]*(?:_[a-z0-9]+)*|[A-Z][A-Za-z0-9]*|[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)*" },
19
20
  { "selector": { "kind": "objectLiteralProperty" }, "formats": ["camelCase", "snake_case", "PascalCase", "CONSTANT_CASE"] },
20
21
  { "selector": { "kind": "variable" }, "formats": ["camelCase", "snake_case", "PascalCase", "CONSTANT_CASE"] },
package/build.ts CHANGED
@@ -7,12 +7,12 @@ import { dependencies } from "./package.json";
7
7
 
8
8
  const require = createRequire(import.meta.url);
9
9
  const tsPath = require.resolve("@typescript/native-preview/package.json");
10
- const tsgo = join(tsPath, "..", "bin", "tsgo.js");
10
+ const tsgo = join(tsPath, "..", require(tsPath).bin.tsgo);
11
11
  const biomePath = require.resolve("@biomejs/biome/package.json");
12
12
  const biome = join(biomePath, "..", "bin", "biome");
13
13
 
14
14
  await $`${tsgo}`;
15
- await $`${biome} check --write src`;
15
+ await $`${biome} check --write --error-on-warnings`;
16
16
  await rm("dist", { recursive: true, force: true });
17
17
 
18
18
  const common: Options = {
@@ -11,7 +11,6 @@ import { Demuxer } from 'node-av/api';
11
11
  import { EventEmitter } from 'node:events';
12
12
  import { FFAudioEncoder } from 'node-av/constants';
13
13
  import type { FFVideoEncoder } from 'node-av/constants';
14
- import { FormatContext } from 'node-av';
15
14
  import { Frame } from 'node-av';
16
15
  import { HardwareContext } from 'node-av/api';
17
16
  import { HardwareFramesContext } from 'node-av';
@@ -231,9 +230,10 @@ export declare class DecodeSession {
231
230
  private _restart;
232
231
  private readonly _leadFrames;
233
232
  private readonly _keepCount;
233
+ private readonly _pumpDone;
234
234
  constructor(meta: VideoMeta, _src: string);
235
235
  getFrame(idx: number): Promise<Buffer>;
236
- close(): void;
236
+ close(): Promise<void>;
237
237
  private wait;
238
238
  private wake;
239
239
  private requestRestart;
@@ -349,8 +349,9 @@ export declare function fitRect(srcW: number, srcH: number, dstW: number, dstH:
349
349
  export declare class FormatMuxer {
350
350
  private readonly _ctx;
351
351
  private _opened;
352
+ private _disposed;
352
353
  constructor(outPath: string, formatName?: string);
353
- addStream(codecCtx: CodecContext, codecTag?: string): ReturnType<FormatContext["newStream"]>;
354
+ addStream(codecCtx: CodecContext, codecTag?: string): Stream;
354
355
  open(): Promise<void>;
355
356
  writePacket(pkt: Packet): Promise<void>;
356
357
  [Symbol.asyncDispose](): Promise<void>;
@@ -363,7 +364,7 @@ export declare const FRAME_SYNC_MARKER_WIDTH = 32;
363
364
  export declare class FrameCache {
364
365
  private _caches;
365
366
  cacheOf(id: string): VideoCache;
366
- fetch(state: VideoState, idx: number): Promise<ImageBitmap | null>;
367
+ fetch(state: VideoState, idx: number): Promise<ImageBitmap | undefined>;
367
368
  prefetch(state: VideoState, fromIdx: number, count: number): void;
368
369
  evict(c: VideoCache): void;
369
370
  release(id: string, state: VideoState): void;
@@ -404,16 +405,16 @@ export declare class FrameDropStats {
404
405
  }
405
406
 
406
407
  export declare class FrameServer {
408
+ private readonly _useInnerProxy;
407
409
  private _sessions;
408
410
  private _closed;
411
+ constructor(_useInnerProxy: boolean);
409
412
  open(opts: OpenOptions): Promise<VideoMeta>;
410
413
  getFrame(id: string, idx: number): Promise<Buffer>;
411
- close(id: string): void;
412
- closeAll(): void;
414
+ close(id: string): Promise<void>;
415
+ closeAll(): Promise<void>;
413
416
  }
414
417
 
415
- export declare const frameServer: FrameServer;
416
-
417
418
  export declare const HAVE_ENOUGH_DATA = 4;
418
419
 
419
420
  export declare const HAVE_METADATA = 1;
@@ -637,7 +638,7 @@ export declare interface OpenOptions {
637
638
  fit?: string;
638
639
  }
639
640
 
640
- export declare function openSession(hook: VideoHook, args: AttachArgs): Promise<VideoState | null>;
641
+ export declare function openSession(hook: VideoHook, args: AttachArgs): Promise<VideoState | undefined>;
641
642
 
642
643
  export declare function openVideoCtx(opts: VideoCtxOptions, label: string): Promise<CodecContext>;
643
644
 
@@ -682,7 +683,7 @@ declare function penv<T>(name: string, parser: EnvParser<T>, defaultValue?: T):
682
683
  export { penv }
683
684
  export { penv as penv_alias_1 }
684
685
 
685
- declare function periodical(callback: (count: number) => Promise<void> | void, ms: number): () => void;
686
+ declare function periodical(callback: (count: number) => Promise<number | undefined> | undefined, ms: number): () => void;
686
687
  export { periodical }
687
688
  export { periodical as periodical_alias_1 }
688
689
 
@@ -840,8 +841,6 @@ export declare function setInterceptor({ source, window, useInnerProxy, cancelMe
840
841
 
841
842
  export declare function setupCanvas(video: HTMLVideoElement, snap: OffscreenCanvas | undefined): HTMLCanvasElement;
842
843
 
843
- export declare function setupFrameProtocol(): void;
844
-
845
844
  export declare function setupPupProtocol(): void;
846
845
 
847
846
  export declare function shoot(options: IPCRenderOptions): Promise<IpcDonePayload>;
@@ -903,6 +902,8 @@ export declare interface UnifiedExtradataOptions {
903
902
 
904
903
  export declare function unsetInterceptor(window: BrowserWindow): void;
905
904
 
905
+ export declare function useFrameProtocol(useInnerProxy: boolean): AsyncDisposable;
906
+
906
907
  declare function useRetry<Args extends unknown[], Ret>({ fn, maxAttempts, timeout, signal, }: RetryOptions<Args, Ret>): (...args: Args) => Promise<Ret>;
907
908
  export { useRetry }
908
909
  export { useRetry as useRetry_alias_1 }
@@ -911,7 +912,7 @@ declare type Vec4 = [number, number, number, number];
911
912
 
912
913
  export declare interface VideoCache {
913
914
  bitmaps: Map<number, ImageBitmap>;
914
- inFlight: Map<number, Promise<ImageBitmap | null>>;
915
+ inFlight: Map<number, Promise<ImageBitmap | undefined>>;
915
916
  readers: Map<VideoState, number>;
916
917
  }
917
918
 
@@ -965,14 +966,14 @@ export declare interface VideoFrameMeta {
965
966
 
966
967
  export declare class VideoHook {
967
968
  readonly sessions: WeakMap<HTMLVideoElement, VideoState>;
968
- readonly attaching: WeakMap<HTMLVideoElement, Promise<VideoState | null>>;
969
+ readonly attaching: WeakMap<HTMLVideoElement, Promise<VideoState | undefined>>;
969
970
  readonly opening: Set<Promise<unknown>>;
970
971
  readonly cache: FrameCache;
971
972
  rvfcSeq: number;
972
973
  currMs: number;
973
974
  private _lastSnapshot;
974
975
  install(): void;
975
- attach(video: HTMLVideoElement, native?: boolean): Promise<VideoState | null>;
976
+ attach(video: HTMLVideoElement, native?: boolean): Promise<VideoState | undefined>;
976
977
  ready(): Promise<void>;
977
978
  resume(video: HTMLVideoElement, state: VideoState): void;
978
979
  detach(video: HTMLVideoElement): void;
@@ -1014,7 +1015,7 @@ export declare interface VideoSetup {
1014
1015
  }
1015
1016
 
1016
1017
  export declare interface VideoState {
1017
- meta: VideoMeta_alias_1 | null;
1018
+ meta?: VideoMeta_alias_1;
1018
1019
  cv: HTMLCanvasElement;
1019
1020
  ctx: CanvasRenderingContext2D;
1020
1021
  paused: boolean;