@hyperframes/producer 0.9.72 → 0.9.74

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.
@@ -1,5 +1,5 @@
1
1
  import { type RateSpec, type ResolvedDuration, type UnresolvedElement } from "@hyperframes/core";
2
- import { CompositionExpansionBudget } from "./compositionSizeLimit.js";
2
+ import { CompositionExpansionBudget } from "@hyperframes/core/compiler";
3
3
  import { type OutsideFilePolicy } from "../utils/paths.js";
4
4
  import { type VideoElement, type ImageElement, type AudioElement, type AudioVolumeKeyframe } from "@hyperframes/engine";
5
5
  import type { Page } from "puppeteer-core";
@@ -55,6 +55,22 @@ export declare function detectThreeDTransformUsage(html: string): boolean;
55
55
  */
56
56
  export declare function detectAncestorBackgroundImage(html: string): boolean;
57
57
  export declare function detectShaderTransitionUsage(html: string): boolean;
58
+ /** At most this many distinct remote media, image and font files download for one compile. */
59
+ export declare const MAX_REMOTE_ASSETS = 1000;
60
+ /** One compile's media, image and font downloads: its cancel, a cap on distinct files, a few at a time. */
61
+ declare class AssetDownloads {
62
+ private readonly reserved;
63
+ private running;
64
+ private readonly queued;
65
+ private readonly ended;
66
+ readonly signal: AbortSignal;
67
+ constructor(cancel?: AbortSignal);
68
+ /** Stops every download still running or queued: the compile that owns them has returned. */
69
+ end(): void;
70
+ /** Throws before any of `urls` downloads when they would take the compile past the cap. */
71
+ reserve(urls: Iterable<string>): void;
72
+ download(url: string, destDir: string): Promise<string>;
73
+ }
58
74
  /**
59
75
  * Distinct remote addresses one compile downloads, per kind: scripts, and non-Google stylesheets (counted before
60
76
  * their contents are read, so a stylesheet with no font rules counts too).
@@ -104,7 +120,7 @@ export declare const REMOTE_MEDIA_SUBDIR = "_remote_media";
104
120
  * the race entirely and keeps the render hermetic.
105
121
  */
106
122
  /** @internal exported for unit testing only */
107
- export declare function localizeRemoteMediaSources(html: string, downloadDir: string): Promise<{
123
+ export declare function localizeRemoteMediaSources(html: string, downloadDir: string, assets?: AssetDownloads): Promise<{
108
124
  html: string;
109
125
  remoteMediaAssets: Map<string, string>;
110
126
  }>;
@@ -132,7 +148,7 @@ export declare function localizeRemoteMediaSources(html: string, downloadDir: st
132
148
  * `hyperframes publish`'s archive-time localize step.
133
149
  */
134
150
  /** @internal exported for unit testing only */
135
- export declare function localizeRemoteImageSources(html: string, downloadDir: string): Promise<{
151
+ export declare function localizeRemoteImageSources(html: string, downloadDir: string, assets?: AssetDownloads): Promise<{
136
152
  html: string;
137
153
  remoteMediaAssets: Map<string, string>;
138
154
  }>;
@@ -149,7 +165,7 @@ export declare function localizeRemoteImageSources(html: string, downloadDir: st
149
165
  *
150
166
  * @internal exported for unit testing only
151
167
  */
152
- export declare function localizeRemoteBackgroundImages(html: string, downloadDir: string): Promise<{
168
+ export declare function localizeRemoteBackgroundImages(html: string, downloadDir: string, assets?: AssetDownloads): Promise<{
153
169
  html: string;
154
170
  remoteMediaAssets: Map<string, string>;
155
171
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/producer",
3
- "version": "0.9.72",
3
+ "version": "0.9.74",
4
4
  "description": "HTML-to-video rendering engine using Chrome's BeginFrame API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  "postcss": "^8.4.0",
36
36
  "puppeteer": "~25.13.0",
37
37
  "puppeteer-core": "^25.13.0",
38
- "@hyperframes/core": "0.9.72",
39
- "@hyperframes/lint": "0.9.72",
40
- "@hyperframes/studio-server": "0.9.72",
41
- "@hyperframes/parsers": "0.9.72",
42
- "@hyperframes/engine": "0.9.72"
38
+ "@hyperframes/engine": "0.9.74",
39
+ "@hyperframes/core": "0.9.74",
40
+ "@hyperframes/lint": "0.9.74",
41
+ "@hyperframes/parsers": "0.9.74",
42
+ "@hyperframes/studio-server": "0.9.74"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^25.0.10",
@@ -48,7 +48,7 @@
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^5.7.2",
50
50
  "vitest": "^4.1.12",
51
- "@hyperframes/aws-lambda": "0.9.72"
51
+ "@hyperframes/aws-lambda": "0.9.74"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=22"
@@ -1,28 +0,0 @@
1
- /**
2
- * The largest entry or sub-composition HTML file a render compiles. Compiling and probing a page
3
- * runs on the render server's main thread, and their cost grows with the page's size, so one huge
4
- * page would hold up every other render in the same process.
5
- */
6
- export declare const MAX_COMPOSITION_HTML_BYTES: number;
7
- /**
8
- * What one render may inline across every sub-composition mount. Each file is checked on its own
9
- * above, but a few small files that mount each other many times assemble a page far larger.
10
- */
11
- export declare const MAX_EXPANDED_COMPOSITION_BYTES: number;
12
- export declare const REMOTE_SCRIPTS = "remote scripts";
13
- export declare const REMOTE_STYLESHEETS = "remote stylesheets";
14
- /** Adds up every mount a render inlines, and what it generates for them, and throws past a limit. */
15
- export declare class CompositionExpansionBudget {
16
- private bytes;
17
- private mounts;
18
- private generated;
19
- /** `bytes` may be negative when a reserved upper bound is settled to the real size. */
20
- chargeGenerated(file: string, bytes: number): void;
21
- chargeGeneratedIfItFits(bytes: number): boolean;
22
- charge(file: string, bytes: number): void;
23
- }
24
- /**
25
- * Throws {@link CompositionTooLargeError} when `path` is a file over the limit, before anything
26
- * reads it. A missing path or a folder passes, so the caller's own read reports it as before.
27
- */
28
- export declare function assertCompositionFileSize(path: string, file: string): void;